~ubuntu-branches/debian/sid/ccache/sid

« back to all changes in this revision

Viewing changes to test.sh

  • Committer: Package Import Robot
  • Author(s): Joel Rosdahl
  • Date: 2015-05-10 15:00:50 UTC
  • mfrom: (1.2.11)
  • Revision ID: package-import@ubuntu.com-20150510150050-4f41s2uddl17ryuc
Tags: 3.2.2-1
* New upstream release 3.2.2 (closes: #248892, #778388)
* Update debian/copyright to match ccache 3.2.2
* Create symlinks for clang variants in /usr/lib/ccache (closes: #624589)
* Switch package maintainer to Joel Rosdahl

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
# A simple test suite for ccache.
4
4
#
5
5
# Copyright (C) 2002-2007 Andrew Tridgell
6
 
# Copyright (C) 2009-2014 Joel Rosdahl
 
6
# Copyright (C) 2009-2015 Joel Rosdahl
7
7
#
8
8
# This program is free software; you can redistribute it and/or modify it under
9
9
# the terms of the GNU General Public License as published by the Free Software
37
37
unset CCACHE_PATH
38
38
unset CCACHE_PREFIX
39
39
unset CCACHE_READONLY
 
40
unset CCACHE_READONLY_DIRECT
40
41
unset CCACHE_RECACHE
41
42
unset CCACHE_SLOPPINESS
42
43
unset CCACHE_TEMPDIR
43
44
unset CCACHE_UMASK
44
45
unset CCACHE_UNIFY
 
46
unset GCC_COLORS
 
47
 
 
48
# Many tests backdate files, which updates their ctimes.  In those tests, we
 
49
# must ignore ctimes.  Might as well do so everywhere.
 
50
default_sloppiness=include_file_ctime
 
51
CCACHE_SLOPPINESS="$default_sloppiness"
 
52
export CCACHE_SLOPPINESS
45
53
 
46
54
test_failed() {
47
55
    echo "SUITE: \"$testsuite\", TEST: \"$testname\" - $1"
64
72
    ) >> "$outfile"
65
73
}
66
74
 
67
 
 
68
75
getstat() {
69
76
    stat="$1"
70
 
    value=`$CCACHE -s | grep "$stat" | cut -c34-40`
 
77
    value=`$CCACHE -s | grep "$stat" | cut -c34-`
71
78
    echo $value
72
79
}
73
80
 
80
87
    fi
81
88
}
82
89
 
 
90
compare_file() {
 
91
    cmp -s "$1" "$2"
 
92
    if [ $? -ne 0 ]; then
 
93
        test_failed "Files differ: $1 != $2"
 
94
    fi
 
95
}
 
96
 
