diff options
author | ariel faigon <github.2009@yendor.com> | 2014-07-27 23:31:26 +0400 |
---|---|---|
committer | ariel faigon <github.2009@yendor.com> | 2014-07-27 23:31:26 +0400 |
commit | 30437e5e517deca5beb0738c408cc94594e948b0 (patch) | |
tree | f7cc867577e5aaf8f55e0b56fea3f25caf219187 | |
parent | 54ced6b028ff1dd1e619fbc4049b8d0b5cce8130 (diff) |
Add support for generic external tests or shell scripts; Add daemon test; Removenon-generic ezexample code (now supported in a nicer, generic way)
-rwxr-xr-x | test/RunTests | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/test/RunTests b/test/RunTests index 5b64bf84..c27b96a1 100755 --- a/test/RunTests +++ b/test/RunTests @@ -288,10 +288,6 @@ sub next_test() { } next; } - if ($line =~ /library\/ezexample_/) { - $cmd = trim_spaces($line); - next; - } if ($line =~ m/\.stdout\b/) { $out_ref = ref_file(trim_spaces($line)); next; @@ -304,10 +300,18 @@ sub next_test() { $pred_ref = ref_file(trim_spaces($line)); next; } + # A test can also be an arbitrary (shell) command line + # if the 1st non-space sequence is executable + my ($first_word) = ($line =~ /^\s*(\S+)/); + if (defined $first_word && -x $first_word) { + $cmd = trim_spaces($line); + next; + } # if we get here it is some unrecognized pattern printf STDERR "Unrecognized test spec line:\n\t%s\n", $line; print STDERR "Test lines must match one of the following patterns:\n"; - print STDERR "\tCommand to run: {VW}\n"; + print STDERR "\tshell command to run\n"; + print STDERR "\tvw command to run: {VW} ...\n"; print STDERR "\tstdout reference: *.stdout\n"; print STDERR "\tstderr reference: *.stderr\n"; print STDERR "\tpredict reference: *.predict\n"; @@ -315,12 +319,12 @@ sub next_test() { if (eof(DATA) && !defined $cmd) { return (undef, undef, undef, undef); } - unless (defined $cmd) { die "$0: test $TestNo: command is undefined\n"; } unless (defined $err_ref) { - die "$0: test $TestNo: stderr ref: undefined\n"; + v(2, "%s: test %s: stderr ref: undefined\n", $0, $TestNo); + $err_ref = '/dev/null'; } # print STDERR "next_test: (\$cmd, $out_ref, $err_ref, $pred_ref, $pred)\n"; if ($opt_V) { @@ -1029,3 +1033,8 @@ __DATA__ ../library/ezexample_predict models/library_train.w train-sets/ref/ezexample_predict.stdout train-sets/ref/ezexample_predict.stderr + +# Test 67: daemon test +daemon-test.sh + test-sets/ref/vw-daemon.stdout + |