summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-08-02 17:38:05 +0300
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2012-08-02 17:38:28 +0300
commit669ec176fe602a303f5fa1ea526273748c6d6f5f (patch)
treee34b7c521fefe7d4129e2121ad2372f0a77f8453
parentd7f1b2f9abde75b88e69490d619857c82e7e3517 (diff)
tests: ubi: clean-up the runtests.sh script
Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rwxr-xr-xtests/ubi-tests/runtests.sh42
1 files changed, 14 insertions, 28 deletions
diff --git a/tests/ubi-tests/runtests.sh b/tests/ubi-tests/runtests.sh
index 708cce4..5bd9baa 100755
--- a/tests/ubi-tests/runtests.sh
+++ b/tests/ubi-tests/runtests.sh
@@ -1,39 +1,25 @@
-#!/bin/sh
+#!/bin/sh -euf
ubidev="$1"
-tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update
-io_paral volrefcnt"
+tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update io_paral volrefcnt"
-if test -z "$ubidev";
-then
- echo "Usage:"
- echo "$0 <UBI device>"
+fatal()
+{
+ echo "Error: $1" 2>&1
exit 1
-fi
-
-ubiname=`echo $ubidev | cut -d/ -f3`
+}
-major=`cat /sys/class/ubi/$ubiname/dev | cut -d: -f1`
-
-for minor in `seq 0 4`; do
- if test ! -e ${ubidev}_${minor} ;
- then
- mknod ${ubidev}_${minor} c $major $(($minor + 1))
- fi
-done
-
-if ! test -c "$ubidev";
-then
- echo "Error: $ubidev is not character device"
+if [ -z "$ubidev" ]; then
+ echo "Usage:" 2>&1
+ echo "$0 <UBI device>"
exit 1
fi
-for t in `echo $tests`;
-do
+[ -c "$ubidev" ] || fatal "$ubidev is not character device"
+
+for t in $tests; do
echo "Running $t $ubidev"
- "./$t" "$ubidev" || exit 1
+ "./$t" "$ubidev" || fatal "$t failed"
done
-echo SUCCESS
-
-exit 0
+echo "SUCCESS"