summaryrefslogtreecommitdiff
path: root/tests/ubi-tests/runubitests.sh.in
diff options
context:
space:
mode:
authorDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-07-13 16:10:28 +0200
committerDavid Oberhollenzer <david.oberhollenzer@sigma-star.at>2016-11-17 11:36:55 +0100
commit8a00021b2ab5529640e5acaca30a27cdaca04178 (patch)
tree0944317c3e431143eedca84429348334a725e716 /tests/ubi-tests/runubitests.sh.in
parentd39ea7019cb204420c53a203ff9ccbb4cab0d4b3 (diff)
Integrate tests into autotools build system
Add automake files for the test binaries. If configured to do so, install the test binaries to libexec/mtd-utils and use autoconf to fix the paths in the test scripts. Signed-off-by: David Oberhollenzer <david.oberhollenzer@sigma-star.at> Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'tests/ubi-tests/runubitests.sh.in')
-rwxr-xr-xtests/ubi-tests/runubitests.sh.in42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/ubi-tests/runubitests.sh.in b/tests/ubi-tests/runubitests.sh.in
new file mode 100755
index 0000000..a1b23c4
--- /dev/null
+++ b/tests/ubi-tests/runubitests.sh.in
@@ -0,0 +1,42 @@
+#!/bin/sh -euf
+
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+bindir=@bindir@
+libexecpath=@libexecdir@/mtd-utils
+TESTBINDIR=@testbindir@
+
+tests="mkvol_basic mkvol_bad mkvol_paral rsvol io_basic io_read io_update io_paral volrefcnt"
+
+fatal()
+{
+ echo "Error: $1" 1>&2
+ echo "FAILURE"
+ exit 1
+}
+
+usage()
+{
+ cat 1>&2 <<EOF
+Run all UBI tests for on an UBI device.
+Usage:
+ ${0##*/} <UBI device node>
+Example:
+ ${0##*/} /dev/ubi1 - test /dev/ubi1.
+EOF
+}
+
+if [ "$#" -lt 1 ]; then
+ usage
+ exit 1
+fi
+
+ubidev="$1"
+[ -c "$ubidev" ] || fatal "$ubidev is not character device"
+
+for t in $tests; do
+ echo "Running $t $ubidev"
+ "$TESTBINDIR/$t" "$ubidev" || fatal "$t failed"
+done
+
+echo "SUCCESS"