From 15c9fb6dabbf4425d123e5e828cc9e4f247b31a7 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Tue, 15 Feb 2005 04:59:40 +0000 Subject: [PATCH] Use TIMER_FREQ of 19 for grading priority-fifo. --- grading/threads/run-tests | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/grading/threads/run-tests b/grading/threads/run-tests index dd2e7d3..dc8e46f 100755 --- a/grading/threads/run-tests +++ b/grading/threads/run-tests @@ -65,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. -- 2.30.2