2022-01-13 08:50:51 -05:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
|
|
|
|
#define __USE_POSIX2
|
|
|
|
#include <stdio.h>
|
|
|
|
|
2022-01-14 01:35:20 -05:00
|
|
|
static const char output[] =
|
2022-01-13 09:55:24 -05:00
|
|
|
"Multiboot 2 header\n"
|
2022-01-14 00:40:51 -05:00
|
|
|
" magic: 3897708758\n"
|
2022-01-14 01:20:16 -05:00
|
|
|
" arch: 0 (i386)\n"
|
2022-01-13 23:46:46 -05:00
|
|
|
" size: 272\n"
|
2022-01-14 01:20:16 -05:00
|
|
|
" checksum: 397258266\n"
|
2022-01-13 23:10:41 -05:00
|
|
|
"Multiboot 2 header tag\n"
|
|
|
|
" type: 1 (information request)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 96\n"
|
2022-01-13 09:55:24 -05:00
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:17:11 -05:00
|
|
|
" type: 2 (address)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 24\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:21:02 -05:00
|
|
|
" type: 3 (entry address)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 12\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:27:55 -05:00
|
|
|
" type: 4 (flags)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 12\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:30:39 -05:00
|
|
|
" type: 5 (framebuffer)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 20\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:32:17 -05:00
|
|
|
" type: 6 (module alignment)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 8\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:33:49 -05:00
|
|
|
" type: 7 (EFI boot services)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 8\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:38:30 -05:00
|
|
|
" type: 8 (EFI i386 entry address)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 12\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
|
|
|
" type: 9 (EFI amd64 entry address)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 12\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 23:46:46 -05:00
|
|
|
" type: 10 (relocatable header)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 24\n"
|
|
|
|
"Multiboot 2 header tag\n"
|
2022-01-13 09:55:24 -05:00
|
|
|
" type: 0 (none)\n"
|
|
|
|
" flags: 0\n"
|
|
|
|
" size: 8\n";
|
2022-01-13 08:50:51 -05:00
|
|
|
|
|
|
|
int main()
|
|
|
|
{
|
|
|
|
{
|
|
|
|
FILE *const fd = popen("tests/multiboot2_header_print1", "r");
|
|
|
|
assert(fd != NULL);
|
|
|
|
|
2022-01-14 01:35:20 -05:00
|
|
|
for (const char *ch = output; *ch; ++ch) {
|
2022-01-13 08:50:51 -05:00
|
|
|
assert(fgetc(fd) == *ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int status = pclose(fd);
|
|
|
|
assert(status == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
{
|
|
|
|
FILE *const fd = popen("tests/multiboot2_header_print2", "r");
|
|
|
|
assert(fd != NULL);
|
|
|
|
|
2022-01-14 01:35:20 -05:00
|
|
|
for (const char *ch = output; *ch; ++ch) {
|
2022-01-13 08:50:51 -05:00
|
|
|
assert(fgetc(fd) == *ch);
|
|
|
|
}
|
|
|
|
|
|
|
|
const int status = pclose(fd);
|
|
|
|
assert(status == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|