win32: wincon.h: support more console mode flags
[tinycc.git] / tests / gcctestsuite.sh
blobb6f9ec213b9ffb7daf099a761d7a1c7190394467
1 #!/bin/sh
3 if [ -z "$TESTSUITE_PATH" ]
4 then
5 if [ -d "$HOME/gcc/gcc-3.2/gcc/testsuite/gcc.c-torture" ]
6 then
7 TESTSUITE_PATH="$HOME/gcc/gcc-3.2/gcc/testsuite/gcc.c-torture"
8 fi
9 fi
11 if [ -z "$TESTSUITE_PATH" ]
12 then
13 echo "gcc testsuite not found."
14 echo "define TESTSUITE_PATH to point to the gcc.c-torture directory"
15 exit 1
18 if [ -z "$TCC_SOURCE_PATH" ]
19 then
20 if [ -f "include/tccdefs.h" ]
21 then
22 TCC_SOURCE_PATH="."
23 elif [ -f "../include/tccdefs.h" ]
24 then
25 TCC_SOURCE_PATH=".."
26 elif [ -f "../tinycc/include/tccdefs.h" ]
27 then
28 TCC_SOURCE_PATH="../tinycc"
32 if [ -z "$RUNTIME_DIR" ]
33 then
34 RUNTIME_DIR=$XDG_RUNTIME_DIR
36 if [ -z "$RUNTIME_DIR" ]
37 then
38 RUNTIME_DIR="/tmp"
41 if [ -z "$CC" ]
42 then
43 if [ -z "$TCC_SOURCE_PATH" ]
44 then
45 echo "tcc not found."
46 echo "define TCC_SOURCE_PATH to point to the tcc source path"
47 exit 1
50 TCC="./tcc -B. -I$TCC_SOURCE_PATH/ -I$TCC_SOURCE_PATH/include -DNO_TRAMPOLINES"
51 else
52 TCC="$CC -O1 -Wno-implicit-int $CFLAGS"
55 rm -f tcc.sum tcc.fail
56 nb_ok="0"
57 nb_skipped="0"
58 nb_failed="0"
59 nb_exe_failed="0"
61 # skip some failed tests not implemented in tcc
62 # builtin: gcc "__builtins_*"
63 # ieee: gcc "__builtins_*" in the ieee directory
64 # complex: C99 "_Complex" and gcc "__complex__"
65 # misc: stdc features, other arch, gcc extensions (example: gnu_inline in c89)
68 old_pwd="`pwd`"
69 cd "$TESTSUITE_PATH"
71 skip_builtin="`grep "_builtin_" compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
72 skip_ieee="`grep "_builtin_" execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f3 | sort -u `"
73 skip_complex="`grep -i "_Complex" compile/*.c execute/*.c execute/ieee/*.c | cut -d ':' -f1 | cut -d '/' -f2 | sort -u `"
74 skip_misc="20000120-2.c mipscop-1.c mipscop-2.c mipscop-3.c mipscop-4.c
75 fp-cmp-4f.c fp-cmp-4l.c fp-cmp-8f.c fp-cmp-8l.c pr38016.c "
77 cd "$old_pwd"
79 for src in $TESTSUITE_PATH/compile/*.c ; do
80 echo $TCC -o $RUNTIME_DIR/tst.o -c $src
81 $TCC -o $RUNTIME_DIR/tst.o -c $src >> tcc.fail 2>&1
82 if [ "$?" = "0" ] ; then
83 result="PASS"
84 nb_ok=$(( $nb_ok + 1 ))
85 else
86 base=`basename "$src"`
87 skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`"
89 if [ -n "$skip_me" ]
90 then
91 result="SKIP"
92 nb_skipped=$(( $nb_skipped + 1 ))
93 else
94 result="FAIL"
95 nb_failed=$(( $nb_failed + 1 ))
98 echo "$result: $src" >> tcc.sum
99 done
101 if [ -f "$RUNTIME_DIR/tst.o" ]
102 then
103 rm -f "$RUNTIME_DIR/tst.o"
106 for src in $TESTSUITE_PATH/execute/*.c $TESTSUITE_PATH/execute/ieee/*.c ; do
107 echo $TCC $src -o $RUNTIME_DIR/tst -lm
108 $TCC $src -o $RUNTIME_DIR/tst -lm >> tcc.fail 2>&1
109 if [ "$?" = "0" ] ; then
110 result="PASS"
111 if $RUNTIME_DIR/tst >> tcc.fail 2>&1
112 then
113 result="PASS"
114 nb_ok=$(( $nb_ok + 1 ))
115 else
116 result="FAILEXE"
117 nb_exe_failed=$(( $nb_exe_failed + 1 ))
119 else
120 base=`basename "$src"`
121 skip_me="`echo $skip_builtin $skip_ieee $skip_complex $skip_misc | grep -w $base`"
123 if [ -n "$skip_me" ]
124 then
125 result="SKIP"
126 nb_skipped=$(( $nb_skipped + 1 ))
127 else
128 result="FAIL"
129 nb_failed=$(( $nb_failed + 1 ))
132 echo "$result: $src" >> tcc.sum
133 done
135 if [ -f "$RUNTIME_DIR/tst.o" ]
136 then
137 rm -f "$RUNTIME_DIR/tst.o"
139 if [ -f "$RUNTIME_DIR/tst" ]
140 then
141 rm -f "$RUNTIME_DIR/tst"
144 echo "$nb_ok test(s) ok." >> tcc.sum
145 echo "$nb_ok test(s) ok."
146 echo "$nb_skipped test(s) skipped." >> tcc.sum
147 echo "$nb_skipped test(s) skipped."
148 echo "$nb_failed test(s) failed." >> tcc.sum
149 echo "$nb_failed test(s) failed."
150 echo "$nb_exe_failed test(s) exe failed." >> tcc.sum
151 echo "$nb_exe_failed test(s) exe failed."