X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=grading%2Fthreads%2Frun-tests;h=1e718a93b6b151179b33556aa8ab8144165e154e;hb=64e9bcdf25636d647d18f6a584aa5f87e212f0da;hp=4199d94214f09b9b61348ff487f620937ea39dcd;hpb=b01246f0f671f8e5ac32b329b5cf62d5413f90d3;p=pintos-anon diff --git a/grading/threads/run-tests b/grading/threads/run-tests index 4199d94..1e718a9 100755 --- a/grading/threads/run-tests +++ b/grading/threads/run-tests @@ -44,10 +44,10 @@ if (defined ($result{'mlfqs-on'}) && defined ($result{'mlfqs-off'})) { } 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'"; @@ -64,13 +64,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. @@ -94,8 +105,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); }