83
97
checkfile() {
84
98
    if [ ! -f $1 ]; then
85
99
        test_failed "$1 not found"
140
154
        j=`expr $j + 1`
141
155
    done
142
156
 
 
157
    CCACHE_DISABLE=1 $COMPILER -c -o reference_test1.o test1.c
 
158
 
143
159
    testname="BASIC"
144
160
    $CCACHE_COMPILE -c test1.c
145
161
    checkstat 'cache hit (preprocessed)' 0
146
162
    checkstat 'cache miss' 1
147
163
    checkstat 'files in cache' 1
 
164
    compare_file reference_test1.o test1.o
148
165
 
149
166
    testname="BASIC2"
150
167
    $CCACHE_COMPILE -c test1.c
151
168
    checkstat 'cache hit (preprocessed)' 1
152
169
    checkstat 'cache miss' 1
153
170
    checkstat 'files in cache' 1
 
171
    compare_file reference_test1.o test1.o
154
172
 
155
173
    testname="debug"
156
174
    $CCACHE_COMPILE -c test1.c -g
167
185
    $CCACHE_COMPILE -c test1.c -o foo.o
168
186
    checkstat 'cache hit (preprocessed)' 3
169
187
    checkstat 'cache miss' 2
 
188
    compare_file reference_test1.o foo.o
170
189
 
171
190
    testname="link"
172
191
    $CCACHE_COMPILE test1.c -o test 2> /dev/null
208
227
    testname="non-regular"
209
228
    mkdir testd
210
229
    $CCACHE_COMPILE -o testd -c test1.c > /dev/null 2>&1
211
 
    rmdir testd
 
230
    rmdir testd > /dev/null 2>&1
212
231
    checkstat 'output to a non-regular file' 1
213
232
 
214
233
    testname="no-input"
217
236
 
218
237
    testname="CCACHE_DISABLE"
219
238
    mv $CCACHE_DIR $CCACHE_DIR.saved
 
239
    saved_config_path=$CCACHE_CONFIGPATH
 
240
    unset CCACHE_CONFIGPATH
220
241
    CCACHE_DISABLE=1 $CCACHE_COMPILE -c test1.c 2> /dev/null
221
242
    if [ -d $CCACHE_DIR ]; then
222
 
        test_failed "$CCACHE_DIR created dispite CCACHE_DISABLE being set"
 
243
        test_failed "$CCACHE_DIR created despite CCACHE_DISABLE being set"
223
244
    fi
 
245
    CCACHE_CONFIGPATH=$saved_config_path
224
246
    mv $CCACHE_DIR.saved $CCACHE_DIR
225
247
    checkstat 'cache hit (preprocessed)' 3
226
248
    $CCACHE_COMPILE -c test1.c
230
252
    CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O
231
253
    checkstat 'cache hit (preprocessed)' 4
232
254
    checkstat 'cache miss' 3
 
255
    CCACHE_DISABLE=1 $COMPILER -c test1.c -o reference_test1.o -O -O
 
256
    compare_file reference_test1.o test1.o
233
257
 
234
258
    CCACHE_CPP2=1 $CCACHE_COMPILE -c test1.c -O -O
235
259
    checkstat 'cache hit (preprocessed)' 5
236
260
    checkstat 'cache miss' 3
 
261
    compare_file reference_test1.o test1.o
237
262
 
238
263
    testname="CCACHE_NOSTATS"
239
264
    CCACHE_NOSTATS=1 $CCACHE_COMPILE -c test1.c -O -O
244
269
    CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c -O -O
245
270
    checkstat 'cache hit (preprocessed)' 5
246
271
    checkstat 'cache miss' 4
 
272
    compare_file reference_test1.o test1.o
247
273
 
248
 
    # strictly speaking should be 3 - RECACHE causes a double counting!
 
274
    # strictly speaking should be 4 - RECACHE causes a double counting!
249
275
    checkstat 'files in cache' 4
250
276
    $CCACHE -c > /dev/null
251
 
    checkstat 'files in cache' 3
 
277
    checkstat 'files in cache' 4
252
278
 
253
279
    testname="CCACHE_HASHDIR"
254
280
    CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
255
281
    checkstat 'cache hit (preprocessed)' 5
256
282
    checkstat 'cache miss' 5
 
283
    compare_file reference_test1.o test1.o
257
284
 
258
285
    CCACHE_HASHDIR=1 $CCACHE_COMPILE -c test1.c -O -O
259
286
    checkstat 'cache hit (preprocessed)' 6
260
287
    checkstat 'cache miss' 5
261
 
    checkstat 'files in cache' 4
 
288
    checkstat 'files in cache' 5
 
289
    compare_file reference_test1.o test1.o
262
290
 
263
291
    testname="comments"
264
292
    echo '/* a silly comment */' > test1-comment.c
279
307
    mv test1-saved.c test1.c
280
308
    checkstat 'cache hit (preprocessed)' 7
281
309
    checkstat 'cache miss' 7
 
310
    CCACHE_DISABLE=1 $COMPILER -c test1.c -o reference_test1.o
 
311
    compare_file reference_test1.o test1.o
282
312
 
283
313
    testname="cache-size"
284
314
    for f in *.c; do
286
316
    done
287
317
    checkstat 'cache hit (preprocessed)' 8
288
318
    checkstat 'cache miss' 37
289
 
    checkstat 'files in cache' 36
 
319
    checkstat 'files in cache' 37
290
320
 
291
321
    $CCACHE -C >/dev/null
292
322
 
344
374
            CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
345
375
            checkstat 'cache hit (preprocessed)' 14
346
376
            checkstat 'cache miss' 40
347
 
            $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
 
377
            CCACHE_CPP2=1 $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
348
378
            checkstat 'cache hit (preprocessed)' 15
349
379
            checkstat 'cache miss' 40
 
380
            $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
 
381
            checkstat 'cache hit (preprocessed)' 15
 
382
            checkstat 'cache miss' 41
 
383
            $CCACHE_COMPILE -c -finput-charset=latin1 latin1.c
 
384
            checkstat 'cache hit (preprocessed)' 16
 
385
            checkstat 'cache miss' 41
350
386
        fi
351
387
    fi
352
388
 
 
389
    testname="override path"
 
390
    $CCACHE -Cz >/dev/null
 
391
    override_path=`pwd`/override_path
 
392
    rm -rf $override_path
 
393
    mkdir $override_path
 
394
    cat >$override_path/cc <<EOF
 
395
#!/bin/sh
 
396
touch override_path_compiler_executed
 
397
EOF
 
398
    chmod +x $override_path/cc
 
399
    CCACHE_PATH=$override_path $CCACHE cc -c test1.c
 
400
    if [ ! -f override_path_compiler_executed ]; then
 
401
        test_failed "CCACHE_PATH had no effect"
 
402
    fi
 
403
 
353
404
    testname="compilercheck=mtime"
354
405
    $CCACHE -Cz >/dev/null
355
406
    cat >compiler.sh <<EOF
404
455
    checkstat 'cache hit (preprocessed)' 2
405
456
    checkstat 'cache miss' 1
406
457
 
 
458
    testname="compilercheck=string"
 
459
    $CCACHE -z >/dev/null
 
460
    backdate compiler.sh
 
461
    CCACHE_COMPILERCHECK=string:foo $CCACHE ./compiler.sh -c test1.c
 
462
    checkstat 'cache hit (preprocessed)' 0
 
463
    checkstat 'cache miss' 1
 
464
    CCACHE_COMPILERCHECK=string:foo $CCACHE ./compiler.sh -c test1.c
 
465
    checkstat 'cache hit (preprocessed)' 1
 
466
    checkstat 'cache miss' 1
 
467
    CCACHE_COMPILERCHECK=string:bar $CCACHE ./compiler.sh -c test1.c
 
468
    checkstat 'cache hit (preprocessed)' 1
 
469
    checkstat 'cache miss' 2
 
470
    CCACHE_COMPILERCHECK=string:bar $CCACHE ./compiler.sh -c test1.c
 
471
    checkstat 'cache hit (preprocessed)' 2
 
472
    checkstat 'cache miss' 2
 
473
 
407
474
    testname="compilercheck=command"
408
475
    $CCACHE -z >/dev/null
409
476
    backdate compiler.sh
436
503
    fi
437
504
    checkstat 'compiler check failed' 1
438
505
 
 
506
    testname="recache should remove previous .stderr"
 
507
    $CCACHE -Cz >/dev/null
 
508
    $CCACHE_COMPILE -c test1.c
 
509
    checkstat 'cache hit (preprocessed)' 0
 
510
    checkstat 'cache miss' 1
 
511
    num=`find $CCACHE_DIR -name '*.stderr' | wc -l`
 
512
    if [ $num -ne 0 ]; then
 
513
        test_failed "$num stderr files found, expected 0 (#1)"
 
514
    fi
 
515
    obj_file=`find $CCACHE_DIR -name '*.o'`
 
516
    stderr_file=`echo $obj_file | sed 's/..$/.stderr/'`
 
517
    echo "Warning: foo" >$stderr_file
 
518
    CCACHE_RECACHE=1 $CCACHE_COMPILE -c test1.c
 
519
    num=`find $CCACHE_DIR -name '*.stderr' | wc -l`
 
520
    if [ $num -ne 0 ]; then
 
521
        test_failed "$num stderr files found, expected 0 (#2)"
 
522
    fi
 
523
 
439
524
    testname="no object file"
 
525
    $CCACHE -Cz >/dev/null
440
526
    cat <<'EOF' >test_no_obj.c
441
527
int test_no_obj;
442
528
EOF
492
578
    $CCACHE -C > /dev/null
493
579
    checkstat 'files in cache' 0
494
580
 
 
581
    # the profile options do not seem to work correctly with clang or gcc-llvm
 
582
    # on darwin machines
 
583
    darwin_llvm=0
 
584
    if [ $HOST_OS_APPLE -eq 1 ] && [ $COMPILER_USES_LLVM -eq 1 ]; then
 
585
        darwin_llvm=1
 
586
    fi
 
587
 
 
588
    $COMPILER -c -fprofile-generate test1.c 2>/dev/null
 
589
    if [ $? -eq 0 ] && [ $darwin_llvm -eq 0 ]; then
 
590
        testname="profile-generate"
 
591
        $CCACHE -Cz > /dev/null
 
592
        $CCACHE_COMPILE -c -fprofile-generate test1.c
 
593
        checkstat 'cache hit (preprocessed)' 0
 
594
        checkstat 'cache miss' 1
 
595
        checkstat 'files in cache' 1
 
596
        $CCACHE_COMPILE -c -fprofile-generate test1.c
 
597
        checkstat 'cache hit (preprocessed)' 1
 
598
        checkstat 'cache miss' 1
 
599
        checkstat 'files in cache' 1
 
600
 
 
601
        testname="profile-arcs"
 
602
        $CCACHE_COMPILE -c -fprofile-arcs test1.c
 
603
        checkstat 'cache hit (preprocessed)' 1
 
604
        checkstat 'cache miss' 2
 
605
        checkstat 'files in cache' 2
 
606
        $CCACHE_COMPILE -c -fprofile-arcs test1.c
 
607
        checkstat 'cache hit (preprocessed)' 2
 
608
        checkstat 'cache miss' 2
 
609
        checkstat 'files in cache' 2
 
610
 
 
611
        testname="profile-use"
 
612
        $CCACHE_COMPILE -c -fprofile-use test1.c 2>/dev/null
 
613
        checkstat 'cache hit (preprocessed)' 2
 
614
        checkstat 'cache miss' 3
 
615
        $CCACHE_COMPILE -c -fprofile-use test1.c 2>/dev/null
 
616
        checkstat 'cache hit (preprocessed)' 3
 
617
        checkstat 'cache miss' 3
 
618
    fi
 
619
 
 
620
    ##################################################################
 
621
    # Check that -Wp,-P disables ccache. (-P removes preprocessor information
 
622
    # in such a way that the object file from compiling the preprocessed file
 
623
    # will not be equal to the object file produced when compiling without
 
624
    # ccache.)
 
625
    testname="-Wp,-P"
 
626
    $CCACHE -Cz >/dev/null
 
627
    $CCACHE_COMPILE -c -Wp,-P test1.c
 
628
    checkstat 'cache hit (direct)' 0
 
629
    checkstat 'cache hit (preprocessed)' 0
 
630
    checkstat 'cache miss' 0
 
631
    checkstat 'unsupported compiler option' 1
 
632
    $CCACHE_COMPILE -c -Wp,-P test1.c
 
633
    checkstat 'cache hit (direct)' 0
 
634
    checkstat 'cache hit (preprocessed)' 0
 
635
    checkstat 'cache miss' 0
 
636
    checkstat 'unsupported compiler option' 2
 
637
    $CCACHE_COMPILE -c -Wp,-DFOO,-P,-DGOO test1.c
 
638
    checkstat 'cache hit (direct)' 0
 
639
    checkstat 'cache hit (preprocessed)' 0
 
640
    checkstat 'cache miss' 0
 
641
    checkstat 'unsupported compiler option' 3
 
642
    $CCACHE_COMPILE -c -Wp,-DFOO,-P,-DGOO test1.c
 
643
    checkstat 'cache hit (direct)' 0
 
644
    checkstat 'cache hit (preprocessed)' 0
 
645
    checkstat 'cache miss' 0
 
646
    checkstat 'unsupported compiler option' 4
 
647
 
 
648
    ##################################################################
 
649
 
 
650
    if [ $COMPILER_TYPE_CLANG -eq 1 ]; then
 
651
        testname="serialize-diagnostics"
 
652
        $CCACHE -Cz > /dev/null
 
653
        $COMPILER -c --serialize-diagnostics expected.dia test1.c 2> /dev/null
 
654
        # Run with CCACHE_CPP2 to ensure the same diagnostics output as above
 
655
        CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c 2> /dev/null
 
656
        checkstat 'cache hit (preprocessed)' 0
 
657
        checkstat 'cache miss' 1
 
658
        checkstat 'files in cache' 2
 
659
        compare_file expected.dia test.dia
 
660
        rm -f test.dia
 
661
        CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia test1.c 2> /dev/null
 
662
        checkstat 'cache hit (preprocessed)' 1
 
663
        checkstat 'cache miss' 1
 
664
        checkstat 'files in cache' 2
 
665
        compare_file expected.dia test.dia
 
666
 
 
667
        rm -f test.dia
 
668
        rm -f expected.dia
 
669
 
 
670
        testname="serialize-diagnostics-compile-failed"
 
671
        $CCACHE -Cz > /dev/null
 
672
        echo "bad source" >error.c
 
673
        $COMPILER -c --serialize-diagnostics expected.dia error.c 2> /dev/null
 
674
        if [ $? -eq 0 ]; then
 
675
            test_failed "expected an error compiling error.c"
 
676
        fi
 
677
        CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia error.c 2> /dev/null
 
678
        checkstat 'compile failed' 1
 
679
        checkstat 'cache hit (preprocessed)' 0
 
680
        checkstat 'cache miss' 0
 
681
        checkstat 'files in cache' 0
 
682
        compare_file expected.dia test.dia
 
683
        rm -f test.dia
 
684
        CCACHE_CPP2=1 $CCACHE_COMPILE -c --serialize-diagnostics test.dia error.c 2> /dev/null
 
685
        checkstat 'compile failed' 2
 
686
        checkstat 'cache hit (preprocessed)' 0
 
687
        checkstat 'cache miss' 0
 
688
        checkstat 'files in cache' 0
 
689
        compare_file expected.dia test.dia
 
690
    fi
 
691
 
 
692
    ##################################################################
 
693
 
495
694
    rm -f test1.c
496
695
}
497
696
 
