summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaciej Żenczykowski <maze@google.com>2019-03-22 19:58:51 -0700
committerMaciej Żenczykowski <maze@google.com>2019-03-22 20:02:10 -0700
commit789dcf76b65405714d3b6e306d75edf59348ad6d (patch)
treebeb3e474dafa0d02b91bf063bba2915611c8567e
parent2afd2efd8359ad6147d66cc237be1725ad1186ea (diff)
downloadtests-789dcf76b65405714d3b6e306d75edf59348ad6d.tar.gz
net-test: rootfs/net_test.sh - minor stylistic fixes
Google shell style guide: https://google.github.io/styleguide/shell.xml says to always use "${x}" instead of $x, and in general to double quote everything (fixes issues with whitespace in variable expansions). Similarly [[ is bash builtin, unlike [ or test. Bug: 126465735 Signed-off-by: Maciej Żenczykowski <maze@google.com> Change-Id: I507ceb630e7dd7347783e499826dcce2c2c50ee5
-rwxr-xr-xnet/test/rootfs/net_test.sh6
1 files changed, 3 insertions, 3 deletions
diff --git a/net/test/rootfs/net_test.sh b/net/test/rootfs/net_test.sh
index b4f1f4d..34f4a01 100755
--- a/net/test/rootfs/net_test.sh
+++ b/net/test/rootfs/net_test.sh
@@ -25,13 +25,13 @@ mount -t tmpfs tmpfs /run
# If this system was booted under UML, it will always have a /proc/exitcode
# file. If it was booted natively or under QEMU, it will not have this file.
-if [ -e /proc/exitcode ]; then
+if [[ -e /proc/exitcode ]]; then
mount -t hostfs hostfs /host
else
mount -t 9p -o trans=virtio,version=9p2000.L host /host
fi
-test=$(cat /proc/cmdline | sed -re 's/.*net_test=([^ ]*).*/\1/g')
-cd $(dirname $test)
+test="$(sed -r 's/.*net_test=([^ ]*).*/\1/g' < /proc/cmdline)"
+cd "$(dirname "${test}")"
./net_test.sh
poweroff -f