projects
/
pintos-anon
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Improve error message for grading when the make failed.
[pintos-anon]
/
grading
/
lib
/
Pintos
/
Grading.pm
diff --git
a/grading/lib/Pintos/Grading.pm
b/grading/lib/Pintos/Grading.pm
index 3ebeb223b6a7ee53f5b7c6f11e943c2010075156..36599a0afbdd9957374843f0d50ee314d629a52c 100644
(file)
--- a/
grading/lib/Pintos/Grading.pm
+++ b/
grading/lib/Pintos/Grading.pm
@@
-13,13
+13,15
@@
our $action;
our $hw;
use POSIX;
our $hw;
use POSIX;
-use Getopt::Long;
+use Getopt::Long
qw(:config no_ignore_case)
;
use Algorithm::Diff;
\f
sub parse_cmd_line {
use Algorithm::Diff;
\f
sub parse_cmd_line {
+ my ($do_regex, $no_regex);
GetOptions ("v|verbose+" => \$verbose,
"h|help" => sub { usage (0) },
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'); },
"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';
}
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 {
}
sub set_action {
@@
-70,7
+77,8
@@
Workflow:
Options:
-c, --clean Delete test results and temporary files, then exit.
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).
-x, --extract Stop after step 1.
-b, --build Stop after step 2.
-t, --test Stop after step 3 (default if "review.txt" not present).
@@
-400,7
+408,9
@@
sub run_pintos {
# Grade the test.
sub grade_test {
# Read test output.
# Grade the test.
sub grade_test {
# Read test output.
- my (@output) = snarf ("output/$test/run.out");
+ my ($outfile) = "output/$test/run.out";
+ die "$outfile: missing test output file (make failed?)" if ! -e $outfile;
+ my (@output) = snarf ($outfile);
# If there's a function "grade_$test", use it to evaluate the output.
# If there's a file "$GRADES_DIR/$test.exp", compare its contents
# If there's a function "grade_$test", use it to evaluate the output.
# If there's a file "$GRADES_DIR/$test.exp", compare its contents