-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Pass the tmp dir to use as argument to the test runner. (#9865)
- Pass the intended base tmp dir to the testrunner script. - The test runner will create the directory before running the tests. - The repetition of tests is moved out of the testrunner script and is now handled by the script that handles the whole testsuite. This is done to allow running a test just once without repetition.
- Loading branch information
Showing
3 changed files
with
35 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,37 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
# If number of arguments less then 1; print usage and exit | ||
if [ $# -lt 1 ]; then | ||
printf "Usage: $0 <test_file>\n" | ||
# If number of arguments less then 2; print usage and exit | ||
if [ $# -lt 2 ]; then | ||
printf "Usage: $0 <test_file> <BaseTmpDir>\n" | ||
exit 1 | ||
fi | ||
|
||
testexe="$1" # The test executable name. | ||
test_exe_path="$1" # The path to test executable. | ||
tmp_dir_for_testsuite="$2" # The base tmp directory for the test. | ||
|
||
echo "Running testcase "$testexe | ||
test_name=$(basename "$test_exe_path") | ||
tmp_dir_for_test="$tmp_dir_for_testsuite/$test_name" | ||
|
||
# Create the tmp dir for the test. If this does not exist OMEdit will try to | ||
# create it. However, if it fails to create it does not report anything and | ||
# that can be confusing. | ||
mkdir -p "$tmp_dir_for_test" | ||
|
||
# Save the current env tmp dirs | ||
ORIGINAL_TEMP=$TEMP | ||
ORIGINAL_TMP=$TMP | ||
ORIGINAL_TMPDIR=$TMPDIR | ||
NEW_TEMP=$OMEditTestResults/$testexe | ||
NEW_TMP=$OMEditTestResults/$testexe | ||
NEW_TMPDIR=$OMEditTestResults/$testexe | ||
export TEMP=$NEW_TEMP | ||
export TMP=$NEW_TMP | ||
export TMPDIR=$NEW_TMPDIR | ||
$testexe || $testexe || $testexe || $testexe || $testexe | ||
|
||
# Export the new tmp dirs for this test. | ||
export TEMP="$tmp_dir_for_test" | ||
export TMP="$tmp_dir_for_test" | ||
export TMPDIR="$tmp_dir_for_test" | ||
|
||
printf "Running testcase '%s' with tmp dir '%s'\n" "$test_exe_path" "$tmp_dir_for_test" | ||
$test_exe_path | ||
|
||
# Resotore the old env tmp dirs | ||
export TEMP=$ORIGINAL_TEMP | ||
export TMP=$ORIGINAL_TMP | ||
export TMPDIR=$ORIGINAL_TMPDIR |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters