1 # This harness is for testing builtin support. Each test has two files:
3 # - foo.c defines the main testing function, main_test().
4 # - foo-lib.c implements the library functions that foo.c is testing.
6 # The functions in foo-lib.c will often want to abort on certain inputs.
7 # They can use the global variable inside_main to see whether they are
8 # being called from the test program or part of the common runtime.
10 # In many cases, the library functions will behave as normal at -O0
11 # and abort when optimisation is enabled. Such implementations should
12 # go into the lib/ directory so that they can be included by any test
13 # that needs them. They shouldn't call any external functions in case
14 # those functions were overridden too.
16 load_lib torture-options.exp
17 load_lib c-torture.exp
20 set-torture-options $C_TORTURE_OPTIONS
22 set additional_flags ""
23 if [istarget "powerpc-*-darwin*"] {
24 lappend additional_flags "-Wl,-multiply_defined,suppress"
27 foreach src [lsort [find $srcdir/$subdir *.c]] {
28 if {![string match *-lib.c $src] && [runtest_file_p $runtests $src]} {
29 c-torture-execute [list $src \
30 [file root $src]-lib.c \
31 $srcdir/$subdir/lib/main.c] \