505
704
        ln -s "$CCACHE" $COMPILER
506
705
        CCACHE_COMPILE="./$COMPILER"
507
706
        base_tests
 
707
        rm -f $COMPILER
508
708
    else
509
709
        echo "Compiler ($COMPILER) not taken from PATH -- not running link test"
510
710
    fi
514
714
    CCACHE_COMPILE="$CCACHE $COMPILER"
515
715
    CCACHE_HARDLINK=1
516
716
    export CCACHE_HARDLINK
517
 
    CCACHE_NOCOMPRESS=1
518
 
    export CCACHE_NOCOMPRESS
519
717
    base_tests
520
718
    unset CCACHE_HARDLINK
521
 
    unset CCACHE_NOCOMPRESS
522
719
}
523
720
 
524
721
cpp2_suite() {
565
762
    cat <<EOF >test3.h
566
763
int test3;
567
764
EOF
 
765
    cat <<EOF >code.c
 
766
/* code.c */
 
767
int test() {}
 
768
EOF
568
769
    backdate test1.h test2.h test3.h
569
770
 
570
771
    $COMPILER -c -Wp,-MD,expected.d test.c
689
890
    checkstat 'cache hit (preprocessed)' 0
690
891
    checkstat 'cache miss' 1
691
892
    checkfile other.d "$expected_d_content"
 
893
    CCACHE_DISABLE=1 $COMPILER -c -Wp,-MD,other.d test.c -o reference_test.o
 
894
    compare_file reference_test.o test.o
692
895
 
693
896
    rm -f other.d
694
897
 
697
900
    checkstat 'cache hit (preprocessed)' 0
698
901
    checkstat 'cache miss' 1
699
902
    checkfile other.d "$expected_d_content"
 
903
    compare_file reference_test.o test.o
700
904
 
701
905
    rm -f other.d
702
906
 
 
907
    $CCACHE $COMPILER -c -Wp,-MD,different_name.d test.c
 
908
    checkstat 'cache hit (direct)' 2
 
909
    checkstat 'cache hit (preprocessed)' 0
 
910
    checkstat 'cache miss' 1
 
911
    checkfile different_name.d "$expected_d_content"
 
912
    compare_file reference_test.o test.o
 
913
 
 
914
    rm -f different_name.d
 
915
 
703
916
    ##################################################################
704
917
    # Check that -Wp,-MMD,file.d works.
705
918
    testname="-Wp,-MMD"
710
923
    checkstat 'cache hit (preprocessed)' 0
711
924
    checkstat 'cache miss' 1
712
925
    checkfile other.d "$expected_mmd_d_content"
 
926
    CCACHE_DISABLE=1 $COMPILER -c -Wp,-MMD,other.d test.c -o reference_test.o
 
927
    compare_file reference_test.o test.o
713
928
 
714
929
    rm -f other.d
715
930
 
718
933
    checkstat 'cache hit (preprocessed)' 0
719
934
    checkstat 'cache miss' 1
720
935
    checkfile other.d "$expected_mmd_d_content"
 
936
    compare_file reference_test.o test.o
721
937
 
722
938
    rm -f other.d
723
939
 
724
 
    ##################################################################
725
 
    # Check that -Wp,-MD,file.d,-P disables direct mode.
726
 
    testname="-Wp,-MD,file.d,-P"
727
 
    $CCACHE -z >/dev/null
728
 
    $CCACHE $COMPILER -c -Wp,-MD,$DEVNULL,-P test.c
729
 
    checkstat 'cache hit (direct)' 0
730
 
    checkstat 'cache hit (preprocessed)' 0
731
 
    checkstat 'cache miss' 1
732
 
 
733
 
    $CCACHE $COMPILER -c -Wp,-MD,$DEVNULL,-P test.c
734
 
    checkstat 'cache hit (direct)' 0
735
 
    checkstat 'cache hit (preprocessed)' 1
736
 
    checkstat 'cache miss' 1
737
 
 
738
 
    ##################################################################
739
 
    # Check that -Wp,-MMD,file.d,-P disables direct mode.
740
 
    testname="-Wp,-MDD,file.d,-P"
741
 
    $CCACHE -z >/dev/null
742
 
    $CCACHE $COMPILER -c -Wp,-MMD,$DEVNULL,-P test.c
743
 
    checkstat 'cache hit (direct)' 0
744
 
    checkstat 'cache hit (preprocessed)' 0
745
 
    checkstat 'cache miss' 1
746
 
 
747
 
    $CCACHE $COMPILER -c -Wp,-MMD,$DEVNULL,-P test.c
748
 
    checkstat 'cache hit (direct)' 0
749
 
    checkstat 'cache hit (preprocessed)' 1
750
 
    checkstat 'cache miss' 1
 
940
    $CCACHE $COMPILER -c -Wp,-MMD,different_name.d test.c
 
941
    checkstat 'cache hit (direct)' 2
 
942
    checkstat 'cache hit (preprocessed)' 0
 
943
    checkstat 'cache miss' 1
 
944
    checkfile different_name.d "$expected_mmd_d_content"
 
945
    compare_file reference_test.o test.o
 
946
 
 
947
    rm -f different_name.d
751
948
 
752
949
    ##################################################################
753
950
    # Test some header modifications to get multiple objects in the manifest.
772
969
    checkstat 'cache hit (preprocessed)' 0
773
970
    checkstat 'cache miss' 1
774
971
    checkfile test.d "$expected_d_content"
 
972
    CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o
 
973
    compare_file reference_test.o test.o
775
974
 
776
975
    rm -f test.d
777
976
 
780
979
    checkstat 'cache hit (preprocessed)' 0
781
980
    checkstat 'cache miss' 1
782
981
    checkfile test.d "$expected_d_content"
 
982
    compare_file reference_test.o test.o
 
983
 
 
984
    ##################################################################
 
985
    # Check that coverage works.
 
986
    testname="coverage (empty)"
 
987
    $CCACHE -z >/dev/null
 
988
    $CCACHE $COMPILER -c -fprofile-arcs -ftest-coverage test.c
 
989
    checkstat 'cache hit (direct)' 0
 
990
    checkstat 'cache hit (preprocessed)' 0
 
991
    checkstat 'cache miss' 1
 
992
    $CCACHE $COMPILER -c -fprofile-arcs -ftest-coverage test.c
 
993
    checkstat 'cache hit (direct)' 1
 
994
    checkstat 'cache hit (preprocessed)' 0
 
995
    checkstat 'cache miss' 1
 
996
 
 
997
    testname="coverage (code)"
 
998
    $CCACHE -z >/dev/null
 
999
    $CCACHE $COMPILER -c -fprofile-arcs -ftest-coverage code.c
 
1000
    checkstat 'cache hit (direct)' 0
 
1001
    checkstat 'cache hit (preprocessed)' 0
 
1002
    checkstat 'cache miss' 1
 
1003
    test -r code.gcno || test_failed "gcov"
 
1004
 
 
1005
    rm -f code.gcno
 
1006
 
 
1007
    $CCACHE $COMPILER -c -fprofile-arcs -ftest-coverage code.c
 
1008
    checkstat 'cache hit (direct)' 1
 
1009
    checkstat 'cache hit (preprocessed)' 0
 
1010
    checkstat 'cache miss' 1
 
1011
    test -r code.gcno || test_failed "gcov"
783
1012
 
784
1013
    ##################################################################
785
1014
    # Check the scenario of running a ccache with direct mode on a cache
792
1021
    checkstat 'cache hit (preprocessed)' 0
793
1022
    checkstat 'cache miss' 1
794
1023
    checkfile test.d "$expected_d_content"
 
1024
    CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o
 
1025
    compare_file reference_test.o test.o
795
1026
 
796
1027
    rm -f test.d
797
1028
 
800
1031
    checkstat 'cache hit (preprocessed)' 1
801
1032
    checkstat 'cache miss' 1
802
1033
    checkfile test.d "$expected_d_content"
 
1034
    compare_file reference_test.o test.o
803
1035
 
804
1036
    rm -f test.d
805
1037
 
808
1040
    checkstat 'cache hit (preprocessed)' 2
809
1041
    checkstat 'cache miss' 1
810
1042
    checkfile test.d "$expected_d_content"
 
1043
    compare_file reference_test.o test.o
811
1044
 
812
1045
    rm -f test.d
813
1046
 
816
1049
    checkstat 'cache hit (preprocessed)' 2
817
1050
    checkstat 'cache miss' 1
818
1051
    checkfile test.d "$expected_d_content"
 
1052
    compare_file reference_test.o test.o
819
1053
 
820
1054
    ##################################################################
821
1055
    # Check that -MF works.
827
1061
    checkstat 'cache hit (preprocessed)' 0
828
1062
    checkstat 'cache miss' 1
829
1063
    checkfile other.d "$expected_d_content"
 
1064
    CCACHE_DISABLE=1 $COMPILER -c -MD -MF other.d test.c -o reference_test.o
 
1065
    compare_file reference_test.o test.o
830
1066
 
831
1067
    rm -f other.d
832
1068
 
835
1071
    checkstat 'cache hit (preprocessed)' 0
836
1072
    checkstat 'cache miss' 1
837
1073
    checkfile other.d "$expected_d_content"
 
1074
    compare_file reference_test.o test.o
 
1075
 
 
1076
    $CCACHE $COMPILER -c -MD -MF different_name.d test.c
 
1077
    checkstat 'cache hit (direct)' 2
 
1078
    checkstat 'cache hit (preprocessed)' 0
 
1079
    checkstat 'cache miss' 1
 
1080
    checkfile different_name.d "$expected_d_content"
 
1081
    compare_file reference_test.o test.o
 
1082
 
 
1083
    rm -f different_name.d
 
1084
 
 
1085
    $CCACHE $COMPILER -c -MD -MFthird_name.d test.c
 
1086
    checkstat 'cache hit (direct)' 3
 
1087
    checkstat 'cache hit (preprocessed)' 0
 
1088
    checkstat 'cache miss' 1
 
1089
    checkfile third_name.d "$expected_d_content"
 
1090
    compare_file reference_test.o test.o
 
1091
 
 
1092
    rm -f third_name.d
838
1093
 
839
1094
    ##################################################################
840
1095
    # Check that a missing .d file in the cache is handled correctly.
847
1102
    checkstat 'cache hit (preprocessed)' 0
848
1103
    checkstat 'cache miss' 1
849
1104
    checkfile other.d "$expected_d_content"
 
1105
    CCACHE_DISABLE=1 $COMPILER -c -MD test.c -o reference_test.o
 
1106
    compare_file reference_test.o test.o
850
1107
 
851
1108
    $CCACHE $COMPILER -c -MD test.c
852
1109
    checkstat 'cache hit (direct)' 1
853
1110
    checkstat 'cache hit (preprocessed)' 0
854
1111
    checkstat 'cache miss' 1
855
1112
    checkfile other.d "$expected_d_content"
 
1113
    compare_file reference_test.o test.o
856
1114
 
857
1115
    find $CCACHE_DIR -name '*.d' -exec rm -f '{}' \;
858
1116
 
861
1119
    checkstat 'cache hit (preprocessed)' 1
862
1120
    checkstat 'cache miss' 1
863
1121
    checkfile other.d "$expected_d_content"
 
1122
    compare_file reference_test.o test.o
864
1123
 
865
1124
    ##################################################################
866
1125
    # Check that stderr from both the preprocessor and the compiler is emitted
898
1157
    checkfile stderr-mf.txt "`cat stderr-orig.txt`"
899
1158
 
900
1159
    ##################################################################
901
 
    # Check that changes in comments are ignored when hashing.
902
 
    testname="changes in comments"
903
 
    $CCACHE -C >/dev/null
904
 
    $CCACHE -z >/dev/null
905
 
    cat <<EOF >comments.h
906
 
/*
907
 
 * /* foo comment
908
 
 */
909
 
EOF
910
 
    backdate comments.h
911
 
    cat <<'EOF' >comments.c
912
 
#include "comments.h"
913
 
char test[] = "\
914
 
/* apple */ // banana"; // foo comment
915
 
EOF
916
 
 
917
 
    $CCACHE $COMPILER -c comments.c
918
 
    checkstat 'cache hit (direct)' 0
919
 
    checkstat 'cache hit (preprocessed)' 0
920
 
    checkstat 'cache miss' 1
921
 
 
922
 
    sed_in_place 's/foo/ignored/' comments.h comments.c
923
 
    backdate comments.h
924
 
 
925
 
    $CCACHE $COMPILER -c comments.c
926
 
    checkstat 'cache hit (direct)' 1
927
 
    checkstat 'cache hit (preprocessed)' 0
928
 
    checkstat 'cache miss' 1
929
 
 
930
 
    # Check that comment-like string contents are hashed.
931
 
    sed_in_place 's/apple/orange/' comments.c
932
 
    backdate comments.h
933
 
 
934
 
    $CCACHE $COMPILER -c comments.c
935
 
    checkstat 'cache hit (direct)' 1
936
 
    checkstat 'cache hit (preprocessed)' 0
937
 
    checkstat 'cache miss' 2
938
 
 
939
 
    ##################################################################
940
 
    # Check that it's possible to compile and cache an empty source code file.
 
1160
    # Check that it is possible to compile and cache an empty source code file.
941
1161
    testname="empty source file"
942
1162
    $CCACHE -Cz >/dev/null
943
1163
    cp /dev/null empty.c
1021
1241
#define file __FILE__
1022
1242
int test;
1023
1243
EOF
1024
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c file.c
 
1244
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c file.c
1025
1245
    checkstat 'cache hit (direct)' 0
1026
1246
    checkstat 'cache hit (preprocessed)' 0
1027
1247
    checkstat 'cache miss' 1
1028
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c file.c
 
1248
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c file.c
1029
1249
    checkstat 'cache hit (direct)' 1
1030
1250
    checkstat 'cache hit (preprocessed)' 0
1031
1251
    checkstat 'cache miss' 1
1032
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c `pwd`/file.c
 
1252
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c `pwd`/file.c
1033
1253
    checkstat 'cache hit (direct)' 2
1034
1254
    checkstat 'cache hit (preprocessed)' 0
1035
1255
    checkstat 'cache miss' 1
1044
1264
    cat <<EOF >file_h.c
1045
1265
#include "file.h"
1046
1266
EOF
1047
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c file_h.c
 
1267
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c file_h.c
1048
1268
    checkstat 'cache hit (direct)' 0
1049
1269
    checkstat 'cache hit (preprocessed)' 0
1050
1270
    checkstat 'cache miss' 1
1051
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c file_h.c
 
1271
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c file_h.c
1052
1272
    checkstat 'cache hit (direct)' 1
1053
1273
    checkstat 'cache hit (preprocessed)' 0
1054
1274
    checkstat 'cache miss' 1
1055
1275
    mv file_h.c file2_h.c
1056
 
    CCACHE_SLOPPINESS=file_macro $CCACHE $COMPILER -c `pwd`/file2_h.c
 
1276
    CCACHE_SLOPPINESS="$default_sloppiness file_macro" $CCACHE $COMPILER -c `pwd`/file2_h.c
1057
1277
    checkstat 'cache hit (direct)' 2
1058
1278
    checkstat 'cache hit (preprocessed)' 0
1059
1279
    checkstat 'cache miss' 1
1102
1322
#define time __TIME__
1103
1323
int test;
1104
1324
EOF
1105
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c time.c
 
1325
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER -c time.c
1106
1326
    checkstat 'cache hit (direct)' 0
1107
1327
    checkstat 'cache hit (preprocessed)' 0
1108
1328
    checkstat 'cache miss' 1
1109
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c time.c
 
1329
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER -c time.c
1110
1330
    checkstat 'cache hit (direct)' 1
1111
1331
    checkstat 'cache hit (preprocessed)' 0
1112
1332
    checkstat 'cache miss' 1
1121
1341
    cat <<EOF >time_h.c
1122
1342
#include "time.h"
1123
1343
EOF
1124
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c time_h.c
 
1344
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER -c time_h.c
1125
1345
    checkstat 'cache hit (direct)' 0
1126
1346
    checkstat 'cache hit (preprocessed)' 0
1127
1347
    checkstat 'cache miss' 1
1128
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c time_h.c
 
1348
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER -c time_h.c
1129
1349
    checkstat 'cache hit (direct)' 1
1130
1350
    checkstat 'cache hit (preprocessed)' 0
1131
1351
    checkstat 'cache miss' 1
1161
1381
int test;
1162
1382
EOF
1163
1383
    touch -t 203801010000 new.h
1164
 
    CCACHE_SLOPPINESS=include_file_mtime $CCACHE $COMPILER -c new.c
 
1384
    CCACHE_SLOPPINESS="$default_sloppiness include_file_mtime" $CCACHE $COMPILER -c new.c
1165
1385
    checkstat 'cache hit (direct)' 0
1166
1386
    checkstat 'cache hit (preprocessed)' 0
1167
1387
    checkstat 'cache miss' 1
1168
 
    CCACHE_SLOPPINESS=include_file_mtime $CCACHE $COMPILER -c new.c
 
1388
    CCACHE_SLOPPINESS="$default_sloppiness include_file_mtime" $CCACHE $COMPILER -c new.c
1169
1389
    checkstat 'cache hit (direct)' 1
1170
1390
    checkstat 'cache hit (preprocessed)' 0
1171
1391
    checkstat 'cache miss' 1
1203
1423
    checkstat 'cache hit (direct)' 2
1204
1424
    checkstat 'cache hit (preprocessed)' 0
1205
1425
    checkstat 'cache miss' 2
 
1426
 
 
1427
    testname="comment in strings"
 
1428
    $CCACHE -Cz >/dev/null
 
1429
    echo 'char *comment = " /* \\\\u" "foo" " */";' >comment.c
 
1430
    $CCACHE $COMPILER -c comment.c
 
1431
    checkstat 'cache hit (direct)' 0
 
1432
    checkstat 'cache hit (preprocessed)' 0
 
1433
    checkstat 'cache miss' 1
 
1434
    $CCACHE $COMPILER -c comment.c
 
1435
    checkstat 'cache hit (direct)' 1
 
1436
    checkstat 'cache hit (preprocessed)' 0
 
1437
    checkstat 'cache miss' 1
 
1438
    echo 'char *comment = " /* \\\\u" "goo" " */";' >comment.c
 
1439
    $CCACHE $COMPILER -c comment.c
 
1440
    checkstat 'cache hit (direct)' 1
 
1441
    checkstat 'cache hit (preprocessed)' 0
 
1442
    checkstat 'cache miss' 2
 
1443
 
 
1444
    #################################################################
 
1445
    # Check that strange "#line" directives are handled.
 
1446
    testname="#line directives with troublesome files"
 
1447
    $CCACHE -Cz >/dev/null
 
1448
    cat <<EOF >strange.c
 
1449
int foo;
 
1450
EOF
 
1451
    for x in stdout tty sda hda; do
 
1452
        if [ -b /dev/$x ] || [ -c /dev/$x ]; then
 
1453
            echo "#line 1 \"/dev/$x\"" >> strange.c
 
1454
        fi
 
1455
    done
 
1456
    CCACHE_SLOPPINESS="$default_sloppiness include_file_mtime" $CCACHE $COMPILER -c strange.c
 
1457
    manifest=`find $CCACHE_DIR -name '*.manifest'`
 
1458
    if [ -n "$manifest" ]; then
 
1459
        data="`$CCACHE --dump-manifest $manifest | egrep '/dev/(stdout|tty|sda|hda'`"
 
1460
        if [ -n "$data" ]; then
 
1461
            test_failed "$manifest contained troublesome file(s): $data"
 
1462
        fi
 
1463
    fi
 
1464
 
 
1465
    ##################################################################
 
1466
    # Test --dump-manifest output.
 
1467
    testname="--dump-manifest"
 
1468
    $CCACHE -Cz >/dev/null
 
1469
    $CCACHE $COMPILER test.c -c -o test.o
 
1470
    manifest=`find $CCACHE_DIR -name '*.manifest'`
 
1471
    $CCACHE --dump-manifest $manifest >manifest.dump
 
1472
 
 
1473
    if grep 'Hash: e6b009695d072974f2c4d1dd7e7ed4fc' manifest.dump >/dev/null 2>&1 && \
 
1474
       grep 'Hash: e94ceb9f1b196c387d098a5f1f4fe862' manifest.dump >/dev/null 2>&1 && \
 
1475
       grep 'Hash: c2f5392dbc7e8ff6138d01608445240a' manifest.dump >/dev/null 2>&1; then
 
1476
        : OK
 
1477
    else
 
1478
        test_failed "unexpected output of --dump-manifest"
 
1479
    fi
1206
1480
}
1207
1481
 
