- #! /bin/sh
- # $Id: check_run.sh,v 1000.2 2004/06/01 16:51:33 gouriano Exp $
- # Author: Vladimir Ivanov, NCBI
- #
- ###########################################################################
- #
- # Build script file for run tests in the build tree. Using "make".
- # Scripts exit code is equival to count of tests, executed with errors.
- #
- # Usage: (Run only from Makefile.meta)
- # check_run.sh <build_dir> <make_command_line>
- #
- # Example:
- # check_run.sh ~/c++/Debug/build make check_add_r
- #
- ###########################################################################
- build_dir=$1
- top_srcdir=$2
- shift
- shift
- cmd=$*
- script_dir=`dirname $0`
- script_dir=`(cd "$script_dir"; pwd)`
- make_check_script="$script_dir/check_make_unix.sh"
- # Define name for the check script file
- script_name="check.sh"
- CHECK_RUN_FILE="`pwd`/$script_name"
- export CHECK_RUN_FILE
- CHECK_RUN_LIST="`pwd`/$script_name.list"
- export CHECK_RUN_LIST
- # Delete all test file list
- rm -f "$CHECK_RUN_FILE" > /dev/null
- rm -f "$CHECK_RUN_LIST" > /dev/null
- # Run make
- echo "======================================================================"
- $cmd
- result=$?
- echo "----------------------------------------------------------------------"
- # Check tests list build result
- if test $result -ne 0 ; then
- echo "Error in collecting tests."
- exit $result
- fi
- # Check script build result
- if test ! -f "$CHECK_RUN_LIST"; then
- echo "Cannot run tests: none found."
- exit 255
- fi
- # Build script on base of check-list
- echo "Building check script..."
- $make_check_script "$CHECK_RUN_LIST" "$build_dir" "$top_srcdir" "" "$CHECK_RUN_FILE"
- # Check script build result
- if test $? -ne 0 -o
- `$build_dir/sysdep.sh tl 2 $CHECK_RUN_FILE | grep -c res_log` -ne 0 ; then
- echo "Error in compiling check script."
- exit 255
- fi
- echo "Done."
- echo
- # Run tests after build flag (Y - run, N - don't run, other - ask)
- run_check=`echo $RUN_CHECK | tr '[a-z]' '[A-Z]' | sed -e 's/^(.).*/1/g'`
- case "$run_check" in
- Y )
- answer='Y' ;;
- N )
- answer='N' ;;
- * )
- echo "Do you want to run the tests right now? [y/n]"
- read answer
- echo ;;
- esac
- case "$answer" in
- n | N ) echo "Run "$CHECK_RUN_FILE run" to launch the tests." ; exit 0 ;;
- esac
- # Launch the tests
- $CHECK_RUN_FILE run
- # Exit
- exit $?
- #
- # ===========================================================================
- # PRODUCTION $Log: check_run.sh,v $
- # PRODUCTION Revision 1000.2 2004/06/01 16:51:33 gouriano
- # PRODUCTION PRODUCTION: UPGRADED [GCC34_MSVC7] Dev-tree R1.18
- # PRODUCTION
- # ===========================================================================
- #