| 1 |
/* { dg-do run { target native } } */ |
| 2 |
/* { dg-options "-DMAGNA_CARTA=\"${srcdir}/c-c++-common/cpp/embed-dir/magna-carta.txt\"" } */ |
| 3 |
|
| 4 |
#include <stdio.h> |
| 5 |
#include <string.h> |
| 6 |
#include <stdlib.h> |
| 7 |
|
| 8 |
int |
| 9 |
main (void) |
| 10 |
{ |
| 11 |
static const unsigned char embed_data[] = { |
| 12 |
#embed MAGNA_CARTA |
| 13 |
}; |
| 14 |
char f_data[sizeof (embed_data)]; |
| 15 |
FILE *f_source = fopen (MAGNA_CARTA, "rb"); |
| 16 |
if (f_source == NULL) |
| 17 |
abort (); |
| 18 |
if (fread (f_data, 1, sizeof (embed_data), |
| 19 |
f_source) != sizeof (embed_data)) |
| 20 |
{ |
| 21 |
fclose (f_source); |
| 22 |
abort (); |
| 23 |
} |
| 24 |
fclose (f_source); |
| 25 |
if (memcmp (&embed_data[0], f_data, sizeof (embed_data))) |
| 26 |
abort (); |
| 27 |
} |