1208
1482
basedir_suite() {
1256
1530
    $CCACHE -z >/dev/null
1257
1531
    $CCACHE -C >/dev/null
1258
1532
 
1259
 
    cd dir1
 
1533
    ln -s dir1 symlink_to_dir1
 
1534
    cd symlink_to_dir1
1260
1535
    CCACHE_BASEDIR="`pwd`" $CCACHE $COMPILER -I`pwd`/include -c src/test.c
1261
1536
    checkstat 'cache hit (direct)' 0
1262
1537
    checkstat 'cache hit (preprocessed)' 0
1356
1631
        checkstat 'cache miss' 1
1357
1632
        cd ..
1358
1633
    done
 
1634
 
 
1635
    ##################################################################
 
1636
    # Check that clang's --serialize-diagnostics arguments with absolute paths
 
1637
    # are rewritten to relative.
 
1638
    if [ $COMPILER_TYPE_CLANG -eq 1 ]; then
 
1639
        testname="serialize-diagnostics"
 
1640
        $CCACHE -Cz >/dev/null
 
1641
        cd dir1
 
1642
        CCACHE_BASEDIR=`pwd` $CCACHE $COMPILER -w -MD -MF `pwd`/test.d -I`pwd`/include --serialize-diagnostics `pwd`/test.dia -c src/test.c -o `pwd`/test.o
 
1643
        checkstat 'cache hit (direct)' 0
 
1644
        checkstat 'cache hit (preprocessed)' 0
 
1645
        checkstat 'cache miss' 1
 
1646
        checkstat 'files in cache' 4
 
1647
        cd ..
 
1648
 
 
1649
        cd dir2
 
1650
        CCACHE_BASEDIR=`pwd` $CCACHE $COMPILER -w -MD -MF `pwd`/test.d -I`pwd`/include --serialize-diagnostics `pwd`/test.dia -c src/test.c -o `pwd`/test.o
 
1651
        checkstat 'cache hit (direct)' 1
 
1652
        checkstat 'cache hit (preprocessed)' 0
 
1653
        checkstat 'cache miss' 1
 
1654
        checkstat 'files in cache' 4
 
1655
        cd ..
 
1656
    fi
1359
1657
}
1360
1658
 
