Skip to content

Commit

Permalink
external/tests: Add a data directory for tests
Browse files Browse the repository at this point in the history
Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
Signed-off-by: Stewart Smith <stewart@linux.vnet.ibm.com>
  • Loading branch information
cyrilbur-ibm authored and stewartsmith committed Mar 24, 2017
1 parent efb9ae7 commit e53cf9e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions external/test/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ run_binary() {
}

fail_test() {
rm -rf "$STDERR_OUT";
rm -rf "$STDOUT_OUT";
echo "$0 ($CUR_TEST): test failed";
exit ${1:-1};
}
Expand Down Expand Up @@ -60,8 +58,8 @@ diff_with_result() {
}

run_tests() {
if [ $# -ne 2 ] ; then
echo "Usage run_tests test_dir result_dir";
if [ $# -lt 2 ] ; then
echo "Usage run_tests test_dir result_dir [data_dir]";
exit 1;
fi

Expand All @@ -75,6 +73,10 @@ run_tests() {

export STDERR_OUT=$(mktemp --tmpdir external-test-stderr.XXXXXX);
export STDOUT_OUT=$(mktemp --tmpdir external-test-stdout.XXXXXX);
export DATA_DIR=$(mktemp --tmpdir -d external-test-datadir.XXXXXX);
if [ $# -eq 3 ] ; then
cp -r $3/* "$DATA_DIR"
fi


for the_test in $all_tests; do
Expand All @@ -93,6 +95,7 @@ run_tests() {

rm -rf $STDERR_OUT;
rm -rf $STDOUT_OUT;
rm -rf $DATA_DIR;

echo "$0 tests passed"

Expand Down

0 comments on commit e53cf9e

Please sign in to comment.