Author: glen
Date: Wed Oct 20 22:36:41 2010
New Revision: 11861

Added:
   geninitrd/trunk/tests/setup-test.sh
Modified:
   geninitrd/trunk/tests/lvmroot.sh
Log:
- setup common test base

Modified: geninitrd/trunk/tests/lvmroot.sh
==============================================================================
--- geninitrd/trunk/tests/lvmroot.sh    (original)
+++ geninitrd/trunk/tests/lvmroot.sh    Wed Oct 20 22:36:41 2010
@@ -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 @@
                        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

Added: geninitrd/trunk/tests/setup-test.sh
==============================================================================
--- (empty file)
+++ geninitrd/trunk/tests/setup-test.sh Wed Oct 20 22:36:41 2010
@@ -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
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to