Improve command-line interface to run-tests.
authorBen Pfaff <blp@cs.stanford.edu>
Fri, 31 Dec 2004 07:42:50 +0000 (07:42 +0000)
committerBen Pfaff <blp@cs.stanford.edu>
Fri, 31 Dec 2004 07:42:50 +0000 (07:42 +0000)
grading/filesys/run-tests
grading/lib/Pintos/Grading.pm
grading/threads/run-tests
grading/userprog/run-tests
grading/vm/run-tests

index 0f1f8ebd51c3d68981ad7b5e5976dd44c0358441..143ab4a0de904664a237e28d556a1abdf3b35e88 100755 (executable)
@@ -19,24 +19,20 @@ our (@TESTS);               # Tests to run.
 our ($test);
 our ($action);
 
-parse_cmd_line ();
+parse_cmd_line qw (sm-create sm-full sm-seq-block sm-seq-random sm-random
 
-# Default set of tests.
-@TESTS = qw (sm-create sm-full sm-seq-block sm-seq-random sm-random
+                  lg-create lg-full lg-seq-block lg-seq-random lg-random
 
-            lg-create lg-full lg-seq-block lg-seq-random lg-random
+                  grow-create grow-seq-sm grow-seq-lg grow-file-size grow-tell
+                  grow-sparse grow-too-big grow-root-sm grow-root-lg
+                  grow-dir-lg grow-two-files
 
-            grow-create grow-seq-sm grow-seq-lg grow-file-size grow-tell
-            grow-sparse grow-too-big grow-root-sm grow-root-lg grow-dir-lg 
-            grow-two-files
+                  dir-mkdir dir-rmdir dir-mk-vine dir-rm-vine dir-mk-tree
+                  dir-rm-tree dir-lsdir dir-rm-cwd dir-rm-cwd-cd
+                  dir-rm-parent dir-rm-root dir-over-file dir-under-file
+                  dir-empty-name dir-open
 
-            dir-mkdir dir-rmdir dir-mk-vine dir-rm-vine dir-mk-tree
-            dir-rm-tree dir-lsdir dir-rm-cwd dir-rm-cwd-cd
-            dir-rm-parent dir-rm-root dir-over-file dir-under-file
-            dir-empty-name dir-open
-
-            syn-remove syn-read syn-write syn-rw
-            ) unless @TESTS > 0;
+                  syn-remove syn-read syn-write syn-rw);
 
 clean_dir (), exit if $action eq 'clean';
 
index 3ebeb223b6a7ee53f5b7c6f11e943c2010075156..d48b2751c92219f4a1b55f3771d0e2a9cc657cd0 100644 (file)
@@ -13,13 +13,15 @@ our $action;
 our $hw;
 
 use POSIX;
