From 8416a649a344d5225ae80c99338167f0f436999c Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 31 Dec 2004 07:42:50 +0000 Subject: [PATCH] Improve command-line interface to run-tests. --- grading/filesys/run-tests | 24 ++++++++++------------- grading/lib/Pintos/Grading.pm | 14 +++++++++++--- grading/threads/run-tests | 18 +++++++----------- grading/userprog/run-tests | 36 +++++++++++++++++------------------ grading/vm/run-tests | 11 +++++------ 5 files changed, 51 insertions(+), 52 deletions(-) diff --git a/grading/filesys/run-tests b/grading/filesys/run-tests index 0f1f8eb..143ab4a 100755 --- a/grading/filesys/run-tests +++ b/grading/filesys/run-tests @@ -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'; diff --git a/grading/lib/Pintos/Grading.pm b/grading/lib/Pintos/Grading.pm index 3ebeb22..d48b275 100644 --- a/grading/lib/Pintos/Grading.pm +++ b/grading/lib/Pintos/Grading.pm @@ -13,13 +13,15 @@ our $action; our $hw; use POSIX; -use Getopt::Long; +use Getopt::Long qw(:config no_ignore_case); use Algorithm::Diff; 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). diff --git a/grading/threads/run-tests b/grading/threads/run-tests index 096bec0..931edb6 100755 --- a/grading/threads/run-tests +++ b/grading/threads/run-tests @@ -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'; diff --git a/grading/userprog/run-tests b/grading/userprog/run-tests index afb9317..3019d30 100755 --- a/grading/userprog/run-tests +++ b/grading/userprog/run-tests @@ -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'; diff --git a/grading/vm/run-tests b/grading/vm/run-tests index c04faea..5aa8a44 100755 --- a/grading/vm/run-tests +++ b/grading/vm/run-tests @@ -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'; -- 2.30.2