annotate lib/swig/swigwin-2.0.11/CCache/test.sh @ 2058:e249bd483311

Merge
author Ritor1
date Sun, 01 Dec 2013 20:14:32 +0600
parents b3009adc0e2f
children
rev   line source
1899
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
1 #!/bin/sh
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
3 # a simple test suite for ccache
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
4 # tridge@samba.org
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
6 if test -n "$CC"; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
7 COMPILER="$CC"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
8 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
9 COMPILER=cc
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
10 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
12 if test -n "$SWIG"; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
13 SWIG="$SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
14 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
15 SWIG=swig
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
16 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
17
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
18 CCACHE=../ccache-swig
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
19 TESTDIR=test.$$
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
20
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
21 test_failed() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
22 reason="$1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
23 echo $1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
24 $CCACHE -s
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
25 cd ..
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
26 rm -rf $TESTDIR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
27 echo TEST FAILED
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
28 exit 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
29 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
30
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
31 randcode() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
32 outfile="$1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
33 nlines=$2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
34 i=0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
35 (
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
36 while [ $i -lt $nlines ]; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
37 echo "int foo$nlines$i(int x) { return x; }"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
38 i=`expr $i + 1`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
39 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
40 ) >> "$outfile"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
41 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
42
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
43 genswigcode() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
44 outfile="$1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
45 nlines=$2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
46 i=0;
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
47 (
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
48 echo "%module swigtest$2;"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
49 while [ $i -lt $nlines ]; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
50 echo "int foo$nlines$i(int x);"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
51 echo "struct Bar$nlines$i { int y; };"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
52 i=`expr $i + 1`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
53 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
54 ) >> "$outfile"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
55 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
56
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
57
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
58 getstat() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
59 stat="$1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
60 value=`$CCACHE -s | grep "$stat" | cut -c34-40`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
61 echo $value
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
62 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
63
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
64 checkstat() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
65 stat="$1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
66 expected_value="$2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
67 value=`getstat "$stat"`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
68 # echo "exp: $expected_value got: $value $testname"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
69 if [ "$expected_value" != "$value" ]; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
70 test_failed "SUITE: $testsuite TEST: $testname - Expected $stat to be $expected_value got $value"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
71 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
72 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
73
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
74
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
75 basetests() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
76 echo "starting testsuite $testsuite"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
77 rm -rf "$CCACHE_DIR"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
78 checkstat 'cache hit' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
79 checkstat 'cache miss' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
80
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
81 j=1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
82 rm -f *.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
83 while [ $j -lt 32 ]; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
84 randcode test$j.c $j
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
85 j=`expr $j + 1`
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
86 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
87
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
88 testname="BASIC"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
89 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
90 checkstat 'cache hit' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
91 checkstat 'cache miss' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
92
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
93 testname="BASIC2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
94 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
95 checkstat 'cache hit' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
96 checkstat 'cache miss' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
97
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
98 testname="debug"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
99 $CCACHE_COMPILE -c test1.c -g
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
100 checkstat 'cache hit' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
101 checkstat 'cache miss' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
102
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
103 testname="debug2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
104 $CCACHE_COMPILE -c test1.c -g
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
105 checkstat 'cache hit' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
106 checkstat 'cache miss' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
107
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
108 testname="output"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
109 $CCACHE_COMPILE -c test1.c -o foo.o
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
110 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
111 checkstat 'cache miss' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
112
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
113 testname="link"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
114 $CCACHE_COMPILE test1.c -o test 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
115 checkstat 'called for link' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
116
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
117 testname="multiple"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
118 $CCACHE_COMPILE -c test1.c test2.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
119 checkstat 'multiple source files' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
120
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
121 testname="find"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
122 $CCACHE blahblah -c test1.c 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
123 checkstat "couldn't find the compiler" 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
124
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
125 testname="bad"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
126 $CCACHE_COMPILE -c test1.c -I 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
127 checkstat 'bad compiler arguments' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
128
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
129 testname="c/c++"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
130 ln -f test1.c test1.ccc
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
131 $CCACHE_COMPILE -c test1.ccc 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
132 checkstat 'not a C/C++ file' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
133
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
134 testname="unsupported"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
135 $CCACHE_COMPILE -M foo -c test1.c > /dev/null 2>&1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
136 checkstat 'unsupported compiler option' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
137
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
138 testname="stdout"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
139 $CCACHE echo foo -c test1.c > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
140 checkstat 'compiler produced stdout' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
141
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
142 testname="non-regular"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
143 mkdir testd
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
144 $CCACHE_COMPILE -o testd -c test1.c > /dev/null 2>&1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
145 rm -rf testd
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
146 checkstat 'output to a non-regular file' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
147
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
148 testname="no-input"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
149 $CCACHE_COMPILE -c -O2 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
150 checkstat 'no input file' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
151
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
152
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
153 testname="CCACHE_DISABLE"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
154 CCACHE_DISABLE=1 $CCACHE_COMPILE -c test1.c 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
155 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
156 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
157 checkstat 'cache hit' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
158
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
159 testname="CCACHE_CPP2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
160 CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
161 checkstat 'cache hit' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
162 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
163
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
164 CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
165 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
166 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
167
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
168 testname="CCACHE_NOSTATS"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
169 CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
170 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
171 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
172
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
173 testname="CCACHE_RECACHE"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
174 CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
175 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
176 checkstat 'cache miss' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
177
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
178 # strictly speaking should be 6 - RECACHE causes a double counting!
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
179 checkstat 'files in cache' 8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
180 $CCACHE -c > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
181 checkstat 'files in cache' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
182
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
183
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
184 testname="CCACHE_HASHDIR"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
185 CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
186 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
187 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
188
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
189 CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
190 checkstat 'cache hit' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
191 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
192
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
193 checkstat 'files in cache' 8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
194
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
195 testname="comments"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
196 echo '/* a silly comment */' > test1-comment.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
197 cat test1.c >> test1-comment.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
198 $CCACHE_COMPILE -c test1-comment.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
199 rm -f test1-comment*
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
200 checkstat 'cache hit' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
201 checkstat 'cache miss' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
202
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
203 testname="CCACHE_UNIFY"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
204 CCACHE_UNIFY=1 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
205 checkstat 'cache hit' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
206 checkstat 'cache miss' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
207 mv test1.c test1-saved.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
208 echo '/* another comment */' > test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
209 cat test1-saved.c >> test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
210 CCACHE_UNIFY=1 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
211 mv test1-saved.c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
212 checkstat 'cache hit' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
213 checkstat 'cache miss' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
214
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
215 testname="cache-size"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
216 for f in *.c; do
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
217 $CCACHE_COMPILE -c $f
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
218 done
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
219 checkstat 'cache hit' 8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
220 checkstat 'cache miss' 37
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
221 checkstat 'files in cache' 72
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
222 $CCACHE -F 48 -c > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
223 if [ `getstat 'files in cache'` -gt 48 ]; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
224 test_failed '-F test failed'
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
225 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
226
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
227 testname="cpp call"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
228 $CCACHE_COMPILE -c test1.c -E > test1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
229 checkstat 'cache hit' 8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
230 checkstat 'cache miss' 37
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
231
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
232 testname="direct .i compile"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
233 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
234 checkstat 'cache hit' 8
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
235 checkstat 'cache miss' 38
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
236
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
237 $CCACHE_COMPILE -c test1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
238 checkstat 'cache hit' 9
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
239 checkstat 'cache miss' 38
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
240
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
241 $CCACHE_COMPILE -c test1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
242 checkstat 'cache hit' 10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
243 checkstat 'cache miss' 38
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
244
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
245 # removed these tests as some compilers (including newer versions of gcc)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
246 # determine which language to use based on .ii/.i extension, and C++ may
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
247 # not be installed
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
248 # testname="direct .ii file"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
249 # mv test1.i test1.ii
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
250 # $CCACHE_COMPILE -c test1.ii
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
251 # checkstat 'cache hit' 10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
252 # checkstat 'cache miss' 39
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
253
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
254 # $CCACHE_COMPILE -c test1.ii
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
255 # checkstat 'cache hit' 11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
256 # checkstat 'cache miss' 39
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
257
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
258 testname="stripc" # This test might not be portable
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
259 CCACHE_STRIPC=1 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
260 checkstat 'cache hit' 10
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
261 checkstat 'cache miss' 39
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
262
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
263 CCACHE_STRIPC=1 $CCACHE_COMPILE -c test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
264 checkstat 'cache hit' 11
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
265 checkstat 'cache miss' 39
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
266
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
267 testname="zero-stats"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
268 $CCACHE -z > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
269 checkstat 'cache hit' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
270 checkstat 'cache miss' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
271
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
272 testname="clear"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
273 $CCACHE -C > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
274 checkstat 'files in cache' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
275
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
276
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
277 rm -f test1.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
278 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
279
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
280 swigtests() {
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
281 echo "starting swig testsuite $testsuite"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
282 rm -rf "$CCACHE_DIR"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
283 checkstat 'cache hit' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
284 checkstat 'cache miss' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
285
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
286 j=1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
287 rm -f *.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
288 genswigcode testswig1.i 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
289
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
290 testname="BASIC"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
291 $CCACHE_COMPILE -java testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
292 checkstat 'cache hit' 0
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
293 checkstat 'cache miss' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
294
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
295 checkstat 'files in cache' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
296
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
297 testname="BASIC2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
298 $CCACHE_COMPILE -java testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
299 checkstat 'cache hit' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
300 checkstat 'cache miss' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
301
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
302 testname="output"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
303 $CCACHE_COMPILE -java testswig1.i -o foo_wrap.c
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
304 checkstat 'cache hit' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
305 checkstat 'cache miss' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
306
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
307 testname="bad"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
308 $CCACHE_COMPILE -java testswig1.i -I 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
309 checkstat 'bad compiler arguments' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
310
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
311 testname="stdout"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
312 $CCACHE_COMPILE -v -java testswig1.i > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
313 checkstat 'compiler produced stdout' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
314
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
315 testname="non-regular"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
316 mkdir testd
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
317 $CCACHE_COMPILE -o testd -java testswig1.i > /dev/null 2>&1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
318 rm -rf testd
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
319 checkstat 'output to a non-regular file' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
320
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
321 testname="no-input"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
322 $CCACHE_COMPILE -java 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
323 checkstat 'no input file' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
324
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
325
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
326 testname="CCACHE_DISABLE"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
327 CCACHE_DISABLE=1 $CCACHE_COMPILE -java testswig1.i 2> /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
328 checkstat 'cache hit' 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
329 $CCACHE_COMPILE -java testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
330 checkstat 'cache hit' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
331
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
332 testname="CCACHE_CPP2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
333 CCACHE_CPP2=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
334 checkstat 'cache hit' 2
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
335 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
336
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
337 CCACHE_CPP2=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
338 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
339 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
340
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
341 testname="CCACHE_NOSTATS"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
342 CCACHE_NOSTATS=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
343 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
344 checkstat 'cache miss' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
345
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
346 testname="CCACHE_RECACHE"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
347 CCACHE_RECACHE=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
348 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
349 checkstat 'cache miss' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
350
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
351 # strictly speaking should be 3x6=18 instead of 4x6=24 - RECACHE causes a double counting!
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
352 checkstat 'files in cache' 24
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
353 $CCACHE -c > /dev/null
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
354 checkstat 'files in cache' 18
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
355
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
356
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
357 testname="CCACHE_HASHDIR"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
358 CCACHE_HASHDIR=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
359 checkstat 'cache hit' 3
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
360 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
361
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
362 CCACHE_HASHDIR=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
363 checkstat 'cache hit' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
364 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
365
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
366 checkstat 'files in cache' 24
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
367
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
368 testname="cpp call"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
369 $CCACHE_COMPILE -java -E testswig1.i > testswig1-preproc.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
370 checkstat 'cache hit' 4
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
371 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
372
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
373 testname="direct .i compile"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
374 $CCACHE_COMPILE -java testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
375 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
376 checkstat 'cache miss' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
377
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
378 # No cache hit due to different input file name, -nopreprocess should not be given twice to SWIG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
379 $CCACHE_COMPILE -java -nopreprocess testswig1-preproc.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
380 checkstat 'cache hit' 5
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
381 checkstat 'cache miss' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
382
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
383 $CCACHE_COMPILE -java -nopreprocess testswig1-preproc.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
384 checkstat 'cache hit' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
385 checkstat 'cache miss' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
386
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
387 testname="stripc"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
388 CCACHE_STRIPC=1 $CCACHE_COMPILE -java -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
389 checkstat 'cache hit' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
390 checkstat 'cache miss' 6
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
391
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
392 CCACHE_STRIPC=1 $CCACHE_COMPILE -java -O -O -O testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
393 checkstat 'cache hit' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
394 checkstat 'cache miss' 7
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
395
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
396 rm -f testswig1-preproc.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
397 rm -f testswig1.i
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
398 }
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
399
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
400 ######
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
401 # main program
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
402 rm -rf $TESTDIR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
403 mkdir $TESTDIR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
404 cd $TESTDIR || exit 1
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
405 CCACHE_DIR="ccache dir" # with space in directory name (like Windows default)
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
406 mkdir "$CCACHE_DIR"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
407 export CCACHE_DIR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
408
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
409 testsuite="base"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
410 CCACHE_COMPILE="$CCACHE $COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
411 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
412 CCACHE_COMPILE="$CCACHE $SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
413 swigtests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
414
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
415 if test -z "$NOSOFTLINKSTEST"; then
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
416 testsuite="link"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
417 ln -s $CCACHE $COMPILER
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
418 CCACHE_COMPILE="./$COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
419 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
420 rm "./$COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
421 ln -s $CCACHE $SWIG
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
422 CCACHE_COMPILE="./$SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
423 swigtests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
424 rm "./$SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
425 else
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
426 echo "skipping testsuite link"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
427 fi
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
428
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
429 testsuite="hardlink"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
430 CCACHE_COMPILE="env CCACHE_NOCOMPRESS=1 CCACHE_HARDLINK=1 $CCACHE $COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
431 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
432 CCACHE_COMPILE="env CCACHE_NOCOMPRESS=1 CCACHE_HARDLINK=1 $CCACHE $SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
433 swigtests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
434
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
435 testsuite="cpp2"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
436 CCACHE_COMPILE="env CCACHE_CPP2=1 $CCACHE $COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
437 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
438 CCACHE_COMPILE="env CCACHE_CPP2=1 $CCACHE $SWIG"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
439 swigtests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
440
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
441 testsuite="nlevels4"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
442 CCACHE_COMPILE="env CCACHE_NLEVELS=4 $CCACHE $COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
443 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
444
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
445 testsuite="nlevels1"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
446 CCACHE_COMPILE="env CCACHE_NLEVELS=1 $CCACHE $COMPILER"
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
447 basetests
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
448
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
449 cd ..
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
450 rm -rf $TESTDIR
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
451 echo test done - OK
b3009adc0e2f Adding swig, gitignore, hgignore
Nomad
parents:
diff changeset
452 exit 0