-use Getopt::Long;
+use Getopt::Long qw(:config no_ignore_case);
 use Algorithm::Diff;
 \f
 sub parse_cmd_line {
+    my ($do_regex, $no_regex);
     GetOptions ("v|verbose+" => \$verbose,
                "h|help" => sub { usage (0) },
-               "tests=s" => \@TESTS,
+               "d|do-tests=s" => \$do_regex,
+               "n|no-tests=s" => \$no_regex,
                "c|clean" => sub { set_action ('clean'); },
                "x|extract" => sub { set_action ('extract'); },
                "b|build" => sub { set_action ('build'); },
@@ -33,6 +35,11 @@ sub parse_cmd_line {
     if (!defined $action) {
        $action = -e 'review.txt' ? 'assemble' : 'test';
     }
+
+    my (@default_tests) = @_;
+    @TESTS = @default_tests;
+    @TESTS = grep (/$do_regex/, @TESTS) if defined $do_regex;
+    @TESTS = grep (!/$no_regex/, @TESTS) if defined $no_regex;
 }
 
 sub set_action {
@@ -70,7 +77,8 @@ Workflow:
 
 Options:
   -c, --clean        Delete test results and temporary files, then exit.
-  --tests=TESTS      Run only the specified comma-separated tests.
+  -d, --do-tests=RE  Run only tests that match the given regular expression.
+  -n, --no-tests=RE  Do not run tests that match the given regular expression.
   -x, --extract      Stop after step 1.
   -b, --build        Stop after step 2.
   -t, --test         Stop after step 3 (default if "review.txt" not present).
index 096bec0a08285bbf8cc034da210154661680d10d..931edb6022bada88172a518e6612c2ca87853ae3 100755 (executable)
@@ -21,17 +21,13 @@ our (%details);
 our (%result);
 our ($action);
 
-parse_cmd_line ();
-
-# Default set of tests.
-@TESTS = ("alarm-single", "alarm-multiple", "alarm-zero", "alarm-negative",
-         "join-simple",
-         "join-quick", "join-multiple", "join-nested",
-         "join-dummy", "join-invalid", "join-no",
-         "priority-preempt", "priority-fifo", "priority-donate-one",
-         "priority-donate-multiple", "priority-donate-nest",
-         "mlfqs-on", "mlfqs-off")
-    unless @TESTS > 0;
+parse_cmd_line qw (alarm-single alarm-multiple alarm-zero alarm-negative
+                  join-simple
+                  join-quick join-multiple join-nested
+                  join-dummy join-invalid join-no
+                  priority-preempt priority-fifo priority-donate-one
+                  priority-donate-multiple priority-donate-nest
+                  mlfqs-on mlfqs-off);
 
 clean_dir (), exit if $action eq 'clean';
 
index afb9317ee357b30a389e4742753334fe8009fe85..3019d30c5d4a7dcacbcc5698f443a7dbb715c956 100755 (executable)
@@ -20,26 +20,26 @@ our ($test);
 our (%extra);
 our ($action);
 
-parse_cmd_line ();
+parse_cmd_line qw (args-argc args-argv0 args-argvn args-single args-multiple
+                  args-dbl-space
+                  sc-bad-sp sc-bad-arg sc-boundary
+                  halt exit
+                  create-normal create-empty create-null create-bad-ptr 
+                  create-long create-exists create-bound
+                  open-normal open-missing open-boundary open-empty open-null
+                  open-bad-ptr open-twice
+                  close-normal close-twice close-stdin close-stdout
+                  close-bad-fd
+                  read-normal read-bad-ptr read-boundary read-zero read-stdout
+                  read-bad-fd
+                  write-normal write-bad-ptr write-boundary write-zero
+                  write-stdin write-bad-fd
+                  exec-once exec-arg exec-multiple exec-missing exec-bad-ptr
+                  join-simple join-twice join-killed join-bad-pid
+                  multi-recurse multi-oom multi-child-fd);
 
 # Default set of tests.
-@TESTS = qw (args-argc args-argv0 args-argvn args-single args-multiple
-            args-dbl-space
-            sc-bad-sp sc-bad-arg sc-boundary
-            halt exit
-            create-normal create-empty create-null create-bad-ptr 
-            create-long create-exists create-bound
-            open-normal open-missing open-boundary open-empty open-null
-            open-bad-ptr open-twice
-            close-normal close-twice close-stdin close-stdout close-bad-fd
-            read-normal read-bad-ptr read-boundary read-zero read-stdout
-            read-bad-fd
-            write-normal write-bad-ptr write-boundary write-zero write-stdin
-            write-bad-fd
-            exec-once exec-arg exec-multiple exec-missing exec-bad-ptr
-            join-simple join-twice join-killed join-bad-pid
-            multi-recurse multi-oom multi-child-fd
-            ) unless @TESTS > 0;
+@TESTS =  unless @TESTS > 0;
 
 clean_dir (), exit if $action eq 'clean';
 
index c04faea87af0753035e93351e8fc0dd6681de766..5aa8a44644ee1faa5093ce625907ab4125238ac9 100755 (executable)
@@ -19,14 +19,13 @@ our (@TESTS);               # Tests to run.
 our ($test);
 our ($action);
 
-parse_cmd_line ();
+parse_cmd_line qw (pt-grow-stack pt-big-stk-obj pt-bad-addr pt-write-code
+                  page-linear page-parallel page-merge-seq page-merge-par
+                  page-shuffle mmap-read mmap-close mmap-unmap mmap-overlap
+                  mmap-twice mmap-write mmap-exit mmap-shuffle);
 
 # Default set of tests.
-@TESTS = qw (pt-grow-stack pt-big-stk-obj pt-bad-addr pt-write-code
-            page-linear page-parallel page-merge-seq page-merge-par
-            page-shuffle mmap-read mmap-close mmap-unmap mmap-overlap
-            mmap-twice mmap-write mmap-exit mmap-shuffle
-           ) unless @TESTS > 0;
+@TESTS =  unless @TESTS > 0;
 
 clean_dir (), exit if $action eq 'clean';