Add new test case
[official-gcc.git] / libstdc++-v3 / scripts / check_performance
blobd196355bd44deeba2a28421cb42f68c3820e6c1b
1 #!/usr/bin/env bash
3 # Script to do performance testing.
5 # Invocation
6 # check_performance SRC_DIR BUILD_DIR
8 # 1: variables
10 SRC_DIR=$1
11 BUILD_DIR=$2
13 # Now that we've successfully translated the numerical option into
14 # a symbolic one, we can safely ignore it.
15 shift
17 # This has been true all along. Found out about it the hard way...
18 case $BASH_VERSION in
19 1*)
20 echo 'You need bash 2.x to run check_performance. Exiting.';
21 exit 1 ;;
22 *) ;;
23 esac
25 flags_script=$BUILD_DIR/scripts/testsuite_flags
26 INCLUDES=`$flags_script --build-includes`
27 PCH_FLAGS=`$flags_script --cxxpchflags`
28 FLAGS=`$flags_script --cxxflags`
29 THREAD_FLAG='-pthread'
30 COMPILER=`$flags_script --build-cxx`
31 SH_FLAG="-Wl,--rpath -Wl,$BUILD_DIR/../../gcc \
32 -Wl,--rpath -Wl,$BUILD_DIR/src/.libs"
33 ST_FLAG="-static"
34 LINK=$SH_FLAG
35 CXX="$COMPILER $INCLUDES $FLAGS -std=gnu++0x $CXXFLAGS $LINK"
36 LIBS="./libtestc++.a"
37 TESTS_FILE="testsuite_files_performance"
39 echo CXX is $CXX
41 for NAME in `cat $TESTS_FILE`
43 RUN=true
44 TESTNAME=$SRC_DIR/testsuite/$NAME
45 FILE_NAME="`basename $NAME`"
46 FILE_NAME="`echo $FILE_NAME | sed 's/.cc//g'`"
48 # TEST_S == single thread
49 # TEST_B == do both single and multi-thread
50 # TEST_T == multi-thread
51 for CYCLE in `sed -n 's,.*\(TEST_[SB][0-9]*\)$,\1,p' $TESTNAME`
53 RUN=false
54 echo $NAME $CYCLE
55 EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
56 $CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME
57 if [ -f $EXE_NAME ]; then
58 ./$EXE_NAME
59 else
60 echo "compile error:"
61 echo "$CXX -DNOTHREAD -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME"
63 done
65 for CYCLE in `sed -n 's,.*\(TEST_[TB][0-9]*\)$,\1,p' $TESTNAME`
67 RUN=false
68 echo $NAME $CYCLE thread
69 EXE_NAME="`echo $FILE_NAME-$CYCLE.exe`"
70 $CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME
71 if [ -f $EXE_NAME ]; then
72 ./$EXE_NAME
73 else
74 echo "compile error:"
75 echo "$CXX $THREAD_FLAG -D$CYCLE $TESTNAME $LIBS -o $EXE_NAME"
77 done
79 if $RUN; then
80 echo $NAME
81 EXE_NAME="`echo $FILE_NAME.exe`"
82 $CXX $TESTNAME $LIBS -o $EXE_NAME
83 if [ -f $EXE_NAME ]; then
84 ./$EXE_NAME >& tmp.$FILE_NAME
85 else
86 echo "compile error:"
87 echo "$CXX $TESTNAME $LIBS -o $EXE_NAME"
89 if [ -s tmp.$FILE_NAME ]; then
90 mv tmp.$FILE_NAME $FILE_NAME.xml
93 done
95 exit 0