2021-12-12 15:30:27 -05:00
|
|
|
#ifdef HAVE_CONFIG_H
|
|
|
|
#include "config.h"
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#include <kernaux/elf.h>
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <stddef.h>
|
2022-01-11 01:26:33 -05:00
|
|
|
#include <stdint.h>
|
2021-12-12 15:30:27 -05:00
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#define BUFFER_SIZE (1024 * 1024)
|
|
|
|
|
2022-06-20 14:01:56 -04:00
|
|
|
void test_main(int argc, char **argv)
|
2021-12-12 15:30:27 -05:00
|
|
|
{
|
|
|
|
assert(argc >= 1);
|
|
|
|
|
|
|
|
FILE *const fd = fopen(argv[0], "r");
|
|
|
|
assert(fd);
|
|
|
|
|
2022-01-11 01:26:33 -05:00
|
|
|
uint8_t buffer[BUFFER_SIZE];
|
|
|
|
const size_t size = fread(buffer, sizeof(uint8_t), BUFFER_SIZE, fd);
|
2021-12-12 15:30:27 -05:00
|
|
|
assert(size > 0);
|
|
|
|
|
2021-12-14 14:13:18 -05:00
|
|
|
assert(KernAux_ELF_Header_is_valid((struct KernAux_ELF_Header*)buffer));
|
2021-12-12 15:30:27 -05:00
|
|
|
|
|
|
|
fclose(fd);
|
|
|
|
}
|