check_compile 1.1 KB

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