--- /dev/null
+package Pintos::Grading;
+use Exporter 'import';
+
+@EXPORT = qw($verbose $action);
+
+use warnings;
+use strict;
+use Getopt::Long;
+
+
+
+1;
#! /usr/bin/perl
+# Find the directory that contains the grading files.
+our ($GRADES_DIR);
+
+# Add our Perl library directory to the include path.
+BEGIN {
+ ($GRADES_DIR = $0) =~ s#/[^/]+$##;
+ -d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
+ unshift @INC, "$GRADES_DIR/../lib";
+}
+
use warnings;
use strict;
use POSIX;
my ($exitcode) = @_;
print "run-tests, for grading Pintos thread projects.\n\n";
print "Invoke from a directory containing a student tarball named by\n";
- print "the submit script, e.g. username.Oct.12.04.20.04.09.tar.gz.\n";
+ print "the submit script, e.g. username.MMM.DD.YY.hh.mm.ss.tar.gz.\n";
print "In normal usage, no options are needed.\n\n";
print "Output is produced in tests.out and details.out.\n\n";
print "Options:\n";
exit 0;
}
-# Find the directory that contains the grading files.
-our ($GRADES_DIR);
-($GRADES_DIR = $0) =~ s#/[^/]+$##;
--d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
-
if ($clean) {
# Verify that we're roughly in the correct directory
# before we go blasting away files.
#! /usr/bin/perl
+# Find the directory that contains the grading files.
+our ($GRADES_DIR);
+
+# Add our Perl library directory to the include path.
+BEGIN {
+ ($GRADES_DIR = $0) =~ s#/[^/]+$##;
+ -d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
+ unshift @INC, "$GRADES_DIR/../lib";
+}
+
use warnings;
use strict;
use POSIX;
exit 0;
}
-# Find the directory that contains the grading files.
-our ($GRADES_DIR);
-($GRADES_DIR = $0) =~ s#/[^/]+$##;
--d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
-
if ($clean) {
# Verify that we're roughly in the correct directory
# before we go blasting away files.
# Find the directory that contains the grading files.
our ($GRADES_DIR);
+# Add our Perl library directory to the include path.
BEGIN {
($GRADES_DIR = $0) =~ s#/[^/]+$##;
-d $GRADES_DIR or die "$GRADES_DIR: stat: $!\n";
use Algorithm::Diff;
use Getopt::Long;
-our ($VERBOSE) = 0; # Verbosity of output
+our ($verbose) = 0; # Verbosity of output
our (@TESTS); # Tests to run.
my ($clean) = 0;
my ($grade) = 0;
-GetOptions ("v|verbose+" => \$VERBOSE,
+GetOptions ("v|verbose+" => \$verbose,
"h|help" => sub { usage (0) },
"t|test=s" => \@TESTS,
"c|clean" => \$clean,
\f
sub xsystem {
my ($command, %options) = @_;
- print "$command\n" if $VERBOSE || $options{VERBOSE};
+ print "$command\n" if $verbose || $options{VERBOSE};
my ($log) = $options{LOG};