run_net_test.sh: switch to readonly by default
And also add support for --readwrite --rw --ro flags.
Read only by default is better cause it allows multiple parallel
invocations making use of the same image.
Read write access to the file system is only occasionally useful,
and can always be requested by hand.
While I'm at it, change some occurences of [ to [[ to honour
Google's shell style guide:
https://google.github.io/styleguide/shell.xml.
Change-Id: I94ac0d9d05470bfd5e62465454c398174d644e5b
diff --git a/net/test/parallel_tests.sh b/net/test/parallel_tests.sh
index 93a43c8..eb67421 100755
--- a/net/test/parallel_tests.sh
+++ b/net/test/parallel_tests.sh
@@ -15,7 +15,7 @@
local test=$3
local j=0
while ((j < runs)); do
- $DIR/run_net_test.sh --readonly --builder --nobuild $test \
+ $DIR/run_net_test.sh --builder --nobuild $test \
> /dev/null 2> $RESULTSDIR/results.$worker.$j
j=$((j + 1))
echo -n "." >&2
diff --git a/net/test/run_net_test.sh b/net/test/run_net_test.sh
index 1768832..384a097 100755
--- a/net/test/run_net_test.sh
+++ b/net/test/run_net_test.sh
@@ -89,22 +89,25 @@
netconfig=
testmode=
cmdline=
-nowrite=0
+nowrite=1
nobuild=0
norun=0
-while [ -n "$1" ]; do
- if [ "$1" = "--builder" ]; then
+while [[ -n "$1" ]]; do
+ if [[ "$1" == "--builder" ]]; then
consolemode="con=null,fd:1"
testmode=builder
shift
- elif [ "$1" == "--readonly" ]; then
+ elif [[ "$1" == "--readwrite" || "$1" == "--rw" ]]; then
+ nowrite=0
+ shift
+ elif [[ "$1" == "--readonly" || "$1" == "--ro" ]]; then
nowrite=1
shift
- elif [ "$1" == "--nobuild" ]; then
+ elif [[ "$1" == "--nobuild" ]]; then
nobuild=1
shift
- elif [ "$1" == "--norun" ]; then
+ elif [[ "$1" == "--norun" ]]; then
norun=1
shift
else
@@ -138,7 +141,7 @@
if ! isRunningTest && ! isBuildOnly; then
echo "Usage:" >&2
- echo " $0 [--builder] [--readonly] [--nobuild] <test>" >&2
+ echo " $0 [--builder] [--readonly|--ro|--readwrite|--rw] [--nobuild] <test>" >&2
echo " $0 --norun" >&2
exit 1
fi