1361
1659
compression_suite() {
1451
1749
    ##################################################################
1452
1750
}
1453
1751
 
 
1752
readonly_direct_suite() {
 
1753
    unset CCACHE_NODIRECT
 
1754
 
 
1755
    ##################################################################
 
1756
    # Create some code to compile.
 
1757
    echo "int test;" >test.c
 
1758
 
 
1759
    # Cache a compilation.
 
1760
    testname="fill cache"
 
1761
    $CCACHE $COMPILER -c test.c -o test.o
 
1762
    checkstat 'cache hit (direct)' 0
 
1763
    checkstat 'cache hit (preprocessed)' 0
 
1764
    checkstat 'cache miss' 1
 
1765
 
 
1766
    # Check that "readonly direct" mode gets a direct hit.
 
1767
    testname="direct hit"
 
1768
    CCACHE_READONLY_DIRECT=1 $CCACHE $COMPILER -c test.c -o test.o
 
1769
    checkstat 'cache hit (direct)' 1
 
1770
    checkstat 'cache hit (preprocessed)' 0
 
1771
    checkstat 'cache miss' 1
 
1772
 
 
1773
    # Check that "readonly direct" mode doesn't get a preprocessed hit.
 
1774
    testname="preprocessed miss"
 
1775
    CCACHE_READONLY_DIRECT=1 $CCACHE $COMPILER -DFOO -c test.c -o test.o
 
1776
    checkstat 'cache hit (direct)' 1
 
1777
    checkstat 'cache hit (preprocessed)' 0
 
1778
    checkstat 'cache miss' 1
 
1779
}
 
