code stringlengths 1 2.01M | repo_name stringlengths 3 62 | path stringlengths 1 267 | language stringclasses 231
values | license stringclasses 13
values | size int64 1 2.01M |
|---|---|---|---|---|---|
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-close) begin
(mmap-close) open "sample.txt"
(mmap-close) mmap "sample.txt"
(mmap-close) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-close.ck | Perl | oos | 219 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-remove) begin
(mmap-remove) open "sample.txt"
(mmap-remove) mmap "sample.txt"
(mmap-remove) remove "sample.txt"
(mmap-remove) try to open "sample.txt"
(mmap-remove) create "another"
(mmap-remove) end
EOF... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-remove.ck | Perl | oos | 327 |
# -*- makefile -*-
tests/vm_TESTS = $(addprefix tests/vm/,pt-grow-stack pt-grow-pusha \
pt-grow-bad pt-big-stk-obj pt-bad-addr pt-bad-read pt-write-code \
pt-write-code2 pt-grow-stk-sc page-linear page-parallel page-merge-seq \
page-merge-par page-merge-stk page-merge-mm page-shuffle mmap-read \
mmap-close mmap-unmap ... | 10cm | trunk/10cm/pintos/src/tests/vm/Make.tests | Makefile | oos | 5,526 |
/* Child process of mmap-exit.
Mmaps a file and writes to it via the mmap'ing, then exits
without calling munmap. The data in the mapped region must be
written out at program termination. */
#include <string.h>
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"... | 10cm | trunk/10cm/pintos/src/tests/vm/child-mm-wrt.c | C | oos | 656 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::cksum;
use tests::lib;
my ($init, @shuffle);
if (1) {
# Use precalculated values.
$init = 3115322833;
@shuffle = (1691062564, 1973575879, 1647619479, 96566261, 3885786467,
3022003332, 3614934266, 2704001777, 735775156, 1864109763);
} e... | 10cm | trunk/10cm/pintos/src/tests/vm/page-shuffle.ck | Perl | oos | 1,178 |
/* Verifies that mapping over the data segment is disallowed. */
#include <stdint.h>
#include <round.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
static char x;
void
test_main (void)
{
uintptr_t x_page = ROUND_DOWN ((uintptr_t) &x, 4096);
int handle;
CHECK ((handle = open ("sample... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-data.c | C | oos | 458 |
/* Shuffles a 128 kB data buffer 10 times, printing the checksum
after each time. */
#include <stdbool.h>
#include "tests/arc4.h"
#include "tests/cksum.h"
#include "tests/lib.h"
#include "tests/main.h"
#define SIZE (128 * 1024)
static char buf[SIZE];
void
test_main (void)
{
size_t i;
/* Initialize. */
for... | 10cm | trunk/10cm/pintos/src/tests/vm/page-shuffle.c | C | oos | 600 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(page-merge-mm) begin
(page-merge-mm) init
(page-merge-mm) sort chunk 0
(page-merge-mm) sort chunk 1
(page-merge-mm) sort chunk 2
(page-merge-mm) sort chunk 3
(page-merge-mm) sort chunk 4
(page-merge-mm) sort ... | 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-mm.ck | Perl | oos | 768 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-twice) begin
(mmap-twice) open "sample.txt" #0
(mmap-twice) mmap "sample.txt" #0 at 0x10000000
(mmap-twice) open "sample.txt" #1
(mmap-twice) mmap "sample.txt" #1 at 0x20000000
(mmap-twice) compare mmap'... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-twice.ck | Perl | oos | 417 |
/* Maps a file into memory and runs child-inherit to verify that
mappings are not inherited. */
#include <string.h>
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
char *actual = (char *) 0x54321000;
int handle;
pid_t child;
/* Ope... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-inherit.c | C | oos | 936 |
/* Accesses a bad address.
The process must be terminated with -1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
fail ("bad addr read as %d", *(int *) 0x04000000);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-bad-addr.c | C | oos | 211 |
/* Generates about 1 MB of random data that is then divided into
16 chunks. A separate subprocess sorts each chunk; the
subprocesses run in parallel. Then we merge the chunks and
verify that the result is what it should be. */
#include "tests/vm/parallel-merge.h"
#include <stdio.h>
#include <syscall.h>
#inc... | 10cm | trunk/10cm/pintos/src/tests/vm/parallel-merge.c | C | oos | 3,528 |
/* Uses a memory mapping to read a file. */
#include <string.h>
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
char *actual = (char *) 0x10000000;
int handle;
mapid_t map;
size_t i;
CHECK ((handle = open ("sample.txt")) > 1, "open ... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-read.c | C | oos | 804 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(mmap-bad-fd) begin
(mmap-bad-fd) try to mmap invalid fd
(mmap-bad-fd) end
mmap-bad-fd: exit(0)
EOF
(mmap-bad-fd) begin
(mmap-bad-fd) try to mmap invalid fd
mmap-bad-fd: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-bad-fd.ck | Perl | oos | 285 |
#include <string.h>
#include <syscall.h>
#include <stdio.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
#define SIZE 23*1024
int buf2[SIZE];
void test_main(void) {
int i = 0;
printf("program start.... \n");
printf("accsses 13th page %p\n",&buf2[13*1024]);
buf2[13*1024] = 1;
pri... | 10cm | trunk/10cm/pintos/src/tests/vm/lru_10cm.c | C | oos | 599 |
/* Runs 4 child-linear processes at once. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
#define CHILD_CNT 4
void
test_main (void)
{
pid_t children[CHILD_CNT];
int i;
for (i = 0; i < CHILD_CNT; i++)
CHECK ((children[i] = exec ("child-linear")) != -1,
"exec \"child-linea... | 10cm | trunk/10cm/pintos/src/tests/vm/page-parallel.c | C | oos | 429 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(pt-big-stk-obj) begin
(pt-big-stk-obj) cksum: 3256410166
(pt-big-stk-obj) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-big-stk-obj.ck | Perl | oos | 200 |
/* Verifies that overlapping memory mappings are disallowed. */
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
char *start = (char *) 0x10000000;
int fd[2];
CHECK ((fd[0] = open ("zeros")) > 1, "open \"zeros\" once");
CHECK (mmap (fd... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-overlap.c | C | oos | 551 |
/* Generates about 1 MB of random data that is then divided into
16 chunks. A separate subprocess sorts each chunk in
sequence. Then we merge the chunks and verify that the result
is what it should be. */
#include <syscall.h>
#include "tests/arc4.h"
#include "tests/lib.h"
#include "tests/main.h"
/* This is... | 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-seq.c | C | oos | 3,189 |
#include "tests/main.h"
#include "tests/vm/parallel-merge.h"
void
test_main (void)
{
parallel_merge ("child-qsort-mm", 80);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-mm.c | C | oos | 130 |
/* Child process for mmap-inherit test.
Tries to write to a mapping present in the parent.
The process must be terminated with -1 exit code. */
#include <string.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
memset ((char *) 0x54321000, 0, 4096);
fai... | 10cm | trunk/10cm/pintos/src/tests/vm/child-inherit.c | C | oos | 372 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(pt-bad-read) begin
(pt-bad-read) open "sample.txt"
pt-bad-read: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-bad-read.ck | Perl | oos | 171 |
/* Demonstrate that the stack can grow.
This must succeed. */
#include <string.h>
#include "tests/arc4.h"
#include "tests/cksum.h"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
char stack_obj[4096];
struct arc4 arc4;
arc4_init (&arc4, "foobar", 6);
memset (stack_obj, 0, sizeof sta... | 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-stack.c | C | oos | 441 |
/* Reads a 128 kB file onto the stack and "sorts" the bytes in
it, using quick sort, a multi-pass divide and conquer
algorithm. The sorted data is written back to the same file
in-place. */
#include <debug.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
#include "tests/vm/qsort.h"
con... | 10cm | trunk/10cm/pintos/src/tests/vm/child-qsort.c | C | oos | 706 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-null) begin
(mmap-null) open "sample.txt"
(mmap-null) try to mmap at address 0
(mmap-null) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-null.ck | Perl | oos | 222 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(pt-grow-stack) begin
(pt-grow-stack) cksum: 3424492700
(pt-grow-stack) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-stack.ck | Perl | oos | 197 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-write) begin
(mmap-write) create "sample.txt"
(mmap-write) open "sample.txt"
(mmap-write) mmap "sample.txt"
(mmap-write) compare read data against written data
(mmap-write) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-write.ck | Perl | oos | 304 |
/* Writes to a file through a mapping, and unmaps the file,
then reads the data in the file back using the read system
call to verify. */
#include <string.h>
#include <syscall.h>
#include "tests/vm/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
#define ACTUAL ((void *) 0x10000000)
void
test_main (v... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-write.c | C | oos | 877 |
char sample[] = {
"=== ALL USERS PLEASE NOTE ========================\n"
"\n"
"CAR and CDR now return extra values.\n"
"\n"
"The function CAR now returns two values. Since it has to go to the\n"
"trouble to figure out if the object is carcdr-able anyway, we figured\n"
"you might as well get both halves... | 10cm | trunk/10cm/pintos/src/tests/vm/sample.inc | C++ | oos | 917 |
/* Reads a 128 kB file into static data and "sorts" the bytes in
it, using counting sort, a single-pass algorithm. The sorted
data is written back to the same file in-place. */
#include <debug.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
const char *test_name = "child-sort";
unsigned... | 10cm | trunk/10cm/pintos/src/tests/vm/child-sort.c | C | oos | 893 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-clean) begin
(mmap-clean) open "sample.txt"
(mmap-clean) mmap "sample.txt"
(mmap-clean) write "sample.txt"
(mmap-clean) munmap "sample.txt"
(mmap-clean) seek "sample.txt"
(mmap-clean) read "sample.txt"
(... | 10cm | trunk/10cm/pintos/src/tests/vm/mmap-clean.ck | Perl | oos | 397 |
#ifndef TESTS_VM_QSORT_H
#define TESTS_VM_QSORT_H 1
#include <stddef.h>
void qsort_bytes (unsigned char *buf, size_t size);
#endif /* tests/vm/qsort.h */
| 10cm | trunk/10cm/pintos/src/tests/vm/qsort.h | C | oos | 157 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']);
(mmap-over-code) begin
(mmap-over-code) open "sample.txt"
(mmap-over-code) try to mmap over code segment
(mmap-over-code) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-code.ck | Perl | oos | 247 |
#ifndef TESTS_ARC4_H
#define TESTS_ARC4_H
#include <stddef.h>
#include <stdint.h>
/* Alleged RC4 algorithm encryption state. */
struct arc4
{
uint8_t s[256];
uint8_t i, j;
};
void arc4_init (struct arc4 *, const void *, size_t);
void arc4_crypt (struct arc4 *, void *, size_t);
#endif /* tests/arc4.h */
| 10cm | trunk/10cm/pintos/src/tests/arc4.h | C | oos | 320 |
/* Creates several threads all at the same priority and ensures
that they consistently run in the same round-robin order.
Based on a test originally submitted for Stanford's CS 140 in
winter 1999 by by Matt Franklin
<startled@leland.stanford.edu>, Greg Hutchins
<gmh@leland.stanford.edu>, Yu Ping Hu <yph... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-fifo.c | C | oos | 2,601 |
/* Creates N threads, each of which sleeps a different, fixed
duration, M times. Records the wake-up order and verifies
that it is valid. */
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/malloc.h"
#include "threads/synch.h"
#include "threads/thread.h"
#include "... | 10cm | trunk/10cm/pintos/src/tests/threads/alarm-simultaneous.c | C | oos | 2,564 |
/* The main thread set its priority to PRI_MIN and creates 7 threads
(thread 1..7) with priorities PRI_MIN + 3, 6, 9, 12, ...
The main thread initializes 8 locks: lock 0..7 and acquires lock 0.
When thread[i] starts, it first acquires lock[i] (unless i == 7.)
Subsequently, thread[i] attempts to acquire lo... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-chain.c | C | oos | 3,468 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-preempt) begin
(priority-preempt) Thread high-priority iteration 0
(priority-preempt) Thread high-priority iteration 1
(priority-preempt) Thread high-priority iteration 2
(priority-preempt) Thread high-priority iteration 3
... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-preempt.ck | Perl | oos | 526 |
/* Checks that recent_cpu and priorities are updated for blocked
threads.
The main thread sleeps for 25 seconds, spins for 5 seconds,
then releases a lock. The "block" thread spins for 20 seconds
then attempts to acquire the lock, which will block for 10
seconds (until the main thread releases it). If... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-block.c | C | oos | 1,683 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-lower) begin
(priority-donate-lower) Main thread should have priority 41. Actual priority: 41.
(priority-donate-lower) Lowering base priority...
(priority-donate-lower) Main thread should have priority 41. Actual p... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-lower.ck | Perl | oos | 598 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([0...9], 25);
| 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-nice-10.ck | Perl | oos | 119 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-negative) begin
(alarm-negative) PASS
(alarm-negative) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/alarm-negative.ck | Perl | oos | 163 |
# -*- perl -*-
# The expected output looks like this:
#
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-fifo.ck | Perl | oos | 2,185 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-simultaneous) begin
(alarm-simultaneous) Creating 3 threads to sleep 5 times each.
(alarm-simultaneous) Each thread sleeps 10 ticks each time.
(alarm-simultaneous) Within an iteration, all threads should wake up on the same ti... | 10cm | trunk/10cm/pintos/src/tests/threads/alarm-simultaneous.ck | Perl | oos | 1,354 |
/* Tests timer_sleep(0), which should return immediately. */
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/malloc.h"
#include "threads/synch.h"
#include "threads/thread.h"
#include "devices/timer.h"
void
test_alarm_zero (void)
{
timer_sleep (0);
pass ();
}
| 10cm | trunk/10cm/pintos/src/tests/threads/alarm-zero.c | C | oos | 288 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-zero) begin
(alarm-zero) PASS
(alarm-zero) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/alarm-zero.ck | Perl | oos | 151 |
/* Checks that recent_cpu is calculated properly for the case of
a single ready process.
The expected output is this (some margin of error is allowed):
After 2 seconds, recent_cpu is 6.40, load_avg is 0.03.
After 4 seconds, recent_cpu is 12.60, load_avg is 0.07.
After 6 seconds, recent_cpu is 18.61, lo... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-recent-1.c | C | oos | 7,017 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-sema) begin
(priority-sema) Thread priority 30 woke up.
(priority-sema) Back in main thread.
(priority-sema) Thread priority 29 woke up.
(priority-sema) Back in main thread.
(priority-sema) Thread priority 28 woke up.
(prio... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-sema.ck | Perl | oos | 949 |
/* Tests that cond_signal() wakes up the highest-priority thread
waiting in cond_wait(). */
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/malloc.h"
#include "threads/synch.h"
#include "threads/thread.h"
#include "devices/timer.h"
static thread_func priority_condvar... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-condvar.c | C | oos | 1,240 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
fail "missing PASS in output"
unless grep ($_ eq '(mlfqs-load-1) PASS', @output);
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-load-1.ck | Perl | oos | 290 |
/* Starts 60 threads that each sleep for 10 seconds, then spin in
a tight loop for 60 seconds, and sleep for another 60 seconds.
Every 2 seconds after the initial sleep, the main thread
prints the load average.
The expected output is this (some margin of error is allowed):
After 0 seconds, load average... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-load-60.c | C | oos | 5,423 |
/* Low-priority main thread L acquires lock A. Medium-priority
thread M then acquires lock B then blocks on acquiring lock A.
High-priority thread H then blocks on acquiring lock B. Thus,
thread H donates its priority to M, which in turn donates it
to thread L.
Based on a test originally submitted ... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-nest.c | C | oos | 2,430 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-multiple) begin
(priority-donate-multiple) Main thread should have priority 32. Actual priority: 32.
(priority-donate-multiple) Main thread should have priority 33. Actual priority: 33.
(priority-donate-multiple) T... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-multiple.ck | Perl | oos | 829 |
/* Low priority thread L acquires a lock, then blocks downing a
semaphore. Medium priority thread M then blocks waiting on
the same semaphore. Next, high priority thread H attempts to
acquire the lock, donating its priority to L.
Next, the main thread ups the semaphore, waking up L. L
releases the lo... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-sema.c | C | oos | 1,971 |
/* Ensures that a high-priority thread really preempts.
Based on a test originally submitted for Stanford's CS 140 in
winter 1999 by by Matt Franklin
<startled@leland.stanford.edu>, Greg Hutchins
<gmh@leland.stanford.edu>, Yu Ping Hu <yph@cs.stanford.edu>.
Modified by arens. */
#include <stdio.h>
#incl... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-preempt.c | C | oos | 1,058 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([(0) x 20], 20);
| 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-fair-20.ck | Perl | oos | 122 |
/* The main thread acquires locks A and B, then it creates two
higher-priority threads. Each of these threads blocks
acquiring one of the locks and thus donate their priority to
the main thread. The main thread releases the locks in turn
and relinquishes its donated priorities.
Based on a test orig... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-multiple.c | C | oos | 2,158 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(mlfqs-block) begin
(mlfqs-block) Main thread acquiring lock.
(mlfqs-block) Main thread creating block thread, sleeping 25 seconds...
(mlfqs-block) Block thread spinning for 20 seconds...
(mlfqs-block) Block thread acquiring lock...
... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-block.ck | Perl | oos | 529 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([0, 0], 50);
| 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-fair-2.ck | Perl | oos | 118 |
/* Starts 60 threads numbered 0 through 59. Thread #i sleeps for
(10+i) seconds, then spins in a loop for 60 seconds, then
sleeps until a total of 120 seconds have passed. Every 2
seconds, starting 10 seconds in, the main thread prints the
load average.
The expected output is listed below. Some margi... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-load-avg.c | C | oos | 6,006 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-one) begin
(priority-donate-one) This thread should have priority 32. Actual priority: 32.
(priority-donate-one) This thread should have priority 33. Actual priority: 33.
(priority-donate-one) acquire2: got the loc... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-one.ck | Perl | oos | 640 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-condvar) begin
(priority-condvar) Thread priority 23 starting.
(priority-condvar) Thread priority 22 starting.
(priority-condvar) Thread priority 21 starting.
(priority-condvar) Thread priority 30 starting.
(priority-condva... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-condvar.ck | Perl | oos | 1,415 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-multiple) begin
(priority-donate-multiple) Main thread should have priority 32. Actual priority: 32.
(priority-donate-multiple) Main thread should have priority 33. Actual priority: 33.
(priority-donate-multiple) T... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-multiple.ck.svn-base | Perl | oos | 829 |
# -*- perl -*-
use tests::tests;
use tests::threads::alarm;
check_alarm (7);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-multiple.ck.svn-base | Perl | oos | 77 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([0...9], 25);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-nice-10.ck.svn-base | Perl | oos | 119 |
# -*- perl -*-
use tests::tests;
use tests::threads::alarm;
check_alarm (1);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-single.ck.svn-base | Perl | oos | 77 |
# -*- perl -*-
# The expected output looks like this:
#
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
# (priority-fifo) iteration: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 1... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-fifo.ck.svn-base | Perl | oos | 2,185 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-multiple2) begin
(priority-donate-multiple2) Main thread should have priority 34. Actual priority: 34.
(priority-donate-multiple2) Main thread should have priority 36. Actual priority: 36.
(priority-donate-multiple... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-multiple2.ck.svn-base | Perl | oos | 846 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-condvar) begin
(priority-condvar) Thread priority 23 starting.
(priority-condvar) Thread priority 22 starting.
(priority-condvar) Thread priority 21 starting.
(priority-condvar) Thread priority 30 starting.
(priority-condva... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-condvar.ck.svn-base | Perl | oos | 1,415 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
# Get actual values.
local ($_);
my (@actual);
foreach (@output) {
my ($t, $load_avg) = /A... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-load-avg.ck.svn-base | Perl | oos | 883 |
# -*- makefile -*-
# Test names.
tests/threads_TESTS = $(addprefix tests/threads/,alarm-single \
alarm-multiple alarm-simultaneous alarm-priority alarm-zero \
alarm-negative priority-change priority-donate-one \
priority-donate-multiple priority-donate-multiple2 \
priority-donate-nest priority-donate-sema priori... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/Make.tests.svn-base | Makefile | oos | 2,339 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([0, 0], 50);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-fair-2.ck.svn-base | Perl | oos | 118 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-sema) begin
(priority-donate-sema) Thread L acquired lock.
(priority-donate-sema) Thread L downed semaphore.
(priority-donate-sema) Thread H acquired lock.
(priority-donate-sema) Thread H finished.
(priority-donate-s... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-sema.ck.svn-base | Perl | oos | 468 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-preempt) begin
(priority-preempt) Thread high-priority iteration 0
(priority-preempt) Thread high-priority iteration 1
(priority-preempt) Thread high-priority iteration 2
(priority-preempt) Thread high-priority iteration 3
... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-preempt.ck.svn-base | Perl | oos | 526 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-negative) begin
(alarm-negative) PASS
(alarm-negative) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-negative.ck.svn-base | Perl | oos | 163 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-priority) begin
(alarm-priority) Thread priority 30 woke up.
(alarm-priority) Thread priority 29 woke up.
(alarm-priority) Thread priority 28 woke up.
(alarm-priority) Thread priority 27 woke up.
(alarm-priority) Thread priori... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-priority.ck.svn-base | Perl | oos | 591 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([(0) x 20], 20);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-fair-20.ck.svn-base | Perl | oos | 122 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-lower) begin
(priority-donate-lower) Main thread should have priority 41. Actual priority: 41.
(priority-donate-lower) Lowering base priority...
(priority-donate-lower) Main thread should have priority 41. Actual p... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-lower.ck.svn-base | Perl | oos | 598 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
fail "missing PASS in output"
unless grep ($_ eq '(mlfqs-load-1) PASS', @output);
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-load-1.ck.svn-base | Perl | oos | 290 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-change) begin
(priority-change) Creating a high-priority thread 2.
(priority-change) Thread 2 now lowering priority.
(priority-change) Thread 2 should have just lowered its priority.
(priority-change) Thread 2 exiting.
(pri... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-change.ck.svn-base | Perl | oos | 400 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(mlfqs-block) begin
(mlfqs-block) Main thread acquiring lock.
(mlfqs-block) Main thread creating block thread, sleeping 25 seconds...
(mlfqs-block) Block thread spinning for 20 seconds...
(mlfqs-block) Block thread acquiring lock...
... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-block.ck.svn-base | Perl | oos | 529 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-one) begin
(priority-donate-one) This thread should have priority 32. Actual priority: 32.
(priority-donate-one) This thread should have priority 33. Actual priority: 33.
(priority-donate-one) acquire2: got the loc... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-one.ck.svn-base | Perl | oos | 640 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
# Get actual values.
local ($_);
my (@actual);
foreach (@output) {
my ($t, $load_avg) = /A... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-load-60.ck.svn-base | Perl | oos | 861 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
check_mlfqs_fair ([0, 5], 50);
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-nice-2.ck.svn-base | Perl | oos | 118 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-simultaneous) begin
(alarm-simultaneous) Creating 3 threads to sleep 5 times each.
(alarm-simultaneous) Each thread sleeps 10 ticks each time.
(alarm-simultaneous) Within an iteration, all threads should wake up on the same ti... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-simultaneous.ck.svn-base | Perl | oos | 1,354 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-nest) begin
(priority-donate-nest) Low thread should have priority 32. Actual priority: 32.
(priority-donate-nest) Low thread should have priority 33. Actual priority: 33.
(priority-donate-nest) Medium thread shoul... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-nest.ck.svn-base | Perl | oos | 798 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-sema) begin
(priority-sema) Thread priority 30 woke up.
(priority-sema) Back in main thread.
(priority-sema) Thread priority 29 woke up.
(priority-sema) Back in main thread.
(priority-sema) Thread priority 28 woke up.
(prio... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-sema.ck.svn-base | Perl | oos | 949 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
# Get actual values.
local ($_);
my (@actual);
foreach (@output) {
my ($t, $recent_cpu) = /... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs-recent-1.ck.svn-base | Perl | oos | 826 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-chain) begin
(priority-donate-chain) main got lock.
(priority-donate-chain) main should have priority 3. Actual priority: 3.
(priority-donate-chain) main should have priority 6. Actual priority: 6.
(priority-donate... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/priority-donate-chain.ck.svn-base | Perl | oos | 2,369 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(alarm-zero) begin
(alarm-zero) PASS
(alarm-zero) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/alarm-zero.ck.svn-base | Perl | oos | 151 |
# -*- perl -*-
use strict;
use warnings;
sub mlfqs_expected_load {
my ($ready, $recent_delta) = @_;
my (@load_avg) = 0;
my (@recent_cpu) = 0;
my ($load_avg) = 0;
my ($recent_cpu) = 0;
for my $i (0...$#$ready) {
$load_avg = (59/60) * $load_avg + (1/60) * $ready->[$i];
push (@load_avg, $load_av... | 10cm | trunk/10cm/pintos/src/tests/threads/.svn/text-base/mlfqs.pm.svn-base | Perl | oos | 3,921 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-chain) begin
(priority-donate-chain) main got lock.
(priority-donate-chain) main should have priority 3. Actual priority: 3.
(priority-donate-chain) main should have priority 6. Actual priority: 6.
(priority-donate... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-chain.ck | Perl | oos | 2,369 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-change) begin
(priority-change) Creating a high-priority thread 2.
(priority-change) Thread 2 now lowering priority.
(priority-change) Thread 2 should have just lowered its priority.
(priority-change) Thread 2 exiting.
(pri... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-change.ck | Perl | oos | 400 |
# -*- makefile -*-
# Test names.
tests/threads_TESTS = $(addprefix tests/threads/,alarm-single \
alarm-multiple alarm-simultaneous alarm-priority alarm-zero \
alarm-negative priority-change priority-donate-one \
priority-donate-multiple priority-donate-multiple2 \
priority-donate-nest priority-donate-sema priori... | 10cm | trunk/10cm/pintos/src/tests/threads/Make.tests | Makefile | oos | 2,339 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::threads::mlfqs;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
@output = get_core_output ("run", @output);
# Get actual values.
local ($_);
my (@actual);
foreach (@output) {
my ($t, $load_avg) = /A... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-load-avg.ck | Perl | oos | 883 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(priority-donate-nest) begin
(priority-donate-nest) Low thread should have priority 32. Actual priority: 32.
(priority-donate-nest) Low thread should have priority 33. Actual priority: 33.
(priority-donate-nest) Medium thread shoul... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-donate-nest.ck | Perl | oos | 798 |
/* Verifies that lowering a thread's priority so that it is no
longer the highest-priority thread in the system causes it to
yield immediately. */
#include <stdio.h>
#include "tests/threads/tests.h"
#include "threads/init.h"
#include "threads/thread.h"
static thread_func changing_thread;
void
test_priority_cha... | 10cm | trunk/10cm/pintos/src/tests/threads/priority-change.c | C | oos | 838 |
/* Verifies that a single busy thread raises the load average to
0.5 in 38 to 45 seconds. The expected time is 42 seconds, as
you can verify:
perl -e '$i++,$a=(59*$a+1)/60while$a<=.5;print "$i\n"'
Then, verifies that 10 seconds of inactivity drop the load
average back below 0.5 again. */
#include <std... | 10cm | trunk/10cm/pintos/src/tests/threads/mlfqs-load-1.c | C | oos | 1,737 |
# -*- perl -*-
use tests::tests;
use tests::threads::alarm;
check_alarm (1);
| 10cm | trunk/10cm/pintos/src/tests/threads/alarm-single.ck | Perl | oos | 77 |
#include "tests/threads/tests.h"
#include <debug.h>
#include <string.h>
#include <stdio.h>
struct test
{
const char *name;
test_func *function;
};
static const struct test tests[] =
{
{"alarm-single", test_alarm_single},
{"alarm-multiple", test_alarm_multiple},
{"alarm-simultaneous", test_... | 10cm | trunk/10cm/pintos/src/tests/threads/tests.c | C | oos | 2,735 |