Apply appropriate changes from main branch to bring win0405-branch up
[pintos-anon] / grading / threads / run-tests
index 931edb6022bada88172a518e6612c2ca87853ae3..dd2e7d3de52c843656aaf1d5549ebfbd5639cdfd 100755 (executable)
@@ -37,15 +37,17 @@ exit if $action eq 'extract';
 build (); 
 exit if $action eq 'build';
 
-run_and_grade_tests (); 
-grade_mlfqs_speedup ();
-grade_mlfqs_priority ();
+run_and_grade_tests ();
+if (defined ($result{'mlfqs-on'}) && defined ($result{'mlfqs-off'})) {
+    grade_mlfqs_speedup ();
+    grade_mlfqs_priority ();
+}
 write_grades (); 
 write_details ();
-exit if $action eq 'test';
+exit success () if $action eq 'test';
 
 assemble_final_grade ();
-exit if $action eq 'assemble';
+exit success () if $action eq 'assemble';
 
 die "Don't know how to '$action'";
 
@@ -54,6 +56,7 @@ die "Don't know how to '$action'";
 sub run_test {
     # Change constants.h if necessary.
     my ($defines) = $test ne 'mlfqs-on' ? "" : "#define MLFQS 1\n";
+    $defines .= "#define THREAD_JOIN_IMPLEMENTED 1\n";
     if ($defines ne snarf ("pintos/src/constants.h")) {
        open (CONSTANTS, ">pintos/src/constants.h");
        print CONSTANTS $defines;
@@ -92,8 +95,9 @@ sub run_test {
     xsystem ("cp pintos/src/threads/build/os.dsk output/$test");
 
     # Run.
-    my ($timeout) = $test !~ /^mlfqs/ ? 10 : 600;
-    return run_pintos ("cd pintos/src/threads/build && pintos -v run -q",
+    my ($timeout) = $test !~ /^mlfqs/ ? 15 : 600;
+    return run_pintos (["-v", "run", "-q"],
+                      CHDIR => "pintos/src/threads/build",
                       LOG => "$test/run",
                       TIMEOUT => $timeout);
 }