1780
 
1454
1781
extrafiles_suite() {
1455
1782
    ##################################################################
1456
1783
    # Create some code to compile.
1639
1966
    $CCACHE -C >/dev/null
1640
1967
    prepare_cleanup_test $CCACHE_DIR/a
1641
1968
    touch $CCACHE_DIR/a/abcd.unknown
1642
 
    $CCACHE -c >/dev/null # update counters
 
1969
    $CCACHE -F 0 -M 0 -c >/dev/null # update counters
1643
1970
    checkstat 'files in cache' 31
1644
1971
    # (9/10) * 30 * 16 = 432
1645
1972
    $CCACHE -F 432 -M 0 >/dev/null
1704
2031
}
1705
2032
EOF
1706
2033
 
1707
 
    if $COMPILER -fpch-preprocess pch.h 2>/dev/null && [ -f pch.h.gch ] && $COMPILER pch.c -o pch; then
1708
 
        :
 
2034
    if $COMPILER $SYSROOT -fpch-preprocess pch.h 2>/dev/null && [ -f pch.h.gch ] && $COMPILER $SYSROOT pch.c -o pch; then
 
2035
        rm pch.h.gch
1709
2036
    else
1710
2037
        echo "Compiler (`$COMPILER --version | head -1`) doesn't support precompiled headers -- not running pch test"
1711
2038
        return
1712
2039
    fi
1713
2040
 
 
2041
    # clang and gcc handle precompiled headers similarly, but gcc is much more
 
2042
    # forgiving with precompiled headers. Both gcc and clang keep an absolute
 
2043
    # path reference to the original file except that clang uses that reference
 
2044
    # to validate the pch and gcc ignores the reference. Also, clang has an
 
2045
    # additional feature: pre-tokenized headers. For these reasons clang should
 
2046
    # be tested separately than gcc. clang can only use pch or pth headers on
 
2047
    # the command line and not as an #include statement inside a source file.
 
2048
 
 
2049
    if [ $COMPILER_TYPE_CLANG -eq 1 ]; then
 
2050
        clang_pch_suite
 
2051
    else
 
2052
        gcc_pch_suite
 
2053
    fi
 
2054
}
 
2055
 
 
2056
gcc_pch_suite() {
1714
2057
    ##################################################################
1715
2058
    # Tests for creating a .gch without opt-in.
1716
2059
 
1718
2061
 
1719
2062
    testname="create .gch, -c, no -o, without opt-in"
1720
2063
    $CCACHE -zC >/dev/null
1721
 
    $CCACHE $COMPILER -c pch.h
 
2064
    $CCACHE $COMPILER $SYSROOT -c pch.h
1722
2065
    checkstat 'cache hit (direct)' 0
1723
2066
    checkstat 'cache hit (preprocessed)' 0
1724
2067
    checkstat 'cache miss' 0
1739
2082
 
1740
2083
    testname="create .gch, -c, no -o, with opt-in"
1741
2084
    $CCACHE -zC >/dev/null
1742
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c pch.h
 
2085
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT -c pch.h
1743
2086
    checkstat 'cache hit (direct)' 0
1744
2087
    checkstat 'cache hit (preprocessed)' 0
1745
2088
    checkstat 'cache miss' 1
1746
2089
    rm -f pch.h.gch
1747
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c pch.h
 
2090
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT -c pch.h
1748
2091
    checkstat 'cache hit (direct)' 1
1749
2092
    checkstat 'cache hit (preprocessed)' 0
1750
2093
    checkstat 'cache miss' 1
1754
2097
 
1755
2098
    testname="create .gch, no -c, -o, with opt-in"
1756
2099
    $CCACHE -Cz >/dev/null
1757
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER pch.h -o pch.gch
 
2100
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
1758
2101
    checkstat 'cache hit (direct)' 0
1759
2102
    checkstat 'cache hit (preprocessed)' 0
1760
2103
    checkstat 'cache miss' 1
1761
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER pch.h -o pch.gch
 
2104
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
1762
2105
    checkstat 'cache hit (direct)' 1
1763
2106
    checkstat 'cache hit (preprocessed)' 0
1764
2107
    checkstat 'cache miss' 1
1765
2108
    if [ ! -f pch.gch ]; then
1766
2109
        test_failed "pch.gch missing"
1767
2110
    fi
 
2111
    rm pch.gch
1768
2112
 
1769
2113
    ##################################################################
1770
2114
    # Tests for using a .gch.
1774
2118
 
1775
2119
    testname="no -fpch-preprocess, #include"
1776
2120
    $CCACHE -Cz >/dev/null
1777
 
    $CCACHE $COMPILER -c pch.c 2>/dev/null
 
2121
    $CCACHE $COMPILER $SYSROOT -c pch.c 2>/dev/null
1778
2122
    checkstat 'cache hit (direct)' 0
1779
2123
    checkstat 'cache hit (preprocessed)' 0
1780
2124
    checkstat 'cache miss' 0
1784
2128
 
1785
2129
    testname="no -fpch-preprocess, -include, no sloppiness"
1786
2130
    $CCACHE -Cz >/dev/null
1787
 
    $CCACHE $COMPILER -c -include pch.h pch2.c 2>/dev/null
 
2131
    $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
1788
2132
    checkstat 'cache hit (direct)' 0
1789
2133
    checkstat 'cache hit (preprocessed)' 0
1790
2134
    checkstat 'cache miss' 0
1793
2137
 
1794
2138
    testname="no -fpch-preprocess, -include"
1795
2139
    $CCACHE -Cz >/dev/null
1796
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -include pch.h pch2.c 2>/dev/null
 
2140
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
1797
2141
    checkstat 'cache hit (direct)' 0
1798
2142
    checkstat 'cache hit (preprocessed)' 0
1799
2143
    checkstat 'cache miss' 1
1800
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -include pch.h pch2.c 2>/dev/null
 
2144
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
1801
2145
    checkstat 'cache hit (direct)' 1
1802
2146
    checkstat 'cache hit (preprocessed)' 0
1803
2147
    checkstat 'cache miss' 1
1804
2148
 
1805
2149
    testname="-fpch-preprocess, #include, no sloppiness"
1806
2150
    $CCACHE -Cz >/dev/null
1807
 
    $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2151
    $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1808
2152
    checkstat 'cache hit (direct)' 0
1809
2153
    checkstat 'cache hit (preprocessed)' 0
1810
2154
    # Must enable sloppy time macros:
1812
2156
 
1813
2157
    testname="-fpch-preprocess, #include, sloppiness"
1814
2158
    $CCACHE -Cz >/dev/null
1815
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2159
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1816
2160
    checkstat 'cache hit (direct)' 0
1817
2161
    checkstat 'cache hit (preprocessed)' 0
1818
2162
    checkstat 'cache miss' 1
1819
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2163
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1820
2164
    checkstat 'cache hit (direct)' 1
1821
2165
    checkstat 'cache hit (preprocessed)' 0
1822
2166
    checkstat 'cache miss' 1
1824
2168
    testname="-fpch-preprocess, #include, file changed"
1825
2169
    echo "updated" >>pch.h.gch # GCC seems to cope with this...
1826
2170
    backdate pch.h.gch
1827
 
    CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2171
    CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1828
2172
    checkstat 'cache hit (direct)' 1
1829
2173
    checkstat 'cache hit (preprocessed)' 0
1830
2174
    checkstat 'cache miss' 2
1831
2175
 
1832
2176
    testname="preprocessor mode"
1833
2177
    $CCACHE -Cz >/dev/null
1834
 
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2178
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1835
2179
    checkstat 'cache hit (direct)' 0
1836
2180
    checkstat 'cache hit (preprocessed)' 0
1837
2181
    checkstat 'cache miss' 1
1838
 
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
 
2182
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
1839
2183
    checkstat 'cache hit (direct)' 0
1840
2184
    checkstat 'cache hit (preprocessed)' 1
1841
2185
    checkstat 'cache miss' 1
1843
2187
    testname="preprocessor mode, file changed"
1844
2188
    echo "updated" >>pch.h.gch # GCC seems to cope with this...
1845
2189
    backdate pch.h.gch
1846
 
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
1847
 
    checkstat 'cache hit (direct)' 0
1848
 
    checkstat 'cache hit (preprocessed)' 1
1849
 
    checkstat 'cache miss' 2
1850
 
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=pch_defines,time_macros $CCACHE $COMPILER -c -fpch-preprocess pch.c
1851
 
    checkstat 'cache hit (direct)' 0
1852
 
    checkstat 'cache hit (preprocessed)' 2
1853
 
    checkstat 'cache miss' 2
 
2190
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
 
2191
    checkstat 'cache hit (direct)' 0
 
2192
    checkstat 'cache hit (preprocessed)' 1
 
2193
    checkstat 'cache miss' 2
 
2194
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS="$default_sloppiness pch_defines time_macros" $CCACHE $COMPILER $SYSROOT -c -fpch-preprocess pch.c
 
2195
    checkstat 'cache hit (direct)' 0
 
2196
    checkstat 'cache hit (preprocessed)' 2
 
2197
    checkstat 'cache miss' 2
 
2198
}
 
