X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fthreads%2Frun-tests;h=dc8e46f6ef8b7b19095b4130359e0fcf58e43d5c;hb=15c9fb6dabbf4425d123e5e828cc9e4f247b31a7;hp=37bc6594f823f8e9ca0d9927ffcf52345ba03c40;hpb=aa611970d5cbcfd5b0170c03effd74c2cab05708;p=pintos-anon diff --git a/grading/threads/run-tests b/grading/threads/run-tests index 37bc659..dc8e46f 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'; @@ -41,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'"; @@ -58,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; @@ -66,13 +65,24 @@ sub run_test { # Changes devices/timer.c if necessary. my ($new_time_slice) = $test eq 'priority-fifo' ? 100 : 1; - my (@timer) = snarf ("pintos/src/devices/timer.c"); - if (!grep (/^\#define TIME_SLICE $new_time_slice$/, @timer)) { - @timer = grep (!/^\#define TIME_SLICE/, @timer); - unshift (@timer, "#define TIME_SLICE $new_time_slice"); - open (TIMER, ">pintos/src/devices/timer.c"); - print TIMER map ("$_\n", @timer); - close (TIMER); + my (@timer_c) = snarf ("pintos/src/devices/timer.c"); + if (!grep (/^\#define TIME_SLICE $new_time_slice$/, @timer_c)) { + @timer_c = grep (!/^\#define TIME_SLICE/, @timer_c); + unshift (@timer_c, "#define TIME_SLICE $new_time_slice"); + open (TIMER_C, ">pintos/src/devices/timer.c"); + print TIMER_C map ("$_\n", @timer_c); + close (TIMER_C); + } + + # Changes devices/timer.h if necessary. + my ($new_timer_freq) = $test eq 'priority-fifo' ? 19 : 100; + my (@timer_h) = snarf ("pintos/src/devices/timer.h"); + if (!grep (/^\#define TIMER_FREQ $new_time_slice$/, @timer_h)) { + @timer_h = grep (!/^\#define TIMER_FREQ/, @timer_h); + unshift (@timer_h, "#define TIMER_FREQ $new_timer_freq"); + open (TIMER_H, ">pintos/src/devices/timer.h"); + print TIMER_H map ("$_\n", @timer_h); + close (TIMER_H); } # Copy in the new test.c and delete enough files to ensure a full rebuild. @@ -96,8 +106,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); } @@ -125,7 +136,7 @@ sub verify_alarm { local ($_); foreach (@output) { - die $_ if /Out of order/; + die $_ if /out of order/i; my ($p) = /product=(\d+)$/; next if !defined $p;