2005-01-20 21:28:41 +01:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2018-08-23 17:10:35 +02:00
|
|
|
# Script to do compilation-only testing.
|
2005-01-20 21:28:41 +01:00
|
|
|
|
|
|
|
# Invocation
|
2018-08-23 17:10:35 +02:00
|
|
|
# check_compile SRC_DIR BUILD_DIR
|
2005-01-20 21:28:41 +01:00
|
|
|
|
|
|
|
# 1: variables
|
|
|
|
#
|
|
|
|
SRC_DIR=$1
|
|
|
|
BUILD_DIR=$2
|
|
|
|
|
|
|
|
# Now that we've successfully translated the numerical option into
|
|
|
|
# a symbolic one, we can safely ignore it.
|
|
|
|
shift
|
|
|
|
|
|
|
|
# This has been true all along. Found out about it the hard way...
|
|
|
|
case $BASH_VERSION in
|
|
|
|
1*)
|
2018-08-23 17:10:35 +02:00
|
|
|
echo 'You need bash 2.x to run check_compile. Exiting.';
|
2005-01-20 21:28:41 +01:00
|
|
|
exit 1 ;;
|
|
|
|
*) ;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
flags_script=$BUILD_DIR/scripts/testsuite_flags
|
|
|
|
INCLUDES=`$flags_script --build-includes`
|
|
|
|
PCH_FLAGS=`$flags_script --cxxpchflags`
|
|
|
|
FLAGS=`$flags_script --cxxflags`
|
|
|
|
TEST_FLAGS="-S"
|
|
|
|
COMPILER=`$flags_script --build-cxx`
|
2007-08-22 03:26:43 +02:00
|
|
|
CXX="$COMPILER $INCLUDES $PCH_FLAGS $FLAGS -Wfatal-errors $TEST_FLAGS"
|
2005-01-20 21:28:41 +01:00
|
|
|
|
2006-08-29 12:53:04 +02:00
|
|
|
echo "compile line is:"
|
|
|
|
echo $CXX
|
|
|
|
echo ""
|
|
|
|
|
2005-01-20 21:28:41 +01:00
|
|
|
TESTS_FILE="testsuite_files"
|
|
|
|
|
2005-08-26 22:31:48 +02:00
|
|
|
#mkdir binaries
|
|
|
|
UNIQUE_ID=0
|
|
|
|
|
2005-01-20 21:28:41 +01:00
|
|
|
for NAME in `cat $TESTS_FILE`
|
|
|
|
do
|
|
|
|
if $RUN; then
|
|
|
|
echo $NAME
|
2005-08-26 22:31:48 +02:00
|
|
|
OUTPUT_NAME=$UNIQUE_ID
|
2005-01-20 21:28:41 +01:00
|
|
|
$CXX $SRC_DIR/testsuite/$NAME -o $OUTPUT_NAME
|
|
|
|
if [ -f $OUTPUT_NAME ]; then
|
2005-08-26 22:31:48 +02:00
|
|
|
# mv $OUTPUT_NAME binaries
|
2005-01-20 21:28:41 +01:00
|
|
|
rm $OUTPUT_NAME
|
|
|
|
fi
|
2005-08-26 22:31:48 +02:00
|
|
|
let UNIQUE_ID+=1
|
2005-01-20 21:28:41 +01:00
|
|
|
fi
|
|
|
|
done
|
|
|
|
|
|
|
|
exit 0
|