diff options
-rwxr-xr-x | net/test/net_test.sh | 4 | ||||
-rwxr-xr-x | net/test/run_net_test.sh | 18 |
2 files changed, 19 insertions, 3 deletions
diff --git a/net/test/net_test.sh b/net/test/net_test.sh index abd0f76a..bade6dee 100755 --- a/net/test/net_test.sh +++ b/net/test/net_test.sh @@ -19,8 +19,8 @@ if [ "$net_test_mode" != "builder" ]; then trap "exec /bin/bash" ERR EXIT fi -echo -e "Running $net_test\n" -$net_test +echo -e "Running $net_test $net_test_args\n" +$net_test $net_test_args # Write exit code of net_test to /proc/exitcode so that the builder can use it # to signal failure if any tests fail. diff --git a/net/test/run_net_test.sh b/net/test/run_net_test.sh index cc276d89..6179b288 100755 --- a/net/test/run_net_test.sh +++ b/net/test/run_net_test.sh @@ -83,10 +83,25 @@ while [ -n "$1" ]; do shift else test=$1 - break # The test file must be the last argument. + break # Arguments after the test file are passed to the test itself. fi done +# Check that test file exists and is readable +test_file=$SCRIPT_DIR/$test +if [[ ! -e $test_file ]]; then + echo "test file '${test_file}' does not exist" + exit 1 +fi + +if [[ ! -x $test_file ]]; then + echo "test file '${test_file}' is not executable" + exit 1 +fi + +# Collect trailing arguments to pass to $test +test_args=${@:2} + function isRunningTest() { [[ -n "$test" ]] && ! (( norun )) } @@ -191,4 +206,5 @@ dir=/host$SCRIPT_DIR # Start the VM. exec $KERNEL_BINARY umid=net_test $blockdevice=$SCRIPT_DIR/$ROOTFS \ mem=512M init=/sbin/net_test.sh net_test=$dir/$test \ + net_test_args=\"$test_args\" \ net_test_mode=$testmode $netconfig $consolemode >&2 |