From bcfd86c8a85be09f8aea88c85f8cab6d1793afaa Mon Sep 17 00:00:00 2001 From: Virgile Prevosto <virgile.prevosto@m4x.org> Date: Wed, 22 Feb 2023 15:08:16 +0100 Subject: [PATCH] [tests] update custom machdep test and test json loading --- tests/misc/custom_machdep.c | 3 ++ tests/misc/custom_machdep.json | 32 +++++++++++++++++++ tests/misc/custom_machdep.ml | 2 -- ...res.oracle => custom_machdep.0.res.oracle} | 0 tests/misc/oracle/custom_machdep.1.res.oracle | 26 +++++++++++++++ 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 tests/misc/custom_machdep.json rename tests/misc/oracle/{custom_machdep.res.oracle => custom_machdep.0.res.oracle} (100%) create mode 100644 tests/misc/oracle/custom_machdep.1.res.oracle diff --git a/tests/misc/custom_machdep.c b/tests/misc/custom_machdep.c index c51544e41f4..b28d8660679 100644 --- a/tests/misc/custom_machdep.c +++ b/tests/misc/custom_machdep.c @@ -4,6 +4,9 @@ DEPS: @PTEST_NAME@/__fc_machdep_custom.h OPT: -cpp-extra-args="-I./@PTEST_NAME@ -D__FC_MACHDEP_CUSTOM" -machdep custom -print -then -print COMMENT: we need a -then to test double registering of a machdep + EXIT: 0 + DEPS: @PTEST_NAME@/__fc_machdep_custom.h + OPT: -cpp-extra-args="-I./@PTEST_NAME@ -D__FC_MACHDEP_CUSTOM" -machdep %{dep:@PTEST_DIR@/@PTEST_NAME@.json} -print */ #include "__fc_machdep_custom.h" // most of the following includes are not directly used, but they test if diff --git a/tests/misc/custom_machdep.json b/tests/misc/custom_machdep.json new file mode 100644 index 00000000000..0761e8060ae --- /dev/null +++ b/tests/misc/custom_machdep.json @@ -0,0 +1,32 @@ + { + "version": "foo", + "compiler": "bar", + "cpp_arch_flags" : [], + "sizeof_short" : 2, + "sizeof_int": 3, + "sizeof_long": 4, + "sizeof_longlong" : 8, + "sizeof_ptr" : 4, + "sizeof_float": 4, + "sizeof_double": 8, + "sizeof_longdouble": 12, + "sizeof_void": 1, + "sizeof_fun" : 1, + "size_t" : "unsigned long", + "wchar_t" : "int", + "ptrdiff_t": "int", + "alignof_short" : 2, + "alignof_int": 3, + "alignof_long": 4, + "alignof_longlong": 4, + "alignof_ptr" : 4, + "alignof_float": 4, + "alignof_double": 4, + "alignof_longdouble": 4, + "alignof_str": 1, + "alignof_fun": 1, + "alignof_aligned": 16, + "char_is_unsigned": false, + "little_endian": true, + "has__builtin_va_list": true + } diff --git a/tests/misc/custom_machdep.ml b/tests/misc/custom_machdep.ml index 503611ae1fe..e7a740d59b4 100644 --- a/tests/misc/custom_machdep.ml +++ b/tests/misc/custom_machdep.ml @@ -30,9 +30,7 @@ let mach = alignof_fun = 1; alignof_aligned= 16; char_is_unsigned = false; - const_string_literals = true; little_endian = true; - underscore_name = false ; has__builtin_va_list = true; } diff --git a/tests/misc/oracle/custom_machdep.res.oracle b/tests/misc/oracle/custom_machdep.0.res.oracle similarity index 100% rename from tests/misc/oracle/custom_machdep.res.oracle rename to tests/misc/oracle/custom_machdep.0.res.oracle diff --git a/tests/misc/oracle/custom_machdep.1.res.oracle b/tests/misc/oracle/custom_machdep.1.res.oracle new file mode 100644 index 00000000000..10262698fca --- /dev/null +++ b/tests/misc/oracle/custom_machdep.1.res.oracle @@ -0,0 +1,26 @@ +[kernel] Registering machdep 'mach' as 'custom' +[kernel] Parsing custom_machdep.c (with preprocessing) +/* Generated by Frama-C */ +#include "ctype.h" +#include "errno.h" +#include "inttypes.h" +#include "locale.h" +#include "math.h" +#include "signal.h" +#include "stdarg.h" +#include "stddef.h" +#include "stdint.h" +#include "stdio.h" +#include "stdlib.h" +#include "string.h" +#include "strings.h" +#include "time.h" +#include "wchar.h" +int main(void) +{ + int __retres; + __retres = (int)2147483647; + return __retres; +} + + -- GitLab