1#!/usr/bin/env bash 2 3# Script to do compilation-only testing. 4 5# Invocation 6# check_compile SRC_DIR BUILD_DIR 7 8# 1: variables 9# 10SRC_DIR=$1 11BUILD_DIR=$2 12 13# Now that we've successfully translated the numerical option into 14# a symbolic one, we can safely ignore it. 15shift 16 17# This has been true all along. Found out about it the hard way... 18case $BASH_VERSION in 19 1*) 20 echo 'You need bash 2.x to run check_compile. Exiting.'; 21 exit 1 ;; 22 *) ;; 23esac 24 25flags_script=$BUILD_DIR/scripts/testsuite_flags 26INCLUDES=`$flags_script --build-includes` 27PCH_FLAGS=`$flags_script --cxxpchflags` 28FLAGS=`$flags_script --cxxflags` 29TEST_FLAGS="-S" 30COMPILER=`$flags_script --build-cxx` 31CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS -Wfatal-errors $TEST_FLAGS" 32 33echo "compile line is:" 34echo $CXX 35echo "" 36 37TESTS_FILE="testsuite_files" 38 39#mkdir binaries 40UNIQUE_ID=0 41 42for NAME in `cat $TESTS_FILE` 43do 44 if $RUN; then 45 echo $NAME 46 OUTPUT_NAME=$UNIQUE_ID 47 $CXX $SRC_DIR/testsuite/$NAME -o $OUTPUT_NAME 48 if [ -f $OUTPUT_NAME ]; then 49# mv $OUTPUT_NAME binaries 50 rm $OUTPUT_NAME 51 fi 52 let UNIQUE_ID+=1 53 fi 54done 55 56exit 0 57