2199
 
 
2200
clang_pch_suite() {
 
2201
    ##################################################################
 
2202
    # Tests for creating a .gch.
 
2203
 
 
2204
    backdate pch.h
 
2205
 
 
2206
    testname="create .gch, -c, no -o"
 
2207
    $CCACHE -zC >/dev/null
 
2208
    $CCACHE $COMPILER $SYSROOT -c pch.h
 
2209
    checkstat 'cache hit (direct)' 0
 
2210
    checkstat 'cache hit (preprocessed)' 0
 
2211
    checkstat 'cache miss' 1
 
2212
    rm -f pch.h.gch
 
2213
    $CCACHE $COMPILER $SYSROOT -c pch.h
 
2214
    checkstat 'cache hit (direct)' 1
 
2215
    checkstat 'cache hit (preprocessed)' 0
 
2216
    checkstat 'cache miss' 1
 
2217
    if [ ! -f pch.h.gch ]; then
 
2218
        test_failed "pch.h.gch missing"
 
2219
    fi
 
2220
 
 
2221
    testname="create .gch, no -c, -o"
 
2222
    $CCACHE -Cz >/dev/null
 
2223
    $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
 
2224
    checkstat 'cache hit (direct)' 0
 
2225
    checkstat 'cache hit (preprocessed)' 0
 
2226
    checkstat 'cache miss' 1
 
2227
    $CCACHE $COMPILER $SYSROOT pch.h -o pch.gch
 
2228
    checkstat 'cache hit (direct)' 1
 
2229
    checkstat 'cache hit (preprocessed)' 0
 
2230
    checkstat 'cache miss' 1
 
2231
    if [ ! -f pch.gch ]; then
 
2232
        test_failed "pch.gch missing"
 
2233
    fi
 
2234
    rm pch.gch
 
2235
 
 
2236
    ##################################################################
 
2237
    # Tests for using a .gch.
 
2238
 
 
2239
    backdate pch.h.gch
 
2240
 
 
2241
    testname="gch, no -fpch-preprocess, -include, no sloppy time macros"
 
2242
    $CCACHE -Cz >/dev/null
 
2243
    $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
 
2244
    checkstat 'cache hit (direct)' 0
 
2245
    checkstat 'cache hit (preprocessed)' 0
 
2246
    checkstat 'cache miss' 0
 
2247
    # Must enable sloppy time macros:
 
2248
    checkstat "can't use precompiled header" 1
 
2249
 
 
2250
    testname="gch, no -fpch-preprocess, -include, sloppy time macros"
 
2251
    $CCACHE -Cz >/dev/null
 
2252
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
 
2253
    checkstat 'cache hit (direct)' 0
 
2254
    checkstat 'cache hit (preprocessed)' 0
 
2255
    checkstat 'cache miss' 1
 
2256
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
 
2257
    checkstat 'cache hit (direct)' 1
 
2258
    checkstat 'cache hit (preprocessed)' 0
 
2259
    checkstat 'cache miss' 1
 
2260
 
 
2261
    testname="gch, -fpch-preprocess, -include, file changed"
 
2262
    echo "updated" >>pch.h.gch # clang seems to cope with this...
 
2263
    backdate pch.h.gch
 
2264
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2265
    checkstat 'cache hit (direct)' 1
 
2266
    checkstat 'cache hit (preprocessed)' 0
 
2267
    checkstat 'cache miss' 2
 
2268
 
 
2269
    testname="gch, preprocessor mode"
 
2270
    $CCACHE -Cz >/dev/null
 
2271
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2272
    checkstat 'cache hit (direct)' 0
 
2273
    checkstat 'cache hit (preprocessed)' 0
 
2274
    checkstat 'cache miss' 1
 
2275
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2276
    checkstat 'cache hit (direct)' 0
 
2277
    checkstat 'cache hit (preprocessed)' 1
 
2278
    checkstat 'cache miss' 1
 
2279
 
 
2280
    testname="gch, preprocessor mode, file changed"
 
2281
    echo "updated" >>pch.h.gch # clang seems to cope with this...
 
2282
    backdate pch.h.gch
 
2283
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2284
    checkstat 'cache hit (direct)' 0
 
2285
    checkstat 'cache hit (preprocessed)' 1
 
2286
    checkstat 'cache miss' 2
 
2287
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2288
    checkstat 'cache hit (direct)' 0
 
2289
    checkstat 'cache hit (preprocessed)' 2
 
2290
    checkstat 'cache miss' 2
 
2291
 
 
2292
    rm pch.h.gch
 
2293
 
 
2294
    ##################################################################
 
2295
    # Tests for creating a .pth.
 
2296
 
 
2297
    backdate pch.h
 
2298
 
 
2299
    testname="create .pth, -c, -o"
 
2300
    $CCACHE -zC >/dev/null
 
2301
    $CCACHE $COMPILER $SYSROOT -c pch.h -o pch.h.pth
 
2302
    checkstat 'cache hit (direct)' 0
 
2303
    checkstat 'cache hit (preprocessed)' 0
 
2304
    checkstat 'cache miss' 1
 
2305
    rm -f pch.h.pth
 
2306
    $CCACHE $COMPILER $SYSROOT -c pch.h -o pch.h.pth
 
2307
    checkstat 'cache hit (direct)' 1
 
2308
    checkstat 'cache hit (preprocessed)' 0
 
2309
    checkstat 'cache miss' 1
 
2310
    if [ ! -f pch.h.pth ]; then
 
2311
        test_failed "pch.h.pth missing"
 
2312
    fi
 
2313
 
 
2314
    ##################################################################
 
2315
    # Tests for using a .pth.
 
2316
 
 
2317
    backdate pch.h.pth
 
2318
 
 
2319
    testname="pth, no -fpch-preprocess, -include, no sloppy time macros"
 
2320
    $CCACHE -Cz >/dev/null
 
2321
    $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c
 
2322
    checkstat 'cache hit (direct)' 0
 
2323
    checkstat 'cache hit (preprocessed)' 0
 
2324
    checkstat 'cache miss' 0
 
2325
    # Must enable sloppy time macros:
 
2326
    checkstat "can't use precompiled header" 1
 
2327
 
 
2328
    testname="pth, no -fpch-preprocess, -include, sloppy time macros"
 
2329
    $CCACHE -Cz >/dev/null
 
2330
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
 
2331
    checkstat 'cache hit (direct)' 0
 
2332
    checkstat 'cache hit (preprocessed)' 0
 
2333
    checkstat 'cache miss' 1
 
2334
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h pch2.c 2>/dev/null
 
2335
    checkstat 'cache hit (direct)' 1
 
2336
    checkstat 'cache hit (preprocessed)' 0
 
2337
    checkstat 'cache miss' 1
 
2338
 
 
2339
    testname="pth, -fpch-preprocess, -include, file changed"
 
2340
    echo "updated" >>pch.h.pth # clang seems to cope with this...
 
2341
    backdate pch.h.pth
 
2342
    CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2343
    checkstat 'cache hit (direct)' 1
 
2344
    checkstat 'cache hit (preprocessed)' 0
 
2345
    checkstat 'cache miss' 2
 
2346
 
 
2347
    testname="pth, preprocessor mode"
 
2348
    $CCACHE -Cz >/dev/null
 
2349
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2350
    checkstat 'cache hit (direct)' 0
 
2351
    checkstat 'cache hit (preprocessed)' 0
 
2352
    checkstat 'cache miss' 1
 
2353
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2354
    checkstat 'cache hit (direct)' 0
 
2355
    checkstat 'cache hit (preprocessed)' 1
 
2356
    checkstat 'cache miss' 1
 
2357
 
 
2358
    testname="pth, preprocessor mode, file changed"
 
2359
    echo "updated" >>pch.h.pth # clang seems to cope with this...
 
2360
    backdate pch.h.pth
 
2361
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2362
    checkstat 'cache hit (direct)' 0
 
2363
    checkstat 'cache hit (preprocessed)' 1
 
2364
    checkstat 'cache miss' 2
 
2365
    CCACHE_NODIRECT=1 CCACHE_SLOPPINESS=time_macros $CCACHE $COMPILER $SYSROOT -c -include pch.h -fpch-preprocess pch.c
 
2366
    checkstat 'cache hit (direct)' 0
 
2367
    checkstat 'cache hit (preprocessed)' 2
 
2368
    checkstat 'cache miss' 2
 
2369
 
 
2370
    rm pch.h.pth
 
2371
}
 
