[Omake] Re: Tests

David Kågedal davidk at lysator.liu.se
Tue Jun 5 03:03:23 PDT 2007


David Kågedal <davidk at lysator.liu.se> writes:

> There is a directory called "tests" in the distribution, and in the
> 0.9.8.x svn branch.  But there isn't very much in it.  And I don't see
> any way to run all the tests.
>
> I whipped up a quick osh script that will run  all tests and print
> FAILED if the exit status wasn't 0.  It scans for files or directories
> called Test or Test1..Test9.  For files, it runs them through osh, and
> for directories it cd's to them and runs omake.

This is an updated patch.  Please consider adding this to the
repository, and maybe even start using the test cases.  Currently,
many of them are broken.

The diff was greated by git, but that shouldn't cause any problems.

diff --git a/tests/runall.osh b/tests/runall.osh
new file mode 100644
index 0000000..60587a0
--- /dev/null
+++ b/tests/runall.osh
@@ -0,0 +1,34 @@
+# -*- Makefile -*-
+
+dirname(seq) =
+    X =
+	foreach(x, $(seq))
+	    d = $(dirof $x)
+	    if $(equal $x, $d)
+		d = $(string $(dir $(d)/..))
+		export
+            value $d
+    return $X
+
+TESTDIRS = $(set $(dirname $(glob */Test*)))
+
+runtest(subtest) =
+    if $(test -f $(subtest))
+        res = $(shell-code osh $(subtest) >& $(resultfile))
+        export res
+    else
+	cd $(subtest)
+	res = $(shell-code omake >& $(resultfile))
+        export res
+    return$(equal $(res), 0)
+
+foreach(testdir, $(TESTDIRS))
+    echo "Testing $(testdir)"
+    cd $(testdir)
+    subtests = $(filter-exists Test)
+    subtests += $(glob i, Test[1-9])
+    foreach(subtest, $(subtests))
+        echo "  ... $(subtest)"
+	resultfile = $(file $(subtest).result)
+	if $(not $(runtest $(subtest)))
+            echo "      FAILED"

-- 
David Kågedal



More information about the Omake mailing list