2 # C code generated from "tests"
5 top_builddir
= @top_builddir@
9 # Script that takes a source test suite and generates the iterations
10 GENERATE_CASES
= $(srcdir)/generate-cases.py
11 MAKE_DRV
= $(srcdir)/mkdrv.py
# BUG? use 1 line of sed?
12 TESTS_DIR
= $(srcdir)/..
/tests
13 GTE_TESTS_DIR
= $(srcdir)/..
/gte
14 QC_TESTS_DIR
= $(srcdir)/..
/qct
15 TCC_TESTS_DIR
= $(srcdir)/..
/tcc
23 vpath
%.c.in
$(TESTS_DIR
)
24 vpath
%.c
$(TESTS_DIR
)
26 TPL_TESTS
= $(shell (cd
$(TESTS_DIR
); ls
*.c.in
))
27 C_TESTS
= $(shell (cd
$(TESTS_DIR
); ls
*.c
))
28 M4_TESTS
= $(shell (cd
$(TESTS_DIR
); ls
*.m4
))
29 GTE_TESTS_WC
= $(shell (cd
$(GTE_TESTS_DIR
); ls
*.c
))
30 QC_TESTS_WC
= $(shell (cd
$(QC_TESTS_DIR
); ls
*.c
))
31 TCC_TESTS_WC
= $(shell (cd
$(TCC_TESTS_DIR
); ls
*.c
))
33 # GTE tests using asm (TODO: generate automatically)
34 # these don't seem to work.
97 # uses typeof. typeof was a GCC extension, which became standard in C23. RFE #738.
100 builtin-types-compatible-p.c \
103 # gnu extension (inline varargs, -fgnu89-inline..)
110 # SDCC does not yet support compound literals (RFE #332)
115 # Uses GCC implementation-defined long long bit-fields not supported in SDCC
119 # SDCC does not yet support K&R-style style functions (RFE #450)
131 # __SIZE_TYPE__ something. TODO: retry
146 # Test for GCC implementation-defined bit-field layout
150 # Test for GCC implementation-defined floating-point behaviour
154 # Requires int of at least 32 bits.
164 # Bugs? These fail on stm8.
168 # BUGs? abnormal stop on stm8
173 # timeout on ucsim stm8 (revisit later..)
195 # Test for implementation-defined struct layout
199 # Test for GCC behaviour when library function is locally overwritten
203 # Test for GCC implementation-defined behaviour (GIMPLE memory model)
205 alias-access-path-1.c
448 struct-aliasing-1.c \
458 # too many parameters (various reasons)
480 # too many parameters try #pragma std_c90?
484 # BUG? flexible array 'dims' in otherwise empty struct
485 GTE_SKIP_TESTS
+= 920728-1.c
487 # stm8 only?: bit-field size too wide for type (max 16 bits)
506 # SDCC does not yet support omission of braces in initialization. RFE #562.
514 # Uses GCC extension __builtin_classify_type
518 # sys/types.h unavailable (POSIX, not part of C standard)
529 # __builtin_unreachable
545 # __builtin_add_overflow
561 # # TODO: __builtin_abort
562 # GTE_SKIP_TESTS += \
565 # alias-access-path-1.c
567 # TODO? __builtin_printf
573 builtin-prefetch-1.c \
574 builtin-prefetch-2.c \
575 builtin-prefetch-3.c \
576 builtin-prefetch-4.c \
577 builtin-prefetch-5.c \
581 GTE_SKIP_TESTS
+= pr93249.c
583 # TODO?: __complex__, _Complex
592 GTE_SKIP_TESTS
+= 20020406-1.c
594 # Initializer element is not a constant expression
603 #BUG? incompatible types
608 # BUG? increment in function declaration args
613 # BUG?: preprocessor ellipsis
617 # various __attribute__ (not implemented?)
687 # __builtin_return_address
696 # __builtin_constant_p
705 # BUG? sizeof applied to an incomplete type
709 # use of alloca (not defined? yet?)
718 # error: token "{" is not valid
722 # Needs far too much memory for SDCC targets
728 GTE_TESTS
= $(filter-out $(GTE_SKIP_TESTS
), $(GTE_TESTS_WC
))
733 # some preprocessor testing, needs careful flags.
737 # snprintf is missing
746 # Tests for QuickC implementation-defined behaviour
750 # Takes far too much time for SDCC targets
755 QC_TESTS
= $(filter-out $(QC_SKIP_TESTS
), $(QC_TESTS_WC
))
760 # SDCC does not yet support compound literals (RFE #332)
768 116_bound_setjmp2.c \
771 # SDCC does not yet support long double.
778 100_c99array-decls.c \
781 103_implicit_memmove.c \
791 42_function_pointer.c \
793 76_dollars_in_identifiers.c \
794 82_attribs_position.c \
795 85_asm-outside-function.c \
804 # strdup declaration collision (old standard?)
808 # multiple compilation units
828 # heterogeneous main arguments
833 # cannot assign values to arrays
835 34_array_assignment.c
837 # Initializer element is not a constant expression
844 # Relies on TinyC implementation-defined support for long long bit-fields and integer width of 32 bits.
846 93_integer_promotion.c \
850 # Relies on implicit 0 return by main, but the test framework renames the mainfunction from the test.
856 22_floating_point.c \
859 # ?ASlink-Warning-Undefined Global '_main_' referenced
861 60_errors_and_warnings.c \
864 # SDCC does not yet support omission of braces in initialization. RFE #562.
867 75_array_in_struct_init.c
869 # int f9 (int ((int)), int);
870 # BUG? Syntax error, declaration ignored at ','. Possibly related to bug #3358?
874 # abnormal stop (on all ports but host)
879 # assertion failed (on all ports but host)
883 # Relies on implementation extensions common on GNU/Linux
887 TCC_TESTS
= $(filter-out $(TCC_SKIP_TESTS
), $(TCC_TESTS_WC
))
889 TPL_TEST_STEMS
= $(TPL_TESTS
:%.c.in
=%)
890 QC_TEST_STEMS
= $(QC_TESTS_WC
:%.c
=%)
891 TCC_TEST_STEMS
= $(TCC_TESTS_WC
:%.c
=%)
893 # maybe this is not necessary, just ship the tst_%.c files?
895 C_TEST_SRCS
= $(C_TESTS
:%.c
=tst_
%.c
)
896 M4_TEST_SRCS
= $(M4_TESTS
:%.m4
=m4_
%.c
)
897 GTE_TEST_SRCS
= $(GTE_TESTS
:%.c
=gte_
%.c
)
898 QC_TEST_SRCS
= $(QC_TESTS_WC
:%.c
=qct_
%.c
)
899 TCC_TEST_SRCS
= $(TCC_TESTS_WC
:%.c
=tcc_
%.c
)
901 # Generate .c files from .m4 files
902 # bug/feature? run MAKE_DRV as well (requires magic filenames and paths)
903 m4_
%.c
: $(TESTS_DIR
)/%.m4
905 @
$(M4
) -I
$(srcdir)/..
/m4include rtmacros.m4
$< > $*.m4c
906 @
$(PYTHON
) $(MAKE_DRV
) $*.m4c
$@
909 qct_
%.c
: $(QC_TESTS_DIR
)/%.c Makefile
910 @echo
'#include <testfwk.h>' > $@
911 @echo
'#ifdef __SDCC' >> $@
912 @echo
'#pragma std_sdcc99' >> $@
913 @echo
'#endif // __SDCC' >> $@
914 @echo
'const int __numCases = 1;' >> $@
915 @echo
'__code const char * __getSuiteName(void) { return "qct/$*"; }' >> $@
916 @echo
'#define main main_' >> $@
918 @
#find matching main arguments, none or 2
919 @
#(using printf instead of echo -n for better portability)
920 @printf
'#define MAINARGS' >> $@
921 @
(grep
-q main.
*argv
$< && echo
" 0, 0" || \
922 (grep
-q main.
*argc
$< && echo
" 0" || echo
)) >> $@
923 @echo
'#include "$<"' >> $@
924 @printf
'void __runSuite(void) { __prints("Running main\\n"); ASSERT(!main_(MAINARGS)); }' >> $@
927 tcc_
%.c
: $(TCC_TESTS_DIR
)/%.c Makefile
928 @echo
'#include <testfwk.h>' > $@
929 @echo
'#ifdef __SDCC' >> $@
930 @echo
'#pragma std_sdcc99' >> $@
931 @echo
'#endif // __SDCC' >> $@
932 @echo
'const int __numCases = 1;' >> $@
933 @echo
'__code const char * __getSuiteName(void) { return "tcc/$*"; }' >> $@
934 @echo
'#define main main_' >> $@
936 @
#find matching main arguments, none or 2
937 @printf
'#define MAINARGS' >> $@
938 @
(grep
-q main.
*argv
$< && echo
" 0, 0" || \
939 (grep
-q main.
*argc
$< && echo
" 0" || echo
)) >> $@
941 # non-standard __FUNCTION__
942 @grep
-q __FUNCTION__
$< && echo
"#define __FUNCTION__ __func__" >> $@ ||
:
943 @grep
-q tcc_backtrace
$< && echo
"#define tcc_backtrace printf" >> $@ ||
:
944 @echo
'#include "$<"' >> $@
945 @echo
'#undef abort' >> $@
# yikes, 77_push_pop_macro.c
947 @echo
'#ifdef __SDCC' >> $@
948 @echo
'extern void _putchar(char c);' >> $@
949 @echo
'int putchar(int c){_putchar(c);return(c);}' >> $@
950 @echo
'void abort(void) {ASSERT(0);}' >> $@
953 @printf
'void __runSuite(void) { __prints("Running main\\n"); ASSERT(!main_(MAINARGS)); }' >> $@
956 gte_
%.c
: $(GTE_TESTS_DIR
)/%.c Makefile
958 @echo
'#include <testfwk.h>' > $@
959 @echo
'#ifdef __SDCC' >> $@
960 @echo
'#pragma std_sdcc99' >> $@
962 # stuff defined in gcc, but not in sdcc
963 @grep
-q __CHAR_BIT__
$< && (echo
"#include <limits.h>"; echo
"#define __CHAR_BIT__ CHAR_BIT") >> $@ ||
:
964 @grep
-q __INT_MAX__
$< && (echo
"#include <limits.h>"; echo
"#define __INT_MAX__ INT_MAX") >> $@ ||
:
965 @grep
-q __SIZE_TYPE__
$< && (echo
"#include <stddef.h>" ;echo
"#define __SIZE_TYPE__ size_t") >> $@ ||
:
966 @grep
-q __LONG_LONG_MAX__
$< && (echo
"#include <limits.h>"; echo
"#define __LONG_LONG_MAX__ LLONG_MAX") >> $@ ||
:
967 @grep
-q __INTPTR_TYPE__
$< && echo
"#define __INTPTR_TYPE__ intptr_t" >> $@ ||
:
968 @grep
-q __builtin_abort
$< && echo
"void __builtin_abort(void){ASSERT(0);}" >> $@ ||
:
969 @grep
-q __builtin_unreachable
$< && echo
"void __builtin_unreachable(void){}" >> $@ ||
:
970 @grep
-q __builtin_memset
$< && (echo
"#include <string.h>"; echo
"#define __builtin_memset memset") >> $@ ||
:
972 @echo
'#endif // __SDCC' >> $@
974 # redirect stuff a bit.
975 @grep
-q exit
$< && echo
"#include <setjmp.h>" >> $@ \
976 && echo
"jmp_buf after_main;" >> $@ \
977 && echo
"void exit__substitute(int i){ASSERT(!i); longjmp(after_main, 1);}" >> $@ \
978 && echo
"#define exit exit__substitute" >> $@ ||
:
979 @printf
'#define main main_\n#define assert ASSERT\nvoid abort(void) {ASSERT(0);}\n' >> $@
981 @
#find matching main arguments, none or 2
982 @printf
'#define MAINARGS' >> $@
983 @
(grep
-q main.
*argv
$< && echo
" 0, 0" || \
984 (grep
-q main.
*argc
$< && echo
" 0" || echo
)) >> $@
986 @echo
'#include "$<"' >> $@
987 @printf
'void __runSuite(void) { __prints("Running main\\n");' >> $@
988 @grep
-q exit
$< && echo
'if(!setjmp(after_main))' >> $@ ||
:
989 @printf
'main_(MAINARGS); }\n' >> $@
990 @echo
'const int __numCases = 1;' >> $@
991 @echo
'__code const char * __getSuiteName(void) { return "gte/$*"; }' >> $@
993 # expand tests with python script
994 %/stamp
: %.c.in
$(GENERATE_CASES
)
998 @
$(PYTHON
) $(GENERATE_CASES
) $< $*
1001 tst_
%.c
: %.c
$(MAKE_DRV
)
1003 @
$(PYTHON
) $(MAKE_DRV
) $< $@
1014 MakeList
: $(TPL_TEST_STEMS
:%=%/stamp
) $(TEST_DIRS
) $(TEST_SRCS
) Makefile
1016 @echo populated MakeList...
1017 @echo GTE_TEST_STEMS
= $(GTE_TESTS
:%.c
=gte_
%) > MakeList
1018 @printf
"gce: gcc torture execute.. "
1019 @echo
$(GTE_TESTS
) | wc
-w
1020 @printf
"m4: macro tests.. "
1021 @echo
$(M4_TESTS
) | wc
-w
1022 @printf
"qct: QuickC tests.. "
1023 @echo
$(QC_TEST_STEMS
) | wc
-w
1024 @printf
"tcc: tinycc tests.. "
1025 @echo
$(TCC_TEST_STEMS
) | wc
-w
1027 @printf
"tpl: template tests.. "
1028 @echo
$(TPL_TEST_STEMS
) | wc
-w
1029 @printf
"tst: plain tests.. "
1030 @echo
$(C_TEST_SRCS
) | wc
-w
1032 @echo QC_TEST_STEMS
= $(QC_TESTS
:%.c
=qct_
%) >> MakeList
1033 @echo TCC_TEST_STEMS
= $(TCC_TESTS
:%.c
=tcc_
%) >> MakeList
1034 @echo TPL_TEST_STEMS
= $(TPL_TEST_STEMS
) >> MakeList
1035 @echo C_TEST_STEMS
= $(C_TEST_SRCS
:%.c
=%) >> MakeList
1036 @echo M4_TEST_STEMS
= $(M4_TEST_SRCS
:%.c
=%) >> MakeList
1037 @echo GTE_TEST_STEMS
= $(GTE_TEST_SRCS
:%.c
=%) >> MakeList
1039 @echo TEST_STEMS
= '$$(M4_TEST_STEMS)' >> MakeList
1040 @echo TEST_STEMS
+= '$$(GTE_TEST_STEMS)' >> MakeList
1041 @echo TEST_STEMS
+= '$$(C_TEST_STEMS)' >> MakeList
1042 @echo TEST_STEMS
+= '$$(TPL_TEST_STEMS)' >> MakeList
1043 @echo TEST_STEMS
+= '$$(QC_TEST_STEMS)' >> MakeList
1044 @echo TEST_STEMS
+= '$$(TCC_TEST_STEMS)' >> MakeList
1046 .PHONY
: clean distclean info
1049 rm -f
*/*.c
*/*/stamp
1050 rm -f
*.m4c
*.c
*/stamp
1052 rmdir
* 2> /dev
/null ||
:
1060 @echo TESTS_DIR
$(TESTS_DIR
)
1061 @echo VPATH
$(VPATH
)
1062 @echo TPL_TEST_STEMS
$(TPL_TEST_STEMS
)
1063 @echo C_TEST_SRCS
$(C_TEST_SRCS
)
1064 @echo M4_TESTS
$(M4_TESTS
)
1065 @echo GTE_TESTS
$(GTE_TESTS
)
1067 Makefile
: $(srcdir)/Makefile.in
1068 cd
$(top_builddir
); .
/config.status support
/regression
/cases
/Makefile