]> git.pld-linux.org Git - projects/geninitrd.git/commitdiff
- setup common test base
authorElan Ruusamäe <glen@pld-linux.org>
Wed, 20 Oct 2010 20:36:41 +0000 (20:36 +0000)
committerElan Ruusamäe <glen@pld-linux.org>
Wed, 20 Oct 2010 20:36:41 +0000 (20:36 +0000)
svn-id: @11861

tests/lvmroot.sh
tests/setup-test.sh [new file with mode: 0644]

index 68dd3456478de210223b64ca2ddb94e7a1c4539f..b6b4d22944e5853382fc612fa61a3d09315e5100 100755 (executable)
@@ -1,4 +1,6 @@
 #!/bin/sh
+. ./setup-test.sh
+
 runtest_run() {
                        # parse rootdev from kernel commandline if it begins with /
                        case "$ROOT" in
@@ -32,26 +34,6 @@ runtest_run() {
                        esac
 }
 
-fail=0 ok=0
-fail() {
-       echo "FAIL: $@"
-       fail=$((fail+1))
-       return 1
-}
-ok() {
-       echo "OK: $@"
-       ok=$((ok+1))
-       return 0
-}
-runtest() {
-       local exp=$(mktemp) out=$(mktemp)
-       cat > $exp
-       eval $@
-       runtest_run > $out
-       diff -u $out $exp || fail "$@" && ok "$@\n$(cat $exp)"
-       rm -f $exp $out
-}
-
 runtest ROOT=/dev/mapper/sys-rootfs OK=/dev/sys/rootfs <<'EOF'
 LVM: Using 'root=/dev/sys/rootfs' from kernel commandline
 LVM: Using Volume Group 'sys' for rootfs
diff --git a/tests/setup-test.sh b/tests/setup-test.sh
new file mode 100644 (file)
index 0000000..82a0f91
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+
+# this should be overriden by test
+runtest_run() {
+       :
+}
+
+fail=0 ok=0
+fail() {
+       echo "FAIL: $@"
+       fail=$((fail+1))
+       return 1
+}
+ok() {
+       echo "OK: $@"
+       ok=$((ok+1))
+       return 0
+}
+runtest() {
+       local exp=$(mktemp) out=$(mktemp)
+       cat > $exp
+       eval $@
+       runtest_run > $out
+       diff -u $out $exp || fail "$@" && ok "$@\n$(cat $exp)"
+       rm -f $exp $out
+}
+
+# here should be tests
This page took 0.207481 seconds and 4 git commands to generate.