diff options
author | Joel Scherpelz <jscherpelz@google.com> | 2017-02-24 01:52:06 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-02-24 01:52:06 +0000 |
commit | c2f49accd6434700a5196eb987f206b6878e307d (patch) | |
tree | ff9cb26861c9b22ab471f75cbd4c7b52ce9c9e61 | |
parent | d57164095792ac16c1e8b1fc69e0e97619b01116 (diff) | |
parent | de316e86951d6765f7e17b0462b15e3a2fa4865b (diff) | |
download | tests-c2f49accd6434700a5196eb987f206b6878e307d.tar.gz |
Extend run_net_test.sh to allow passing arguments to individual tests
am: de316e8695
Change-Id: I3587cd4591eae9e35227bbc2d59e55d15cbb5cac
-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 abd0f76..bade6de 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 cc276d8..6179b28 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 |