2372
 
 
2373
upgrade_suite() {
 
2374
    testname="keep maxfiles and maxsize settings"
 
2375
    rm -rf $CCACHE_DIR $CCACHE_CONFIGPATH
 
2376
    mkdir -p $CCACHE_DIR/0
 
2377
    echo "0 0 0 0 0 0 0 0 0 0 0 0 0 2000 131072" >$CCACHE_DIR/0/stats
 
2378
    checkstat 'max files' 32000
 
2379
    checkstat 'max cache size' '2.1 GB'
 
2380
}
 
2381
 
 
2382
prefix_suite() {
 
2383
    testname="prefix"
 
2384
    $CCACHE -Cz >/dev/null
 
2385
    rm -f prefix.result
 
2386
    cat <<'EOF' >prefix-a
 
2387
#!/bin/sh
 
2388
echo a >>prefix.result
 
2389
exec "$@"
 
2390
EOF
 
2391
    cat <<'EOF' >prefix-b
 
2392
#!/bin/sh
 
2393
echo b >>prefix.result
 
2394
exec "$@"
 
2395
EOF
 
2396
    chmod +x prefix-a prefix-b
 
2397
    cat <<'EOF' >file.c
 
2398
int foo;
 
2399
EOF
 
2400
    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
 
2401
    checkstat 'cache hit (direct)' 0
 
2402
    checkstat 'cache hit (preprocessed)' 0
 
2403
    checkstat 'cache miss' 1
 
2404
    checkfile prefix.result "a
 
2405
b"
 
2406
    PATH=.:$PATH CCACHE_PREFIX="prefix-a prefix-b" $CCACHE $COMPILER -c file.c
 
2407
    checkstat 'cache hit (direct)' 0
 
2408
    checkstat 'cache hit (preprocessed)' 1
 
2409
    checkstat 'cache miss' 1
 
2410
    checkfile prefix.result "a
 
2411
b"
1854
2412
}
1855
2413
 
1856
2414
######################################################################
1857
2415
# main program
1858
2416
 
 
2417
if pwd | grep '[^A-Za-z0-9/.,=_%+-]' >/dev/null 2>&1; then
 
2418
    cat <<EOF
 
2419
Error: The test suite doesn't work in directories with whitespace or other
 
2420
funny characters in the name. Sorry.
 
2421
EOF
 
2422
    exit 1
 
2423
fi
 
2424
 
1859
2425
suites="$*"
1860
2426
if [ -n "$CC" ]; then
1861
2427
    COMPILER="$CC"
1866
2432
    CCACHE=`pwd`/ccache
1867
2433
fi
1868
2434
 
 
2435
# save the type of compiler because some test may not work on all compilers
 
2436
COMPILER_TYPE_CLANG=0
 
2437
COMPILER_TYPE_GCC=0
 
2438
 
 
2439
COMPILER_USES_LLVM=0
 
2440
HOST_OS_APPLE=0
 
2441
 
1869
2442
compiler_version="`$COMPILER --version 2>&1 | head -1`"
1870
2443
case $compiler_version in
1871
 
    *gcc*|2.95*)
 
2444
    *gcc*|*g++*|2.95*)
 
2445
        COMPILER_TYPE_GCC=1
 
2446
        ;;
 
2447
    *clang*)
 
2448
        COMPILER_TYPE_CLANG=1
1872
2449
        ;;
1873
2450
    *)
1874
2451
        echo "WARNING: Compiler $COMPILER not supported (version: $compiler_version) -- not running tests" >&2
1876
2453
        ;;
1877
2454
esac
1878
2455
 
 
2456
case $compiler_version in
 
2457
    *llvm*|*LLVM*)
 
2458
        COMPILER_USES_LLVM=1
 
2459
        ;;
 
2460
esac
 
2461
 
 
2462
host_os="`uname -s`"
 
2463
case $host_os in
 
2464
    *Darwin*)
 
2465
        HOST_OS_APPLE=1
 
2466
        ;;
 
2467
esac
 
2468
 
1879
2469
TESTDIR=testdir.$$
1880
2470
rm -rf $TESTDIR
1881
2471
mkdir $TESTDIR
1885
2475
export CCACHE_DIR
1886
2476
CCACHE_LOGFILE=`pwd`/ccache.log
1887
2477
export CCACHE_LOGFILE
 
2478
CCACHE_CONFIGPATH=`pwd`/ccache.conf
 
2479
export CCACHE_CONFIGPATH
 
2480
touch $CCACHE_CONFIGPATH
 
2481
 
 
2482
 
 
2483
if [ $HOST_OS_APPLE -eq 1 ]; then
 
2484
    # Grab the developer directory from the environment or try xcode-select
 
2485
    if [ "$XCODE_DEVELOPER_DIR" = "" ]; then
 
2486
      XCODE_DEVELOPER_DIR=`xcode-select --print-path`
 
2487
      if [ "$XCODE_DEVELOPER_DIR" = "" ]; then
 
2488
        echo "Error: XCODE_DEVELOPER_DIR environment variable not set and xcode-select path not set"
 
2489
        exit 1
 
2490
      fi
 
2491
    fi
 
2492
 
 
2493
    # Choose the latest SDK if an SDK root is not set
 
2494
    MAC_PLATFORM_DIR=$XCODE_DEVELOPER_DIR/Platforms/MacOSX.platform
 
2495
    if [ "$SDKROOT" = "" ]; then
 
2496
        SDKROOT="`eval ls -f -1 -d \"$MAC_PLATFORM_DIR/Developer/SDKs/\"*.sdk | tail -1`"
 
2497
        if [ "$SDKROOT" = "" ]; then
 
2498
            echo "Error: Cannot find a valid SDK root directory"
 
2499
            exit 1
 
2500
        fi
 
2501
    fi
 
2502
 
 
2503
    SYSROOT="-isysroot `echo \"$SDKROOT\" | sed 's/ /\\ /g'`"
 
2504
else
 
2505
    SYSROOT=
 
2506
fi
1888
2507
 
1889
2508
# ---------------------------------------
1890
2509
 
1892
2511
base
1893
2512
link          !win32
1894
2513
hardlink
1895
 
cpp2
1896
2514
nlevels4
1897
2515
nlevels1
1898
2516
basedir       !win32
1899
2517
direct
1900
2518
compression
1901
2519
readonly
 
2520
readonly_direct
1902
2521
extrafiles
1903
2522
cleanup
1904
2523
pch
 
2524
upgrade
 
2525
prefix
1905
2526
"
1906
2527
 
1907
 
host_os="`uname -s`"
1908
2528
case $host_os in
1909
2529
    *MINGW*|*mingw*)
1910
2530
        export CCACHE_DETECT_SHEBANG
1911
2531
        CCACHE_DETECT_SHEBANG=1
1912
 
        DEVNULL=NUL
1913
2532
        PATH_DELIM=";"
1914
2533
        all_suites="`echo "$all_suites" | grep -v '!win32'`"
1915
2534
        ;;
1916
2535
    *)
1917
 
        DEVNULL=/dev/null
1918
2536
        PATH_DELIM=":"
1919
2537
        all_suites="`echo "$all_suites" | cut -d' ' -f1`"
1920
2538
        ;;
1921
2539
esac
1922
2540
 
 
2541
echo compiler: `which $COMPILER`
 
2542
echo version: `$COMPILER --version`
 
2543
echo test dir: $TESTDIR
 
2544
 
1923
2545
if [ -z "$suites" ]; then
1924
2546
    suites="$all_suites"
1925
2547
fi