-
- # Change constants.h if necessary.
- my ($defines) = test_constants ($test);
- if ($defines ne snarf ("pintos/src/constants.h")) {
- open (CONSTANTS, ">pintos/src/constants.h");
- print CONSTANTS $defines;
- close (CONSTANTS);
- }
-
- # 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);
- }
-
- # Copy in the new test.c and delete enough files to ensure a full rebuild.
- my ($src) = test_source ($test);
- xsystem ("cp $src pintos/src/threads/test.c", DIE => "cp failed\n");
- unlink ("pintos/src/threads/build/threads/test.o");
- unlink ("pintos/src/threads/build/kernel.o");
- unlink ("pintos/src/threads/build/kernel.bin");
- unlink ("pintos/src/threads/build/os.dsk");
-
- # Build.
- xsystem ("cd pintos/src/threads && make", LOG => "$test/make")
- or return "compile error";
-
- # Copy out files for backtraces later.
- xsystem ("cp pintos/src/threads/build/kernel.o output/$test");
- xsystem ("cp pintos/src/threads/build/os.dsk output/$test");