From 4f670845ff9ab6c48bcb5f7bf4d4ef6dc3c3064b Mon Sep 17 00:00:00 2001 From: manuel Date: Tue, 27 Mar 2012 11:51:08 +0200 Subject: reorganize file structure to match the upstream requirements --- pintos-progos/tests/vm/Grading | 12 --- pintos-progos/tests/vm/Make.tests | 107 -------------------- pintos-progos/tests/vm/Rubric.functionality | 21 ---- pintos-progos/tests/vm/Rubric.paging | 8 -- pintos-progos/tests/vm/Rubric.robustness | 21 ---- pintos-progos/tests/vm/child-inherit.c | 16 --- pintos-progos/tests/vm/child-linear.c | 36 ------- pintos-progos/tests/vm/child-mm-wrt.c | 24 ----- pintos-progos/tests/vm/child-qsort-mm.c | 25 ----- pintos-progos/tests/vm/child-qsort.c | 32 ------ pintos-progos/tests/vm/child-sort.c | 42 -------- pintos-progos/tests/vm/mmap-bad-fd.c | 15 --- pintos-progos/tests/vm/mmap-bad-fd.ck | 15 --- pintos-progos/tests/vm/mmap-clean.c | 53 ---------- pintos-progos/tests/vm/mmap-clean.ck | 16 --- pintos-progos/tests/vm/mmap-close.c | 27 ----- pintos-progos/tests/vm/mmap-close.ck | 11 -- pintos-progos/tests/vm/mmap-exit.c | 22 ---- pintos-progos/tests/vm/mmap-exit.ck | 17 ---- pintos-progos/tests/vm/mmap-inherit.c | 32 ------ pintos-progos/tests/vm/mmap-inherit.ck | 16 --- pintos-progos/tests/vm/mmap-lazy-seq.c | 52 ---------- pintos-progos/tests/vm/mmap-lazy-seq.ck | 27 ----- pintos-progos/tests/vm/mmap-misalign.c | 16 --- pintos-progos/tests/vm/mmap-misalign.ck | 11 -- pintos-progos/tests/vm/mmap-null.c | 15 --- pintos-progos/tests/vm/mmap-null.ck | 11 -- pintos-progos/tests/vm/mmap-over-code.c | 19 ---- pintos-progos/tests/vm/mmap-over-code.ck | 11 -- pintos-progos/tests/vm/mmap-over-data.c | 21 ---- pintos-progos/tests/vm/mmap-over-data.ck | 11 -- pintos-progos/tests/vm/mmap-over-stk.c | 19 ---- pintos-progos/tests/vm/mmap-over-stk.ck | 11 -- pintos-progos/tests/vm/mmap-overlap.c | 20 ---- pintos-progos/tests/vm/mmap-overlap.ck | 13 --- pintos-progos/tests/vm/mmap-read.c | 32 ------ pintos-progos/tests/vm/mmap-read.ck | 11 -- pintos-progos/tests/vm/mmap-remove.c | 43 -------- pintos-progos/tests/vm/mmap-remove.ck | 14 --- pintos-progos/tests/vm/mmap-shuffle.c | 38 ------- pintos-progos/tests/vm/mmap-shuffle.ck | 47 --------- pintos-progos/tests/vm/mmap-twice.c | 28 ------ pintos-progos/tests/vm/mmap-twice.ck | 15 --- pintos-progos/tests/vm/mmap-unmap.c | 23 ----- pintos-progos/tests/vm/mmap-unmap.ck | 7 -- pintos-progos/tests/vm/mmap-write.c | 32 ------ pintos-progos/tests/vm/mmap-write.ck | 13 --- pintos-progos/tests/vm/mmap-zero.c | 27 ----- pintos-progos/tests/vm/mmap-zero.ck | 12 --- pintos-progos/tests/vm/page-linear.c | 44 -------- pintos-progos/tests/vm/page-linear.ck | 14 --- pintos-progos/tests/vm/page-merge-mm.c | 8 -- pintos-progos/tests/vm/page-merge-mm.ck | 29 ------ pintos-progos/tests/vm/page-merge-par.c | 8 -- pintos-progos/tests/vm/page-merge-par.ck | 29 ------ pintos-progos/tests/vm/page-merge-seq.c | 137 ------------------------- pintos-progos/tests/vm/page-merge-seq.ck | 29 ------ pintos-progos/tests/vm/page-merge-stk.c | 8 -- pintos-progos/tests/vm/page-merge-stk.ck | 29 ------ pintos-progos/tests/vm/page-parallel.c | 21 ---- pintos-progos/tests/vm/page-parallel.ck | 17 ---- pintos-progos/tests/vm/page-shuffle.c | 30 ------ pintos-progos/tests/vm/page-shuffle.ck | 44 -------- pintos-progos/tests/vm/parallel-merge.c | 149 ---------------------------- pintos-progos/tests/vm/parallel-merge.h | 6 -- pintos-progos/tests/vm/process_death.pm | 22 ---- pintos-progos/tests/vm/pt-bad-addr.c | 11 -- pintos-progos/tests/vm/pt-bad-addr.ck | 7 -- pintos-progos/tests/vm/pt-bad-read.c | 16 --- pintos-progos/tests/vm/pt-bad-read.ck | 10 -- pintos-progos/tests/vm/pt-big-stk-obj.c | 20 ---- pintos-progos/tests/vm/pt-big-stk-obj.ck | 10 -- pintos-progos/tests/vm/pt-grow-bad.c | 14 --- pintos-progos/tests/vm/pt-grow-bad.ck | 9 -- pintos-progos/tests/vm/pt-grow-pusha.c | 20 ---- pintos-progos/tests/vm/pt-grow-pusha.ck | 9 -- pintos-progos/tests/vm/pt-grow-stack.c | 20 ---- pintos-progos/tests/vm/pt-grow-stack.ck | 10 -- pintos-progos/tests/vm/pt-grow-stk-sc.c | 32 ------ pintos-progos/tests/vm/pt-grow-stk-sc.ck | 15 --- pintos-progos/tests/vm/pt-write-code-2.c | 15 --- pintos-progos/tests/vm/pt-write-code.c | 12 --- pintos-progos/tests/vm/pt-write-code.ck | 7 -- pintos-progos/tests/vm/pt-write-code2.ck | 10 -- pintos-progos/tests/vm/qsort.c | 136 ------------------------- pintos-progos/tests/vm/qsort.h | 8 -- pintos-progos/tests/vm/sample.inc | 19 ---- pintos-progos/tests/vm/sample.txt | 17 ---- 88 files changed, 2218 deletions(-) delete mode 100644 pintos-progos/tests/vm/Grading delete mode 100644 pintos-progos/tests/vm/Make.tests delete mode 100644 pintos-progos/tests/vm/Rubric.functionality delete mode 100644 pintos-progos/tests/vm/Rubric.paging delete mode 100644 pintos-progos/tests/vm/Rubric.robustness delete mode 100644 pintos-progos/tests/vm/child-inherit.c delete mode 100644 pintos-progos/tests/vm/child-linear.c delete mode 100644 pintos-progos/tests/vm/child-mm-wrt.c delete mode 100644 pintos-progos/tests/vm/child-qsort-mm.c delete mode 100644 pintos-progos/tests/vm/child-qsort.c delete mode 100644 pintos-progos/tests/vm/child-sort.c delete mode 100644 pintos-progos/tests/vm/mmap-bad-fd.c delete mode 100644 pintos-progos/tests/vm/mmap-bad-fd.ck delete mode 100644 pintos-progos/tests/vm/mmap-clean.c delete mode 100644 pintos-progos/tests/vm/mmap-clean.ck delete mode 100644 pintos-progos/tests/vm/mmap-close.c delete mode 100644 pintos-progos/tests/vm/mmap-close.ck delete mode 100644 pintos-progos/tests/vm/mmap-exit.c delete mode 100644 pintos-progos/tests/vm/mmap-exit.ck delete mode 100644 pintos-progos/tests/vm/mmap-inherit.c delete mode 100644 pintos-progos/tests/vm/mmap-inherit.ck delete mode 100644 pintos-progos/tests/vm/mmap-lazy-seq.c delete mode 100644 pintos-progos/tests/vm/mmap-lazy-seq.ck delete mode 100644 pintos-progos/tests/vm/mmap-misalign.c delete mode 100644 pintos-progos/tests/vm/mmap-misalign.ck delete mode 100644 pintos-progos/tests/vm/mmap-null.c delete mode 100644 pintos-progos/tests/vm/mmap-null.ck delete mode 100644 pintos-progos/tests/vm/mmap-over-code.c delete mode 100644 pintos-progos/tests/vm/mmap-over-code.ck delete mode 100644 pintos-progos/tests/vm/mmap-over-data.c delete mode 100644 pintos-progos/tests/vm/mmap-over-data.ck delete mode 100644 pintos-progos/tests/vm/mmap-over-stk.c delete mode 100644 pintos-progos/tests/vm/mmap-over-stk.ck delete mode 100644 pintos-progos/tests/vm/mmap-overlap.c delete mode 100644 pintos-progos/tests/vm/mmap-overlap.ck delete mode 100644 pintos-progos/tests/vm/mmap-read.c delete mode 100644 pintos-progos/tests/vm/mmap-read.ck delete mode 100644 pintos-progos/tests/vm/mmap-remove.c delete mode 100644 pintos-progos/tests/vm/mmap-remove.ck delete mode 100644 pintos-progos/tests/vm/mmap-shuffle.c delete mode 100644 pintos-progos/tests/vm/mmap-shuffle.ck delete mode 100644 pintos-progos/tests/vm/mmap-twice.c delete mode 100644 pintos-progos/tests/vm/mmap-twice.ck delete mode 100644 pintos-progos/tests/vm/mmap-unmap.c delete mode 100644 pintos-progos/tests/vm/mmap-unmap.ck delete mode 100644 pintos-progos/tests/vm/mmap-write.c delete mode 100644 pintos-progos/tests/vm/mmap-write.ck delete mode 100644 pintos-progos/tests/vm/mmap-zero.c delete mode 100644 pintos-progos/tests/vm/mmap-zero.ck delete mode 100644 pintos-progos/tests/vm/page-linear.c delete mode 100644 pintos-progos/tests/vm/page-linear.ck delete mode 100644 pintos-progos/tests/vm/page-merge-mm.c delete mode 100644 pintos-progos/tests/vm/page-merge-mm.ck delete mode 100644 pintos-progos/tests/vm/page-merge-par.c delete mode 100644 pintos-progos/tests/vm/page-merge-par.ck delete mode 100644 pintos-progos/tests/vm/page-merge-seq.c delete mode 100644 pintos-progos/tests/vm/page-merge-seq.ck delete mode 100644 pintos-progos/tests/vm/page-merge-stk.c delete mode 100644 pintos-progos/tests/vm/page-merge-stk.ck delete mode 100644 pintos-progos/tests/vm/page-parallel.c delete mode 100644 pintos-progos/tests/vm/page-parallel.ck delete mode 100644 pintos-progos/tests/vm/page-shuffle.c delete mode 100644 pintos-progos/tests/vm/page-shuffle.ck delete mode 100644 pintos-progos/tests/vm/parallel-merge.c delete mode 100644 pintos-progos/tests/vm/parallel-merge.h delete mode 100644 pintos-progos/tests/vm/process_death.pm delete mode 100644 pintos-progos/tests/vm/pt-bad-addr.c delete mode 100644 pintos-progos/tests/vm/pt-bad-addr.ck delete mode 100644 pintos-progos/tests/vm/pt-bad-read.c delete mode 100644 pintos-progos/tests/vm/pt-bad-read.ck delete mode 100644 pintos-progos/tests/vm/pt-big-stk-obj.c delete mode 100644 pintos-progos/tests/vm/pt-big-stk-obj.ck delete mode 100644 pintos-progos/tests/vm/pt-grow-bad.c delete mode 100644 pintos-progos/tests/vm/pt-grow-bad.ck delete mode 100644 pintos-progos/tests/vm/pt-grow-pusha.c delete mode 100644 pintos-progos/tests/vm/pt-grow-pusha.ck delete mode 100644 pintos-progos/tests/vm/pt-grow-stack.c delete mode 100644 pintos-progos/tests/vm/pt-grow-stack.ck delete mode 100644 pintos-progos/tests/vm/pt-grow-stk-sc.c delete mode 100644 pintos-progos/tests/vm/pt-grow-stk-sc.ck delete mode 100644 pintos-progos/tests/vm/pt-write-code-2.c delete mode 100644 pintos-progos/tests/vm/pt-write-code.c delete mode 100644 pintos-progos/tests/vm/pt-write-code.ck delete mode 100644 pintos-progos/tests/vm/pt-write-code2.ck delete mode 100644 pintos-progos/tests/vm/qsort.c delete mode 100644 pintos-progos/tests/vm/qsort.h delete mode 100644 pintos-progos/tests/vm/sample.inc delete mode 100644 pintos-progos/tests/vm/sample.txt (limited to 'pintos-progos/tests/vm') diff --git a/pintos-progos/tests/vm/Grading b/pintos-progos/tests/vm/Grading deleted file mode 100644 index f0c2c13..0000000 --- a/pintos-progos/tests/vm/Grading +++ /dev/null @@ -1,12 +0,0 @@ -# Percentage of the testing point total designated for each set of -# tests. - -# This project is primarily about virtual memory, but all the previous -# functionality should work too, and it's easy to screw it up, thus -# the equal weight placed on each. - -50% tests/vm/Rubric.functionality -15% tests/vm/Rubric.robustness -10% tests/userprog/Rubric.functionality -5% tests/userprog/Rubric.robustness -20% tests/filesys/base/Rubric diff --git a/pintos-progos/tests/vm/Make.tests b/pintos-progos/tests/vm/Make.tests deleted file mode 100644 index 0307ccc..0000000 --- a/pintos-progos/tests/vm/Make.tests +++ /dev/null @@ -1,107 +0,0 @@ -# -*- 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 mmap-read \ -mmap-close mmap-unmap mmap-overlap mmap-twice mmap-write mmap-exit \ -mmap-shuffle mmap-bad-fd mmap-clean mmap-inherit mmap-misalign \ -mmap-null mmap-over-code mmap-over-data mmap-over-stk mmap-remove \ -mmap-zero mmap-lazy-seq) - -# Deactivated -PAGE_TESTS=page-linear page-parallel page-merge-seq \ -page-merge-par page-merge-stk page-merge-mm page-shuffle - -tests/vm_PROGS = $(tests/vm_TESTS) $(addprefix tests/vm/,child-linear \ -child-sort child-qsort child-qsort-mm child-mm-wrt child-inherit) - -tests/vm/pt-grow-stack_SRC = tests/vm/pt-grow-stack.c tests/arc4.c \ -tests/cksum.c tests/lib.c tests/main.c -tests/vm/pt-grow-pusha_SRC = tests/vm/pt-grow-pusha.c tests/lib.c \ -tests/main.c -tests/vm/pt-grow-bad_SRC = tests/vm/pt-grow-bad.c tests/lib.c tests/main.c -tests/vm/pt-big-stk-obj_SRC = tests/vm/pt-big-stk-obj.c tests/arc4.c \ -tests/cksum.c tests/lib.c tests/main.c -tests/vm/pt-bad-addr_SRC = tests/vm/pt-bad-addr.c tests/lib.c tests/main.c -tests/vm/pt-bad-read_SRC = tests/vm/pt-bad-read.c tests/lib.c tests/main.c -tests/vm/pt-write-code_SRC = tests/vm/pt-write-code.c tests/lib.c tests/main.c -tests/vm/pt-write-code2_SRC = tests/vm/pt-write-code-2.c tests/lib.c tests/main.c -tests/vm/pt-grow-stk-sc_SRC = tests/vm/pt-grow-stk-sc.c tests/lib.c tests/main.c -tests/vm/page-linear_SRC = tests/vm/page-linear.c tests/arc4.c \ -tests/lib.c tests/main.c -tests/vm/page-parallel_SRC = tests/vm/page-parallel.c tests/lib.c tests/main.c -tests/vm/page-merge-seq_SRC = tests/vm/page-merge-seq.c tests/arc4.c \ -tests/lib.c tests/main.c -tests/vm/page-merge-par_SRC = tests/vm/page-merge-par.c \ -tests/vm/parallel-merge.c tests/arc4.c tests/lib.c tests/main.c -tests/vm/page-merge-stk_SRC = tests/vm/page-merge-stk.c \ -tests/vm/parallel-merge.c tests/arc4.c tests/lib.c tests/main.c -tests/vm/page-merge-mm_SRC = tests/vm/page-merge-mm.c \ -tests/vm/parallel-merge.c tests/arc4.c tests/lib.c tests/main.c -tests/vm/page-shuffle_SRC = tests/vm/page-shuffle.c tests/arc4.c \ -tests/cksum.c tests/lib.c tests/main.c -tests/vm/mmap-read_SRC = tests/vm/mmap-read.c tests/lib.c tests/main.c -tests/vm/mmap-close_SRC = tests/vm/mmap-close.c tests/lib.c tests/main.c -tests/vm/mmap-unmap_SRC = tests/vm/mmap-unmap.c tests/lib.c tests/main.c -tests/vm/mmap-overlap_SRC = tests/vm/mmap-overlap.c tests/lib.c tests/main.c -tests/vm/mmap-twice_SRC = tests/vm/mmap-twice.c tests/lib.c tests/main.c -tests/vm/mmap-write_SRC = tests/vm/mmap-write.c tests/lib.c tests/main.c -tests/vm/mmap-lazy-seq_SRC = tests/vm/mmap-lazy-seq.c tests/lib.c tests/main.c -tests/vm/mmap-exit_SRC = tests/vm/mmap-exit.c tests/lib.c tests/main.c -tests/vm/mmap-shuffle_SRC = tests/vm/mmap-shuffle.c tests/arc4.c \ -tests/cksum.c tests/lib.c tests/main.c -tests/vm/mmap-bad-fd_SRC = tests/vm/mmap-bad-fd.c tests/lib.c tests/main.c -tests/vm/mmap-clean_SRC = tests/vm/mmap-clean.c tests/lib.c tests/main.c -tests/vm/mmap-inherit_SRC = tests/vm/mmap-inherit.c tests/lib.c tests/main.c -tests/vm/mmap-misalign_SRC = tests/vm/mmap-misalign.c tests/lib.c \ -tests/main.c -tests/vm/mmap-null_SRC = tests/vm/mmap-null.c tests/lib.c tests/main.c -tests/vm/mmap-over-code_SRC = tests/vm/mmap-over-code.c tests/lib.c \ -tests/main.c -tests/vm/mmap-over-data_SRC = tests/vm/mmap-over-data.c tests/lib.c \ -tests/main.c -tests/vm/mmap-over-stk_SRC = tests/vm/mmap-over-stk.c tests/lib.c tests/main.c -tests/vm/mmap-remove_SRC = tests/vm/mmap-remove.c tests/lib.c tests/main.c -tests/vm/mmap-zero_SRC = tests/vm/mmap-zero.c tests/lib.c tests/main.c - -tests/vm/child-linear_SRC = tests/vm/child-linear.c tests/arc4.c tests/lib.c -tests/vm/child-qsort_SRC = tests/vm/child-qsort.c tests/vm/qsort.c tests/lib.c -tests/vm/child-qsort-mm_SRC = tests/vm/child-qsort-mm.c tests/vm/qsort.c \ -tests/lib.c -tests/vm/child-sort_SRC = tests/vm/child-sort.c tests/lib.c -tests/vm/child-mm-wrt_SRC = tests/vm/child-mm-wrt.c tests/lib.c tests/main.c -tests/vm/child-inherit_SRC = tests/vm/child-inherit.c tests/lib.c tests/main.c - -tests/vm/pt-bad-read_PUTFILES = tests/vm/sample.txt -tests/vm/pt-write-code2_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-close_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-read_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-unmap_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-twice_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-overlap_PUTFILES = tests/vm/zeros -tests/vm/mmap-exit_PUTFILES = tests/vm/child-mm-wrt -tests/vm/page-parallel_PUTFILES = tests/vm/child-linear -tests/vm/page-merge-seq_PUTFILES = tests/vm/child-sort -tests/vm/page-merge-par_PUTFILES = tests/vm/child-sort -tests/vm/page-merge-stk_PUTFILES = tests/vm/child-qsort -tests/vm/page-merge-mm_PUTFILES = tests/vm/child-qsort-mm -tests/vm/mmap-clean_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-inherit_PUTFILES = tests/vm/sample.txt tests/vm/child-inherit -tests/vm/mmap-misalign_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-null_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-over-code_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-over-data_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-over-stk_PUTFILES = tests/vm/sample.txt -tests/vm/mmap-remove_PUTFILES = tests/vm/sample.txt - -tests/vm/page-linear.output: TIMEOUT = 300 -tests/vm/page-shuffle.output: TIMEOUT = 600 -tests/vm/mmap-shuffle.output: TIMEOUT = 600 -tests/vm/page-merge-seq.output: TIMEOUT = 600 -tests/vm/page-merge-par.output: TIMEOUT = 600 - -tests/vm/zeros: - dd if=/dev/zero of=$@ bs=1024 count=6 - -clean:: - rm -f tests/vm/zeros diff --git a/pintos-progos/tests/vm/Rubric.functionality b/pintos-progos/tests/vm/Rubric.functionality deleted file mode 100644 index ede0221..0000000 --- a/pintos-progos/tests/vm/Rubric.functionality +++ /dev/null @@ -1,21 +0,0 @@ -Functionality of virtual memory subsystem: -- Test stack growth. -3 pt-grow-stack -3 pt-grow-stk-sc -3 pt-big-stk-obj -3 pt-grow-pusha - -- Test "mmap" system call. -2 mmap-read -2 mmap-write -2 mmap-shuffle - -2 mmap-twice - -2 mmap-unmap -1 mmap-exit - -3 mmap-clean - -2 mmap-close -2 mmap-remove diff --git a/pintos-progos/tests/vm/Rubric.paging b/pintos-progos/tests/vm/Rubric.paging deleted file mode 100644 index cf1d871..0000000 --- a/pintos-progos/tests/vm/Rubric.paging +++ /dev/null @@ -1,8 +0,0 @@ -- Test paging behavior. -3 page-linear -3 page-parallel -3 page-shuffle -4 page-merge-seq -4 page-merge-par -4 page-merge-mm -4 page-merge-stk diff --git a/pintos-progos/tests/vm/Rubric.robustness b/pintos-progos/tests/vm/Rubric.robustness deleted file mode 100644 index eca0af4..0000000 --- a/pintos-progos/tests/vm/Rubric.robustness +++ /dev/null @@ -1,21 +0,0 @@ -Robustness of virtual memory subsystem: -- Test robustness of page table support. -2 pt-bad-addr -3 pt-bad-read -2 pt-write-code -3 pt-write-code2 -4 pt-grow-bad - -- Test robustness of "mmap" system call. -1 mmap-bad-fd -1 mmap-inherit -1 mmap-null -1 mmap-zero - -2 mmap-misalign - -2 mmap-over-code -2 mmap-over-data -2 mmap-over-stk -2 mmap-overlap -4 mmap-lazy-seq diff --git a/pintos-progos/tests/vm/child-inherit.c b/pintos-progos/tests/vm/child-inherit.c deleted file mode 100644 index d3186a1..0000000 --- a/pintos-progos/tests/vm/child-inherit.c +++ /dev/null @@ -1,16 +0,0 @@ -/* 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 -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - memset ((char *) 0x54321000, 0, 4096); - fail ("child can modify parent's memory mappings"); -} - diff --git a/pintos-progos/tests/vm/child-linear.c b/pintos-progos/tests/vm/child-linear.c deleted file mode 100644 index eca3e3f..0000000 --- a/pintos-progos/tests/vm/child-linear.c +++ /dev/null @@ -1,36 +0,0 @@ -/* Child process of page-parallel. - Encrypts 1 MB of zeros, then decrypts it, and ensures that - the zeros are back. */ - -#include -#include "tests/arc4.h" -#include "tests/lib.h" -#include "tests/main.h" - -const char *test_name = "child-linear"; - -#define SIZE (1024 * 1024) -static char buf[SIZE]; - -int -main (int argc, char *argv[]) -{ - const char *key = argv[argc - 1]; - struct arc4 arc4; - size_t i; - - /* Encrypt zeros. */ - arc4_init (&arc4, key, strlen (key)); - arc4_crypt (&arc4, buf, SIZE); - - /* Decrypt back to zeros. */ - arc4_init (&arc4, key, strlen (key)); - arc4_crypt (&arc4, buf, SIZE); - - /* Check that it's all zeros. */ - for (i = 0; i < SIZE; i++) - if (buf[i] != '\0') - fail ("byte %zu != 0", i); - - return 0x42; -} diff --git a/pintos-progos/tests/vm/child-mm-wrt.c b/pintos-progos/tests/vm/child-mm-wrt.c deleted file mode 100644 index 8419788..0000000 --- a/pintos-progos/tests/vm/child-mm-wrt.c +++ /dev/null @@ -1,24 +0,0 @@ -/* 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 -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -#define ACTUAL ((void *) 0x10000000) - -void -test_main (void) -{ - int handle; - - CHECK (create ("sample.txt", sizeof sample), "create \"sample.txt\""); - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, ACTUAL) != MAP_FAILED, "mmap \"sample.txt\""); - memcpy (ACTUAL, sample, sizeof sample); -} - diff --git a/pintos-progos/tests/vm/child-qsort-mm.c b/pintos-progos/tests/vm/child-qsort-mm.c deleted file mode 100644 index db45499..0000000 --- a/pintos-progos/tests/vm/child-qsort-mm.c +++ /dev/null @@ -1,25 +0,0 @@ -/* Mmaps a 128 kB file "sorts" the bytes in it, using quick sort, - a multi-pass divide and conquer algorithm. */ - -#include -#include -#include "tests/lib.h" -#include "tests/main.h" -#include "tests/vm/qsort.h" - -const char *test_name = "child-qsort-mm"; - -int -main (int argc UNUSED, char *argv[]) -{ - int handle; - unsigned char *p = (unsigned char *) 0x10000000; - - quiet = true; - - CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]); - CHECK (mmap (handle, p) != MAP_FAILED, "mmap \"%s\"", argv[1]); - qsort_bytes (p, 1024 * 128); - - return 80; -} diff --git a/pintos-progos/tests/vm/child-qsort.c b/pintos-progos/tests/vm/child-qsort.c deleted file mode 100644 index 355f4eb..0000000 --- a/pintos-progos/tests/vm/child-qsort.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include "tests/lib.h" -#include "tests/main.h" -#include "tests/vm/qsort.h" - -const char *test_name = "child-qsort"; - -int -main (int argc UNUSED, char *argv[]) -{ - int handle; - unsigned char buf[128 * 1024]; - size_t size; - - quiet = true; - - CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]); - - size = read (handle, buf, sizeof buf); - qsort_bytes (buf, sizeof buf); - seek (handle, 0); - write (handle, buf, size); - close (handle); - - return 72; -} diff --git a/pintos-progos/tests/vm/child-sort.c b/pintos-progos/tests/vm/child-sort.c deleted file mode 100644 index dff2c77..0000000 --- a/pintos-progos/tests/vm/child-sort.c +++ /dev/null @@ -1,42 +0,0 @@ -/* 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 -#include -#include "tests/lib.h" -#include "tests/main.h" - -const char *test_name = "child-sort"; - -unsigned char buf[128 * 1024]; -size_t histogram[256]; - -int -main (int argc UNUSED, char *argv[]) -{ - int handle; - unsigned char *p; - size_t size; - size_t i; - - quiet = true; - - CHECK ((handle = open (argv[1])) > 1, "open \"%s\"", argv[1]); - - size = read (handle, buf, sizeof buf); - for (i = 0; i < size; i++) - histogram[buf[i]]++; - p = buf; - for (i = 0; i < sizeof histogram / sizeof *histogram; i++) - { - size_t j = histogram[i]; - while (j-- > 0) - *p++ = i; - } - seek (handle, 0); - write (handle, buf, size); - close (handle); - - return 123; -} diff --git a/pintos-progos/tests/vm/mmap-bad-fd.c b/pintos-progos/tests/vm/mmap-bad-fd.c deleted file mode 100644 index 76a7b50..0000000 --- a/pintos-progos/tests/vm/mmap-bad-fd.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Tries to mmap an invalid fd, - which must either fail silently or terminate the process with - exit code -1. */ - -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - CHECK (mmap (0x5678, (void *) 0x10000000) == MAP_FAILED, - "try to mmap invalid fd"); -} - diff --git a/pintos-progos/tests/vm/mmap-bad-fd.ck b/pintos-progos/tests/vm/mmap-bad-fd.ck deleted file mode 100644 index f3f58d5..0000000 --- a/pintos-progos/tests/vm/mmap-bad-fd.ck +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/mmap-clean.c b/pintos-progos/tests/vm/mmap-clean.c deleted file mode 100644 index ea1dc9c..0000000 --- a/pintos-progos/tests/vm/mmap-clean.c +++ /dev/null @@ -1,53 +0,0 @@ -/* Verifies that mmap'd regions are only written back on munmap - if the data was actually modified in memory. */ - -#include -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - static const char overwrite[] = "Now is the time for all good..."; - static char buffer[sizeof sample - 1]; - char *actual = (char *) 0x54321000; - int handle; - mapid_t map; - - /* Open file, map, verify data. */ - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK ((map = mmap (handle, actual)) != MAP_FAILED, "mmap \"sample.txt\""); - if (memcmp (actual, sample, strlen (sample))) - fail ("read of mmap'd file reported bad data"); - - /* Modify file. */ - CHECK (write (handle, overwrite, strlen (overwrite)) - == (int) strlen (overwrite), - "write \"sample.txt\""); - - /* Close mapping. Data should not be written back, because we - didn't modify it via the mapping. */ - msg ("munmap \"sample.txt\""); - munmap (map); - - /* Read file back. */ - msg ("seek \"sample.txt\""); - seek (handle, 0); - CHECK (read (handle, buffer, sizeof buffer) == sizeof buffer, - "read \"sample.txt\""); - - /* Verify that file overwrite worked. */ - if (memcmp (buffer, overwrite, strlen (overwrite)) - || memcmp (buffer + strlen (overwrite), sample + strlen (overwrite), - strlen (sample) - strlen (overwrite))) - { - if (!memcmp (buffer, sample, strlen (sample))) - fail ("munmap wrote back clean page"); - else - fail ("read surprising data from file"); - } - else - msg ("file change was retained after munmap"); -} diff --git a/pintos-progos/tests/vm/mmap-clean.ck b/pintos-progos/tests/vm/mmap-clean.ck deleted file mode 100644 index 1666d6c..0000000 --- a/pintos-progos/tests/vm/mmap-clean.ck +++ /dev/null @@ -1,16 +0,0 @@ -# -*- 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" -(mmap-clean) file change was retained after munmap -(mmap-clean) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-close.c b/pintos-progos/tests/vm/mmap-close.c deleted file mode 100644 index d016ee3..0000000 --- a/pintos-progos/tests/vm/mmap-close.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Verifies that memory mappings persist after file close. */ - -#include -#include -#include "tests/vm/sample.inc" -#include "tests/arc4.h" -#include "tests/lib.h" -#include "tests/main.h" - -#define ACTUAL ((void *) 0x10000000) - -void -test_main (void) -{ - int handle; - mapid_t map; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK ((map = mmap (handle, ACTUAL)) != MAP_FAILED, "mmap \"sample.txt\""); - - close (handle); - - if (memcmp (ACTUAL, sample, strlen (sample))) - fail ("read of mmap'd file reported bad data"); - - munmap (map); -} diff --git a/pintos-progos/tests/vm/mmap-close.ck b/pintos-progos/tests/vm/mmap-close.ck deleted file mode 100644 index d15e41a..0000000 --- a/pintos-progos/tests/vm/mmap-close.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/mmap-exit.c b/pintos-progos/tests/vm/mmap-exit.c deleted file mode 100644 index 7a2278a..0000000 --- a/pintos-progos/tests/vm/mmap-exit.c +++ /dev/null @@ -1,22 +0,0 @@ -/* Executes child-mm-wrt and verifies that the writes that should - have occurred really did. */ - -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - pid_t child; - - /* Make child write file. */ - quiet = true; - CHECK ((child = exec ("child-mm-wrt")) != -1, "exec \"child-mm-wrt\""); - CHECK (wait (child) == 0, "wait for child (should return 0)"); - quiet = false; - - /* Check file contents. */ - check_file ("sample.txt", sample, sizeof sample); -} diff --git a/pintos-progos/tests/vm/mmap-exit.ck b/pintos-progos/tests/vm/mmap-exit.ck deleted file mode 100644 index 457d34a..0000000 --- a/pintos-progos/tests/vm/mmap-exit.ck +++ /dev/null @@ -1,17 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-exit) begin -(child-mm-wrt) begin -(child-mm-wrt) create "sample.txt" -(child-mm-wrt) open "sample.txt" -(child-mm-wrt) mmap "sample.txt" -(child-mm-wrt) end -(mmap-exit) open "sample.txt" for verification -(mmap-exit) verified contents of "sample.txt" -(mmap-exit) close "sample.txt" -(mmap-exit) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-inherit.c b/pintos-progos/tests/vm/mmap-inherit.c deleted file mode 100644 index 7fa9607..0000000 --- a/pintos-progos/tests/vm/mmap-inherit.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Maps a file into memory and runs child-inherit to verify that - mappings are not inherited. */ - -#include -#include -#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; - - /* Open file, map, verify data. */ - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, actual) != MAP_FAILED, "mmap \"sample.txt\""); - if (memcmp (actual, sample, strlen (sample))) - fail ("read of mmap'd file reported bad data"); - - /* Spawn child and wait. */ - CHECK ((child = exec ("child-inherit")) != -1, "exec \"child-inherit\""); - quiet = true; - CHECK (wait (child) == -1, "wait for child (should return -1)"); - quiet = false; - - /* Verify data again. */ - CHECK (!memcmp (actual, sample, strlen (sample)), - "checking that mmap'd file still has same data"); -} diff --git a/pintos-progos/tests/vm/mmap-inherit.ck b/pintos-progos/tests/vm/mmap-inherit.ck deleted file mode 100644 index c54638a..0000000 --- a/pintos-progos/tests/vm/mmap-inherit.ck +++ /dev/null @@ -1,16 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); -(mmap-inherit) begin -(mmap-inherit) open "sample.txt" -(mmap-inherit) mmap "sample.txt" -(mmap-inherit) exec "child-inherit" -(child-inherit) begin -child-inherit: exit(-1) -(mmap-inherit) checking that mmap'd file still has same data -(mmap-inherit) end -mmap-inherit: exit(0) -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-lazy-seq.c b/pintos-progos/tests/vm/mmap-lazy-seq.c deleted file mode 100644 index b8f07bd..0000000 --- a/pintos-progos/tests/vm/mmap-lazy-seq.c +++ /dev/null @@ -1,52 +0,0 @@ -/* Create a large file, and mmap it several times, writing to - different pages. Then unmaps the file, and reads the data back - to verify */ - -#include -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -/* Offset needs to be larger or equal to page size */ -#define OFFSET(i) (8192*(i)) -/* Number of times file is mmapped */ -#define N (8) -/* Size of file */ -#define FILE_SIZE (1024*1024) -/* Address for mmap */ -#define ACTUAL(i) ((void *) (0x10000000 + (i)*FILE_SIZE)) - - -void -test_main (void) -{ - int i; - int handle; - mapid_t map[N]; - char buf[1024]; - /* create file */ - CHECK (create ("sample.txt", FILE_SIZE), "create \"sample.txt\""); - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - /* mmap */ - for (i = 0; i < N; i++) { - CHECK ((map[i] = mmap (handle, ACTUAL(i))) != MAP_FAILED, "mmap \"sample.txt\""); - } - /* write */ - for (i = 0; i < N; i++) { - memcpy (buf, ACTUAL(i)+OFFSET(i+N), 1024); /* not checked */ - memcpy (ACTUAL(i)+OFFSET(i), sample, strlen (sample)); - } - /* munmap */ - for (i = 0; i < N; i++) { - munmap (map[i]); - } - /* Read back via read(). */ - for (i = 0; i < N; i++) { - seek (handle, OFFSET(i)); - read (handle, buf, strlen (sample)); - CHECK (!memcmp (buf, sample, strlen (sample)), - "compare read data against written data"); - } - close (handle); -} diff --git a/pintos-progos/tests/vm/mmap-lazy-seq.ck b/pintos-progos/tests/vm/mmap-lazy-seq.ck deleted file mode 100644 index dd0e240..0000000 --- a/pintos-progos/tests/vm/mmap-lazy-seq.ck +++ /dev/null @@ -1,27 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-lazy-seq) begin -(mmap-lazy-seq) create "sample.txt" -(mmap-lazy-seq) open "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) mmap "sample.txt" -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) compare read data against written data -(mmap-lazy-seq) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-misalign.c b/pintos-progos/tests/vm/mmap-misalign.c deleted file mode 100644 index 34141a9..0000000 --- a/pintos-progos/tests/vm/mmap-misalign.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Verifies that misaligned memory mappings are disallowed. */ - -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, (void *) 0x10001234) == MAP_FAILED, - "try to mmap at misaligned address"); -} - diff --git a/pintos-progos/tests/vm/mmap-misalign.ck b/pintos-progos/tests/vm/mmap-misalign.ck deleted file mode 100644 index 145a2e8..0000000 --- a/pintos-progos/tests/vm/mmap-misalign.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-misalign) begin -(mmap-misalign) open "sample.txt" -(mmap-misalign) try to mmap at misaligned address -(mmap-misalign) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-null.c b/pintos-progos/tests/vm/mmap-null.c deleted file mode 100644 index f8ef075..0000000 --- a/pintos-progos/tests/vm/mmap-null.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Verifies that memory mappings at address 0 are disallowed. */ - -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, NULL) == MAP_FAILED, "try to mmap at address 0"); -} - diff --git a/pintos-progos/tests/vm/mmap-null.ck b/pintos-progos/tests/vm/mmap-null.ck deleted file mode 100644 index aacdd65..0000000 --- a/pintos-progos/tests/vm/mmap-null.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/mmap-over-code.c b/pintos-progos/tests/vm/mmap-over-code.c deleted file mode 100644 index d3619a3..0000000 --- a/pintos-progos/tests/vm/mmap-over-code.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Verifies that mapping over the code segment is disallowed. */ - -#include -#include -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - uintptr_t test_main_page = ROUND_DOWN ((uintptr_t) test_main, 4096); - int handle; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, (void *) test_main_page) == MAP_FAILED, - "try to mmap over code segment"); -} - diff --git a/pintos-progos/tests/vm/mmap-over-code.ck b/pintos-progos/tests/vm/mmap-over-code.ck deleted file mode 100644 index b5b23c7..0000000 --- a/pintos-progos/tests/vm/mmap-over-code.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/mmap-over-data.c b/pintos-progos/tests/vm/mmap-over-data.c deleted file mode 100644 index 9ea5d49..0000000 --- a/pintos-progos/tests/vm/mmap-over-data.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Verifies that mapping over the data segment is disallowed. */ - -#include -#include -#include -#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.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, (void *) x_page) == MAP_FAILED, - "try to mmap over data segment"); -} - diff --git a/pintos-progos/tests/vm/mmap-over-data.ck b/pintos-progos/tests/vm/mmap-over-data.ck deleted file mode 100644 index 98770cc..0000000 --- a/pintos-progos/tests/vm/mmap-over-data.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-over-data) begin -(mmap-over-data) open "sample.txt" -(mmap-over-data) try to mmap over data segment -(mmap-over-data) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-over-stk.c b/pintos-progos/tests/vm/mmap-over-stk.c deleted file mode 100644 index 4e241e8..0000000 --- a/pintos-progos/tests/vm/mmap-over-stk.c +++ /dev/null @@ -1,19 +0,0 @@ -/* Verifies that mapping over the stack segment is disallowed. */ - -#include -#include -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - uintptr_t handle_page = ROUND_DOWN ((uintptr_t) &handle, 4096); - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (mmap (handle, (void *) handle_page) == MAP_FAILED, - "try to mmap over stack segment"); -} - diff --git a/pintos-progos/tests/vm/mmap-over-stk.ck b/pintos-progos/tests/vm/mmap-over-stk.ck deleted file mode 100644 index e6880cf..0000000 --- a/pintos-progos/tests/vm/mmap-over-stk.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-over-stk) begin -(mmap-over-stk) open "sample.txt" -(mmap-over-stk) try to mmap over stack segment -(mmap-over-stk) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-overlap.c b/pintos-progos/tests/vm/mmap-overlap.c deleted file mode 100644 index 668ae5f..0000000 --- a/pintos-progos/tests/vm/mmap-overlap.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Verifies that overlapping memory mappings are disallowed. */ - -#include -#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[0], start) != MAP_FAILED, "mmap \"zeros\""); - CHECK ((fd[1] = open ("zeros")) > 1 && fd[0] != fd[1], - "open \"zeros\" again"); - CHECK (mmap (fd[1], start + 4096) == MAP_FAILED, - "try to mmap \"zeros\" again"); -} diff --git a/pintos-progos/tests/vm/mmap-overlap.ck b/pintos-progos/tests/vm/mmap-overlap.ck deleted file mode 100644 index f13801e..0000000 --- a/pintos-progos/tests/vm/mmap-overlap.ck +++ /dev/null @@ -1,13 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-overlap) begin -(mmap-overlap) open "zeros" once -(mmap-overlap) mmap "zeros" -(mmap-overlap) open "zeros" again -(mmap-overlap) try to mmap "zeros" again -(mmap-overlap) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-read.c b/pintos-progos/tests/vm/mmap-read.c deleted file mode 100644 index c0f23a1..0000000 --- a/pintos-progos/tests/vm/mmap-read.c +++ /dev/null @@ -1,32 +0,0 @@ -/* Uses a memory mapping to read a file. */ - -#include -#include -#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 \"sample.txt\""); - CHECK ((map = mmap (handle, actual)) != MAP_FAILED, "mmap \"sample.txt\""); - - /* Check that data is correct. */ - if (memcmp (actual, sample, strlen (sample))) - fail ("read of mmap'd file reported bad data"); - - /* Verify that data is followed by zeros. */ - for (i = strlen (sample); i < 4096; i++) - if (actual[i] != 0) - fail ("byte %zu of mmap'd region has value %02hhx (should be 0)", - i, actual[i]); - - munmap (map); - close (handle); -} diff --git a/pintos-progos/tests/vm/mmap-read.ck b/pintos-progos/tests/vm/mmap-read.ck deleted file mode 100644 index 95ab790..0000000 --- a/pintos-progos/tests/vm/mmap-read.ck +++ /dev/null @@ -1,11 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(mmap-read) begin -(mmap-read) open "sample.txt" -(mmap-read) mmap "sample.txt" -(mmap-read) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-remove.c b/pintos-progos/tests/vm/mmap-remove.c deleted file mode 100644 index 5f7444d..0000000 --- a/pintos-progos/tests/vm/mmap-remove.c +++ /dev/null @@ -1,43 +0,0 @@ -/* Deletes and closes file that is mapped into memory - and verifies that it can still be read through the mapping. */ - -#include -#include -#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; - - /* Map file. */ - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK ((map = mmap (handle, actual)) != MAP_FAILED, "mmap \"sample.txt\""); - - /* Close file and delete it. */ - close (handle); - CHECK (remove ("sample.txt"), "remove \"sample.txt\""); - CHECK (open ("sample.txt") == -1, "try to open \"sample.txt\""); - - /* Create a new file in hopes of overwriting data from the old - one, in case the file system has incorrectly freed the - file's data. */ - CHECK (create ("another", 4096 * 10), "create \"another\""); - - /* Check that mapped data is correct. */ - if (memcmp (actual, sample, strlen (sample))) - fail ("read of mmap'd file reported bad data"); - - /* Verify that data is followed by zeros. */ - for (i = strlen (sample); i < 4096; i++) - if (actual[i] != 0) - fail ("byte %zu of mmap'd region has value %02hhx (should be 0)", - i, actual[i]); - - munmap (map); -} diff --git a/pintos-progos/tests/vm/mmap-remove.ck b/pintos-progos/tests/vm/mmap-remove.ck deleted file mode 100644 index d3cc938..0000000 --- a/pintos-progos/tests/vm/mmap-remove.ck +++ /dev/null @@ -1,14 +0,0 @@ -# -*- 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 -pass; diff --git a/pintos-progos/tests/vm/mmap-shuffle.c b/pintos-progos/tests/vm/mmap-shuffle.c deleted file mode 100644 index 29921ad..0000000 --- a/pintos-progos/tests/vm/mmap-shuffle.c +++ /dev/null @@ -1,38 +0,0 @@ -/* Creates a 128 kB file and repeatedly shuffles data in it - through a memory mapping. */ - -#include -#include -#include -#include "tests/arc4.h" -#include "tests/cksum.h" -#include "tests/lib.h" -#include "tests/main.h" - -#define SIZE (128 * 1024) - -static char *buf = (char *) 0x10000000; - -void -test_main (void) -{ - size_t i; - int handle; - - /* Create file, mmap. */ - CHECK (create ("buffer", SIZE), "create \"buffer\""); - CHECK ((handle = open ("buffer")) > 1, "open \"buffer\""); - CHECK (mmap (handle, buf) != MAP_FAILED, "mmap \"buffer\""); - - /* Initialize. */ - for (i = 0; i < SIZE; i++) - buf[i] = i * 257; - msg ("init: cksum=%lu", cksum (buf, SIZE)); - - /* Shuffle repeatedly. */ - for (i = 0; i < 10; i++) - { - shuffle (buf, SIZE, 1); - msg ("shuffle %zu: cksum=%lu", i, cksum (buf, SIZE)); - } -} diff --git a/pintos-progos/tests/vm/mmap-shuffle.ck b/pintos-progos/tests/vm/mmap-shuffle.ck deleted file mode 100644 index c158301..0000000 --- a/pintos-progos/tests/vm/mmap-shuffle.ck +++ /dev/null @@ -1,47 +0,0 @@ -# -*- 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); -} else { - # Recalculate values. - my ($buf) = ""; - for my $i (0...128 * 1024 - 1) { - $buf .= chr (($i * 257) & 0xff); - } - $init = cksum ($buf); - - random_init (0); - for my $i (1...10) { - $buf = shuffle ($buf, length ($buf), 1); - push (@shuffle, cksum ($buf)); - } -} - -check_expected (IGNORE_EXIT_CODES => 1, [< -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - char *actual[2] = {(char *) 0x10000000, (char *) 0x20000000}; - size_t i; - int handle[2]; - - for (i = 0; i < 2; i++) - { - CHECK ((handle[i] = open ("sample.txt")) > 1, - "open \"sample.txt\" #%zu", i); - CHECK (mmap (handle[i], actual[i]) != MAP_FAILED, - "mmap \"sample.txt\" #%zu at %p", i, (void *) actual[i]); - } - - for (i = 0; i < 2; i++) - CHECK (!memcmp (actual[i], sample, strlen (sample)), - "compare mmap'd file %zu against data", i); -} diff --git a/pintos-progos/tests/vm/mmap-twice.ck b/pintos-progos/tests/vm/mmap-twice.ck deleted file mode 100644 index 05e9724..0000000 --- a/pintos-progos/tests/vm/mmap-twice.ck +++ /dev/null @@ -1,15 +0,0 @@ -# -*- 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'd file 0 against data -(mmap-twice) compare mmap'd file 1 against data -(mmap-twice) end -EOF -pass; diff --git a/pintos-progos/tests/vm/mmap-unmap.c b/pintos-progos/tests/vm/mmap-unmap.c deleted file mode 100644 index d35a79e..0000000 --- a/pintos-progos/tests/vm/mmap-unmap.c +++ /dev/null @@ -1,23 +0,0 @@ -/* Maps and unmaps a file and verifies that the mapped region is - inaccessible afterward. */ - -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -#define ACTUAL ((void *) 0x10000000) - -void -test_main (void) -{ - int handle; - mapid_t map; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK ((map = mmap (handle, ACTUAL)) != MAP_FAILED, "mmap \"sample.txt\""); - - munmap (map); - - fail ("unmapped memory is readable (%d)", *(int *) ACTUAL); -} diff --git a/pintos-progos/tests/vm/mmap-unmap.ck b/pintos-progos/tests/vm/mmap-unmap.ck deleted file mode 100644 index 119658c..0000000 --- a/pintos-progos/tests/vm/mmap-unmap.ck +++ /dev/null @@ -1,7 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -use tests::vm::process_death; - -check_process_death ('mmap-unmap'); diff --git a/pintos-progos/tests/vm/mmap-write.c b/pintos-progos/tests/vm/mmap-write.c deleted file mode 100644 index 46e8043..0000000 --- a/pintos-progos/tests/vm/mmap-write.c +++ /dev/null @@ -1,32 +0,0 @@ -/* 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 -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -#define ACTUAL ((void *) 0x10000000) - -void -test_main (void) -{ - int handle; - mapid_t map; - char buf[1024]; - - /* Write file via mmap. */ - CHECK (create ("sample.txt", strlen (sample)), "create \"sample.txt\""); - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK ((map = mmap (handle, ACTUAL)) != MAP_FAILED, "mmap \"sample.txt\""); - memcpy (ACTUAL, sample, strlen (sample)); - munmap (map); - - /* Read back via read(). */ - read (handle, buf, strlen (sample)); - CHECK (!memcmp (buf, sample, strlen (sample)), - "compare read data against written data"); - close (handle); -} diff --git a/pintos-progos/tests/vm/mmap-write.ck b/pintos-progos/tests/vm/mmap-write.ck deleted file mode 100644 index d2c9cc5..0000000 --- a/pintos-progos/tests/vm/mmap-write.ck +++ /dev/null @@ -1,13 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/mmap-zero.c b/pintos-progos/tests/vm/mmap-zero.c deleted file mode 100644 index 368b759..0000000 --- a/pintos-progos/tests/vm/mmap-zero.c +++ /dev/null @@ -1,27 +0,0 @@ -/* Tries to map a zero-length file, which may or may not work but - should not terminate the process or crash. - Then dereferences the address that we tried to map, - and the process must be terminated with -1 exit code. */ - -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - char *data = (char *) 0x7f000000; - int handle; - - CHECK (create ("empty", 0), "create empty file \"empty\""); - CHECK ((handle = open ("empty")) > 1, "open \"empty\""); - - /* Calling mmap() might succeed or fail. We don't care. */ - msg ("mmap \"empty\""); - mmap (handle, data); - - /* Regardless of whether the call worked, *data should cause - the process to be terminated. */ - fail ("unmapped memory is readable (%d)", *data); -} - diff --git a/pintos-progos/tests/vm/mmap-zero.ck b/pintos-progos/tests/vm/mmap-zero.ck deleted file mode 100644 index 6033d5d..0000000 --- a/pintos-progos/tests/vm/mmap-zero.ck +++ /dev/null @@ -1,12 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); -(mmap-zero) begin -(mmap-zero) create empty file "empty" -(mmap-zero) open "empty" -(mmap-zero) mmap "empty" -mmap-zero: exit(-1) -EOF -pass; diff --git a/pintos-progos/tests/vm/page-linear.c b/pintos-progos/tests/vm/page-linear.c deleted file mode 100644 index 652a47b..0000000 --- a/pintos-progos/tests/vm/page-linear.c +++ /dev/null @@ -1,44 +0,0 @@ -/* Encrypts, then decrypts, 2 MB of memory and verifies that the - values are as they should be. */ - -#include -#include "tests/arc4.h" -#include "tests/lib.h" -#include "tests/main.h" - -#define SIZE (2 * 1024 * 1024) - -static char buf[SIZE]; - -void -test_main (void) -{ - struct arc4 arc4; - size_t i; - - /* Initialize to 0x5a. */ - msg ("initialize"); - memset (buf, 0x5a, sizeof buf); - - /* Check that it's all 0x5a. */ - msg ("read pass"); - for (i = 0; i < SIZE; i++) - if (buf[i] != 0x5a) - fail ("byte %zu != 0x5a", i); - - /* Encrypt zeros. */ - msg ("read/modify/write pass one"); - arc4_init (&arc4, "foobar", 6); - arc4_crypt (&arc4, buf, SIZE); - - /* Decrypt back to zeros. */ - msg ("read/modify/write pass two"); - arc4_init (&arc4, "foobar", 6); - arc4_crypt (&arc4, buf, SIZE); - - /* Check that it's all 0x5a. */ - msg ("read pass"); - for (i = 0; i < SIZE; i++) - if (buf[i] != 0x5a) - fail ("byte %zu != 0x5a", i); -} diff --git a/pintos-progos/tests/vm/page-linear.ck b/pintos-progos/tests/vm/page-linear.ck deleted file mode 100644 index dcbc884..0000000 --- a/pintos-progos/tests/vm/page-linear.ck +++ /dev/null @@ -1,14 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(page-linear) begin -(page-linear) initialize -(page-linear) read pass -(page-linear) read/modify/write pass one -(page-linear) read/modify/write pass two -(page-linear) read pass -(page-linear) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-merge-mm.c b/pintos-progos/tests/vm/page-merge-mm.c deleted file mode 100644 index 908c71c..0000000 --- a/pintos-progos/tests/vm/page-merge-mm.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "tests/main.h" -#include "tests/vm/parallel-merge.h" - -void -test_main (void) -{ - parallel_merge ("child-qsort-mm", 80); -} diff --git a/pintos-progos/tests/vm/page-merge-mm.ck b/pintos-progos/tests/vm/page-merge-mm.ck deleted file mode 100644 index 74fa980..0000000 --- a/pintos-progos/tests/vm/page-merge-mm.ck +++ /dev/null @@ -1,29 +0,0 @@ -# -*- 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 chunk 5 -(page-merge-mm) sort chunk 6 -(page-merge-mm) sort chunk 7 -(page-merge-mm) wait for child 0 -(page-merge-mm) wait for child 1 -(page-merge-mm) wait for child 2 -(page-merge-mm) wait for child 3 -(page-merge-mm) wait for child 4 -(page-merge-mm) wait for child 5 -(page-merge-mm) wait for child 6 -(page-merge-mm) wait for child 7 -(page-merge-mm) merge -(page-merge-mm) verify -(page-merge-mm) success, buf_idx=1,048,576 -(page-merge-mm) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-merge-par.c b/pintos-progos/tests/vm/page-merge-par.c deleted file mode 100644 index e7e1609..0000000 --- a/pintos-progos/tests/vm/page-merge-par.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "tests/main.h" -#include "tests/vm/parallel-merge.h" - -void -test_main (void) -{ - parallel_merge ("child-sort", 123); -} diff --git a/pintos-progos/tests/vm/page-merge-par.ck b/pintos-progos/tests/vm/page-merge-par.ck deleted file mode 100644 index 31f8aa7..0000000 --- a/pintos-progos/tests/vm/page-merge-par.ck +++ /dev/null @@ -1,29 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(page-merge-par) begin -(page-merge-par) init -(page-merge-par) sort chunk 0 -(page-merge-par) sort chunk 1 -(page-merge-par) sort chunk 2 -(page-merge-par) sort chunk 3 -(page-merge-par) sort chunk 4 -(page-merge-par) sort chunk 5 -(page-merge-par) sort chunk 6 -(page-merge-par) sort chunk 7 -(page-merge-par) wait for child 0 -(page-merge-par) wait for child 1 -(page-merge-par) wait for child 2 -(page-merge-par) wait for child 3 -(page-merge-par) wait for child 4 -(page-merge-par) wait for child 5 -(page-merge-par) wait for child 6 -(page-merge-par) wait for child 7 -(page-merge-par) merge -(page-merge-par) verify -(page-merge-par) success, buf_idx=1,048,576 -(page-merge-par) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-merge-seq.c b/pintos-progos/tests/vm/page-merge-seq.c deleted file mode 100644 index 12e3880..0000000 --- a/pintos-progos/tests/vm/page-merge-seq.c +++ /dev/null @@ -1,137 +0,0 @@ -/* 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 -#include "tests/arc4.h" -#include "tests/lib.h" -#include "tests/main.h" - -/* This is the max file size for an older version of the Pintos - file system that had 126 direct blocks each pointing to a - single disk sector. We could raise it now. */ -#define CHUNK_SIZE (126 * 512) -#define CHUNK_CNT 16 /* Number of chunks. */ -#define DATA_SIZE (CHUNK_CNT * CHUNK_SIZE) /* Buffer size. */ - -unsigned char buf1[DATA_SIZE], buf2[DATA_SIZE]; -size_t histogram[256]; - -/* Initialize buf1 with random data, - then count the number of instances of each value within it. */ -static void -init (void) -{ - struct arc4 arc4; - size_t i; - - msg ("init"); - - arc4_init (&arc4, "foobar", 6); - arc4_crypt (&arc4, buf1, sizeof buf1); - for (i = 0; i < sizeof buf1; i++) - histogram[buf1[i]]++; -} - -/* Sort each chunk of buf1 using a subprocess. */ -static void -sort_chunks (void) -{ - size_t i; - - create ("buffer", CHUNK_SIZE); - for (i = 0; i < CHUNK_CNT; i++) - { - pid_t child; - int handle; - - msg ("sort chunk %zu", i); - - /* Write this chunk to a file. */ - quiet = true; - CHECK ((handle = open ("buffer")) > 1, "open \"buffer\""); - write (handle, buf1 + CHUNK_SIZE * i, CHUNK_SIZE); - close (handle); - - /* Sort with subprocess. */ - CHECK ((child = exec ("child-sort buffer")) != -1, - "exec \"child-sort buffer\""); - CHECK (wait (child) == 123, "wait for child-sort"); - - /* Read chunk back from file. */ - CHECK ((handle = open ("buffer")) > 1, "open \"buffer\""); - read (handle, buf1 + CHUNK_SIZE * i, CHUNK_SIZE); - close (handle); - - quiet = false; - } -} - -/* Merge the sorted chunks in buf1 into a fully sorted buf2. */ -static void -merge (void) -{ - unsigned char *mp[CHUNK_CNT]; - size_t mp_left; - unsigned char *op; - size_t i; - - msg ("merge"); - - /* Initialize merge pointers. */ - mp_left = CHUNK_CNT; - for (i = 0; i < CHUNK_CNT; i++) - mp[i] = buf1 + CHUNK_SIZE * i; - - /* Merge. */ - op = buf2; - while (mp_left > 0) - { - /* Find smallest value. */ - size_t min = 0; - for (i = 1; i < mp_left; i++) - if (*mp[i] < *mp[min]) - min = i; - - /* Append value to buf2. */ - *op++ = *mp[min]; - - /* Advance merge pointer. - Delete this chunk from the set if it's emptied. */ - if ((++mp[min] - buf1) % CHUNK_SIZE == 0) - mp[min] = mp[--mp_left]; - } -} - -static void -verify (void) -{ - size_t buf_idx; - size_t hist_idx; - - msg ("verify"); - - buf_idx = 0; - for (hist_idx = 0; hist_idx < sizeof histogram / sizeof *histogram; - hist_idx++) - { - while (histogram[hist_idx]-- > 0) - { - if (buf2[buf_idx] != hist_idx) - fail ("bad value %d in byte %zu", buf2[buf_idx], buf_idx); - buf_idx++; - } - } - - msg ("success, buf_idx=%'zu", buf_idx); -} - -void -test_main (void) -{ - init (); - sort_chunks (); - merge (); - verify (); -} diff --git a/pintos-progos/tests/vm/page-merge-seq.ck b/pintos-progos/tests/vm/page-merge-seq.ck deleted file mode 100644 index d78f69d..0000000 --- a/pintos-progos/tests/vm/page-merge-seq.ck +++ /dev/null @@ -1,29 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(page-merge-seq) begin -(page-merge-seq) init -(page-merge-seq) sort chunk 0 -(page-merge-seq) sort chunk 1 -(page-merge-seq) sort chunk 2 -(page-merge-seq) sort chunk 3 -(page-merge-seq) sort chunk 4 -(page-merge-seq) sort chunk 5 -(page-merge-seq) sort chunk 6 -(page-merge-seq) sort chunk 7 -(page-merge-seq) sort chunk 8 -(page-merge-seq) sort chunk 9 -(page-merge-seq) sort chunk 10 -(page-merge-seq) sort chunk 11 -(page-merge-seq) sort chunk 12 -(page-merge-seq) sort chunk 13 -(page-merge-seq) sort chunk 14 -(page-merge-seq) sort chunk 15 -(page-merge-seq) merge -(page-merge-seq) verify -(page-merge-seq) success, buf_idx=1,032,192 -(page-merge-seq) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-merge-stk.c b/pintos-progos/tests/vm/page-merge-stk.c deleted file mode 100644 index 5eb1069..0000000 --- a/pintos-progos/tests/vm/page-merge-stk.c +++ /dev/null @@ -1,8 +0,0 @@ -#include "tests/main.h" -#include "tests/vm/parallel-merge.h" - -void -test_main (void) -{ - parallel_merge ("child-qsort", 72); -} diff --git a/pintos-progos/tests/vm/page-merge-stk.ck b/pintos-progos/tests/vm/page-merge-stk.ck deleted file mode 100644 index c5bc1ae..0000000 --- a/pintos-progos/tests/vm/page-merge-stk.ck +++ /dev/null @@ -1,29 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(page-merge-stk) begin -(page-merge-stk) init -(page-merge-stk) sort chunk 0 -(page-merge-stk) sort chunk 1 -(page-merge-stk) sort chunk 2 -(page-merge-stk) sort chunk 3 -(page-merge-stk) sort chunk 4 -(page-merge-stk) sort chunk 5 -(page-merge-stk) sort chunk 6 -(page-merge-stk) sort chunk 7 -(page-merge-stk) wait for child 0 -(page-merge-stk) wait for child 1 -(page-merge-stk) wait for child 2 -(page-merge-stk) wait for child 3 -(page-merge-stk) wait for child 4 -(page-merge-stk) wait for child 5 -(page-merge-stk) wait for child 6 -(page-merge-stk) wait for child 7 -(page-merge-stk) merge -(page-merge-stk) verify -(page-merge-stk) success, buf_idx=1,048,576 -(page-merge-stk) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-parallel.c b/pintos-progos/tests/vm/page-parallel.c deleted file mode 100644 index 9d619e0..0000000 --- a/pintos-progos/tests/vm/page-parallel.c +++ /dev/null @@ -1,21 +0,0 @@ -/* Runs 4 child-linear processes at once. */ - -#include -#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-linear\""); - - for (i = 0; i < CHILD_CNT; i++) - CHECK (wait (children[i]) == 0x42, "wait for child %d", i); -} diff --git a/pintos-progos/tests/vm/page-parallel.ck b/pintos-progos/tests/vm/page-parallel.ck deleted file mode 100644 index 90c14ef..0000000 --- a/pintos-progos/tests/vm/page-parallel.ck +++ /dev/null @@ -1,17 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(page-parallel) begin -(page-parallel) exec "child-linear" -(page-parallel) exec "child-linear" -(page-parallel) exec "child-linear" -(page-parallel) exec "child-linear" -(page-parallel) wait for child 0 -(page-parallel) wait for child 1 -(page-parallel) wait for child 2 -(page-parallel) wait for child 3 -(page-parallel) end -EOF -pass; diff --git a/pintos-progos/tests/vm/page-shuffle.c b/pintos-progos/tests/vm/page-shuffle.c deleted file mode 100644 index 095a9da..0000000 --- a/pintos-progos/tests/vm/page-shuffle.c +++ /dev/null @@ -1,30 +0,0 @@ -/* Shuffles a 128 kB data buffer 10 times, printing the checksum - after each time. */ - -#include -#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 (i = 0; i < sizeof buf; i++) - buf[i] = i * 257; - msg ("init: cksum=%lu", cksum (buf, sizeof buf)); - - /* Shuffle repeatedly. */ - for (i = 0; i < 10; i++) - { - shuffle (buf, sizeof buf, 1); - msg ("shuffle %zu: cksum=%lu", i, cksum (buf, sizeof buf)); - } -} diff --git a/pintos-progos/tests/vm/page-shuffle.ck b/pintos-progos/tests/vm/page-shuffle.ck deleted file mode 100644 index 6447d38..0000000 --- a/pintos-progos/tests/vm/page-shuffle.ck +++ /dev/null @@ -1,44 +0,0 @@ -# -*- 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); -} else { - # Recalculate values. - my ($buf) = ""; - for my $i (0...128 * 1024 - 1) { - $buf .= chr (($i * 257) & 0xff); - } - $init = cksum ($buf); - - random_init (0); - for my $i (1...10) { - $buf = shuffle ($buf, length ($buf), 1); - push (@shuffle, cksum ($buf)); - } -} - -check_expected (IGNORE_EXIT_CODES => 1, [< -#include -#include "tests/arc4.h" -#include "tests/lib.h" -#include "tests/main.h" - -#define CHUNK_SIZE (128 * 1024) -#define CHUNK_CNT 8 /* Number of chunks. */ -#define DATA_SIZE (CHUNK_CNT * CHUNK_SIZE) /* Buffer size. */ - -unsigned char buf1[DATA_SIZE], buf2[DATA_SIZE]; -size_t histogram[256]; - -/* Initialize buf1 with random data, - then count the number of instances of each value within it. */ -static void -init (void) -{ - struct arc4 arc4; - size_t i; - - msg ("init"); - - arc4_init (&arc4, "foobar", 6); - arc4_crypt (&arc4, buf1, sizeof buf1); - for (i = 0; i < sizeof buf1; i++) - histogram[buf1[i]]++; -} - -/* Sort each chunk of buf1 using SUBPROCESS, - which is expected to return EXIT_STATUS. */ -static void -sort_chunks (const char *subprocess, int exit_status) -{ - pid_t children[CHUNK_CNT]; - size_t i; - - for (i = 0; i < CHUNK_CNT; i++) - { - char fn[128]; - char cmd[128]; - int handle; - - msg ("sort chunk %zu", i); - - /* Write this chunk to a file. */ - snprintf (fn, sizeof fn, "buf%zu", i); - create (fn, CHUNK_SIZE); - quiet = true; - CHECK ((handle = open (fn)) > 1, "open \"%s\"", fn); - write (handle, buf1 + CHUNK_SIZE * i, CHUNK_SIZE); - close (handle); - - /* Sort with subprocess. */ - snprintf (cmd, sizeof cmd, "%s %s", subprocess, fn); - CHECK ((children[i] = exec (cmd)) != -1, "exec \"%s\"", cmd); - quiet = false; - } - - for (i = 0; i < CHUNK_CNT; i++) - { - char fn[128]; - int handle; - - CHECK (wait (children[i]) == exit_status, "wait for child %zu", i); - - /* Read chunk back from file. */ - quiet = true; - snprintf (fn, sizeof fn, "buf%zu", i); - CHECK ((handle = open (fn)) > 1, "open \"%s\"", fn); - read (handle, buf1 + CHUNK_SIZE * i, CHUNK_SIZE); - close (handle); - quiet = false; - } -} - -/* Merge the sorted chunks in buf1 into a fully sorted buf2. */ -static void -merge (void) -{ - unsigned char *mp[CHUNK_CNT]; - size_t mp_left; - unsigned char *op; - size_t i; - - msg ("merge"); - - /* Initialize merge pointers. */ - mp_left = CHUNK_CNT; - for (i = 0; i < CHUNK_CNT; i++) - mp[i] = buf1 + CHUNK_SIZE * i; - - /* Merge. */ - op = buf2; - while (mp_left > 0) - { - /* Find smallest value. */ - size_t min = 0; - for (i = 1; i < mp_left; i++) - if (*mp[i] < *mp[min]) - min = i; - - /* Append value to buf2. */ - *op++ = *mp[min]; - - /* Advance merge pointer. - Delete this chunk from the set if it's emptied. */ - if ((++mp[min] - buf1) % CHUNK_SIZE == 0) - mp[min] = mp[--mp_left]; - } -} - -static void -verify (void) -{ - size_t buf_idx; - size_t hist_idx; - - msg ("verify"); - - buf_idx = 0; - for (hist_idx = 0; hist_idx < sizeof histogram / sizeof *histogram; - hist_idx++) - { - while (histogram[hist_idx]-- > 0) - { - if (buf2[buf_idx] != hist_idx) - fail ("bad value %d in byte %zu", buf2[buf_idx], buf_idx); - buf_idx++; - } - } - - msg ("success, buf_idx=%'zu", buf_idx); -} - -void -parallel_merge (const char *child_name, int exit_status) -{ - init (); - sort_chunks (child_name, exit_status); - merge (); - verify (); -} diff --git a/pintos-progos/tests/vm/parallel-merge.h b/pintos-progos/tests/vm/parallel-merge.h deleted file mode 100644 index a6b6431..0000000 --- a/pintos-progos/tests/vm/parallel-merge.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef TESTS_VM_PARALLEL_MERGE -#define TESTS_VM_PARALLEL_MERGE 1 - -void parallel_merge (const char *child_name, int exit_status); - -#endif /* tests/vm/parallel-merge.h */ diff --git a/pintos-progos/tests/vm/process_death.pm b/pintos-progos/tests/vm/process_death.pm deleted file mode 100644 index 52039a1..0000000 --- a/pintos-progos/tests/vm/process_death.pm +++ /dev/null @@ -1,22 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; - -sub check_process_death { - my ($proc_name) = @_; - our ($test); - my (@output) = read_text_file ("$test.output"); - - common_checks ("run", @output); - @output = get_core_output ("run", @output); - fail "First line of output is not `($proc_name) begin' message.\n" - if $output[0] ne "($proc_name) begin"; - fail "Output missing '$proc_name: exit(-1)' message.\n" - if !grep ("$proc_name: exit(-1)" eq $_, @output); - fail "Output contains '($proc_name) end' message.\n" - if grep (/\($proc_name\) end/, @output); - pass; -} - -1; diff --git a/pintos-progos/tests/vm/pt-bad-addr.c b/pintos-progos/tests/vm/pt-bad-addr.c deleted file mode 100644 index 3ca4084..0000000 --- a/pintos-progos/tests/vm/pt-bad-addr.c +++ /dev/null @@ -1,11 +0,0 @@ -/* 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); -} diff --git a/pintos-progos/tests/vm/pt-bad-addr.ck b/pintos-progos/tests/vm/pt-bad-addr.ck deleted file mode 100644 index 09ea039..0000000 --- a/pintos-progos/tests/vm/pt-bad-addr.ck +++ /dev/null @@ -1,7 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -use tests::vm::process_death; - -check_process_death ('pt-bad-addr'); diff --git a/pintos-progos/tests/vm/pt-bad-read.c b/pintos-progos/tests/vm/pt-bad-read.c deleted file mode 100644 index ee791ff..0000000 --- a/pintos-progos/tests/vm/pt-bad-read.c +++ /dev/null @@ -1,16 +0,0 @@ -/* Reads from a file into a bad address. - The process must be terminated with -1 exit code. */ - -#include -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - read (handle, (char *) &handle - 4096, 1); - fail ("survived reading data into bad address"); -} diff --git a/pintos-progos/tests/vm/pt-bad-read.ck b/pintos-progos/tests/vm/pt-bad-read.ck deleted file mode 100644 index 1f96bb4..0000000 --- a/pintos-progos/tests/vm/pt-bad-read.ck +++ /dev/null @@ -1,10 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/pt-big-stk-obj.c b/pintos-progos/tests/vm/pt-big-stk-obj.c deleted file mode 100644 index 6b630ec..0000000 --- a/pintos-progos/tests/vm/pt-big-stk-obj.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Allocates and writes to a 64 kB object on the stack. - This must succeed. */ - -#include -#include "tests/arc4.h" -#include "tests/cksum.h" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - char stk_obj[65536]; - struct arc4 arc4; - - arc4_init (&arc4, "foobar", 6); - memset (stk_obj, 0, sizeof stk_obj); - arc4_crypt (&arc4, stk_obj, sizeof stk_obj); - msg ("cksum: %lu", cksum (stk_obj, sizeof stk_obj)); -} diff --git a/pintos-progos/tests/vm/pt-big-stk-obj.ck b/pintos-progos/tests/vm/pt-big-stk-obj.ck deleted file mode 100644 index eb5853a..0000000 --- a/pintos-progos/tests/vm/pt-big-stk-obj.ck +++ /dev/null @@ -1,10 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/pt-grow-bad.c b/pintos-progos/tests/vm/pt-grow-bad.c deleted file mode 100644 index d4beba2..0000000 --- a/pintos-progos/tests/vm/pt-grow-bad.c +++ /dev/null @@ -1,14 +0,0 @@ -/* Read from an address 4,096 bytes below the stack pointer. - The process must be terminated with -1 exit code. */ - -#include -#include "tests/arc4.h" -#include "tests/cksum.h" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - asm volatile ("movl -4096(%esp), %eax"); -} diff --git a/pintos-progos/tests/vm/pt-grow-bad.ck b/pintos-progos/tests/vm/pt-grow-bad.ck deleted file mode 100644 index 4c0ab8a..0000000 --- a/pintos-progos/tests/vm/pt-grow-bad.ck +++ /dev/null @@ -1,9 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']); -(pt-grow-bad) begin -pt-grow-bad: exit(-1) -EOF -pass; diff --git a/pintos-progos/tests/vm/pt-grow-pusha.c b/pintos-progos/tests/vm/pt-grow-pusha.c deleted file mode 100644 index f9762a5..0000000 --- a/pintos-progos/tests/vm/pt-grow-pusha.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Expand the stack by 32 bytes all at once using the PUSHA - instruction. - This must succeed. */ - -#include -#include "tests/arc4.h" -#include "tests/cksum.h" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - asm volatile - ("movl %%esp, %%eax;" /* Save a copy of the stack pointer. */ - "andl $0xfffff000, %%esp;" /* Move stack pointer to bottom of page. */ - "pushal;" /* Push 32 bytes on stack at once. */ - "movl %%eax, %%esp" /* Restore copied stack pointer. */ - : : : "eax"); /* Tell GCC we destroyed eax. */ -} diff --git a/pintos-progos/tests/vm/pt-grow-pusha.ck b/pintos-progos/tests/vm/pt-grow-pusha.ck deleted file mode 100644 index 5000966..0000000 --- a/pintos-progos/tests/vm/pt-grow-pusha.ck +++ /dev/null @@ -1,9 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(pt-grow-pusha) begin -(pt-grow-pusha) end -EOF -pass; diff --git a/pintos-progos/tests/vm/pt-grow-stack.c b/pintos-progos/tests/vm/pt-grow-stack.c deleted file mode 100644 index 0997a00..0000000 --- a/pintos-progos/tests/vm/pt-grow-stack.c +++ /dev/null @@ -1,20 +0,0 @@ -/* Demonstrate that the stack can grow. - This must succeed. */ - -#include -#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 stack_obj); - arc4_crypt (&arc4, stack_obj, sizeof stack_obj); - msg ("cksum: %lu", cksum (stack_obj, sizeof stack_obj)); -} diff --git a/pintos-progos/tests/vm/pt-grow-stack.ck b/pintos-progos/tests/vm/pt-grow-stack.ck deleted file mode 100644 index 1e669db..0000000 --- a/pintos-progos/tests/vm/pt-grow-stack.ck +++ /dev/null @@ -1,10 +0,0 @@ -# -*- 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; diff --git a/pintos-progos/tests/vm/pt-grow-stk-sc.c b/pintos-progos/tests/vm/pt-grow-stk-sc.c deleted file mode 100644 index 3efbb5f..0000000 --- a/pintos-progos/tests/vm/pt-grow-stk-sc.c +++ /dev/null @@ -1,32 +0,0 @@ -/* This test checks that the stack is properly extended even if - the first access to a stack location occurs inside a system - call. - - From Godmar Back. */ - -#include -#include -#include "tests/vm/sample.inc" -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - int slen = strlen (sample); - char buf2[65536]; - - /* Write file via write(). */ - CHECK (create ("sample.txt", slen), "create \"sample.txt\""); - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - CHECK (write (handle, sample, slen) == slen, "write \"sample.txt\""); - close (handle); - - /* Read back via read(). */ - CHECK ((handle = open ("sample.txt")) > 1, "2nd open \"sample.txt\""); - CHECK (read (handle, buf2 + 32768, slen) == slen, "read \"sample.txt\""); - - CHECK (!memcmp (sample, buf2 + 32768, slen), "compare written data against read data"); - close (handle); -} diff --git a/pintos-progos/tests/vm/pt-grow-stk-sc.ck b/pintos-progos/tests/vm/pt-grow-stk-sc.ck deleted file mode 100644 index 23d3b02..0000000 --- a/pintos-progos/tests/vm/pt-grow-stk-sc.ck +++ /dev/null @@ -1,15 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected (IGNORE_EXIT_CODES => 1, [<<'EOF']); -(pt-grow-stk-sc) begin -(pt-grow-stk-sc) create "sample.txt" -(pt-grow-stk-sc) open "sample.txt" -(pt-grow-stk-sc) write "sample.txt" -(pt-grow-stk-sc) 2nd open "sample.txt" -(pt-grow-stk-sc) read "sample.txt" -(pt-grow-stk-sc) compare written data against read data -(pt-grow-stk-sc) end -EOF -pass; diff --git a/pintos-progos/tests/vm/pt-write-code-2.c b/pintos-progos/tests/vm/pt-write-code-2.c deleted file mode 100644 index 83bcc2c..0000000 --- a/pintos-progos/tests/vm/pt-write-code-2.c +++ /dev/null @@ -1,15 +0,0 @@ -/* Try to write to the code segment using a system call. - The process must be terminated with -1 exit code. */ - -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - int handle; - - CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); - read (handle, (void *) test_main, 1); - fail ("survived reading data into code segment"); -} diff --git a/pintos-progos/tests/vm/pt-write-code.c b/pintos-progos/tests/vm/pt-write-code.c deleted file mode 100644 index 5072cec..0000000 --- a/pintos-progos/tests/vm/pt-write-code.c +++ /dev/null @@ -1,12 +0,0 @@ -/* Try to write to the code segment. - The process must be terminated with -1 exit code. */ - -#include "tests/lib.h" -#include "tests/main.h" - -void -test_main (void) -{ - *(int *) test_main = 0; - fail ("writing the code segment succeeded"); -} diff --git a/pintos-progos/tests/vm/pt-write-code.ck b/pintos-progos/tests/vm/pt-write-code.ck deleted file mode 100644 index 65610fb..0000000 --- a/pintos-progos/tests/vm/pt-write-code.ck +++ /dev/null @@ -1,7 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -use tests::vm::process_death; - -check_process_death ('pt-write-code'); diff --git a/pintos-progos/tests/vm/pt-write-code2.ck b/pintos-progos/tests/vm/pt-write-code2.ck deleted file mode 100644 index 69ffc77..0000000 --- a/pintos-progos/tests/vm/pt-write-code2.ck +++ /dev/null @@ -1,10 +0,0 @@ -# -*- perl -*- -use strict; -use warnings; -use tests::tests; -check_expected ([<<'EOF']); -(pt-write-code2) begin -(pt-write-code2) open "sample.txt" -pt-write-code2: exit(-1) -EOF -pass; diff --git a/pintos-progos/tests/vm/qsort.c b/pintos-progos/tests/vm/qsort.c deleted file mode 100644 index 922572c..0000000 --- a/pintos-progos/tests/vm/qsort.c +++ /dev/null @@ -1,136 +0,0 @@ -#include "tests/vm/qsort.h" -#include -#include -#include - -/* Picks a pivot for the quicksort from the SIZE bytes in BUF. */ -static unsigned char -pick_pivot (unsigned char *buf, size_t size) -{ - ASSERT (size >= 1); - return buf[random_ulong () % size]; -} - -/* Checks whether the SIZE bytes in ARRAY are divided into an - initial LEFT_SIZE elements all less than PIVOT followed by - SIZE - LEFT_SIZE elements all greater than or equal to - PIVOT. */ -static bool -is_partitioned (const unsigned char *array, size_t size, - unsigned char pivot, size_t left_size) -{ - size_t i; - - for (i = 0; i < left_size; i++) - if (array[i] >= pivot) - return false; - - for (; i < size; i++) - if (array[i] < pivot) - return false; - - return true; -} - -/* Swaps the bytes at *A and *B. */ -static void -swap (unsigned char *a, unsigned char *b) -{ - unsigned char t = *a; - *a = *b; - *b = t; -} - -/* Partitions ARRAY in-place in an initial run of bytes all less - than PIVOT, followed by a run of bytes all greater than or - equal to PIVOT. Returns the length of the initial run. */ -static size_t -partition (unsigned char *array, size_t size, int pivot) -{ - size_t left_size = size; - unsigned char *first = array; - unsigned char *last = first + left_size; - - for (;;) - { - /* Move FIRST forward to point to first element greater than - PIVOT. */ - for (;;) - { - if (first == last) - { - ASSERT (is_partitioned (array, size, pivot, left_size)); - return left_size; - } - else if (*first >= pivot) - break; - - first++; - } - left_size--; - - /* Move LAST backward to point to last element no bigger - than PIVOT. */ - for (;;) - { - last--; - - if (first == last) - { - ASSERT (is_partitioned (array, size, pivot, left_size)); - return left_size; - } - else if (*last < pivot) - break; - else - left_size--; - } - - /* By swapping FIRST and LAST we extend the starting and - ending sequences that pass and fail, respectively, - PREDICATE. */ - swap (first, last); - first++; - } -} - -/* Returns true if the SIZE bytes in BUF are in nondecreasing - order, false otherwise. */ -static bool -is_sorted (const unsigned char *buf, size_t size) -{ - size_t i; - - for (i = 1; i < size; i++) - if (buf[i - 1] > buf[i]) - return false; - - return true; -} - -/* Sorts the SIZE bytes in BUF into nondecreasing order, using - the quick-sort algorithm. */ -void -qsort_bytes (unsigned char *buf, size_t size) -{ - if (!is_sorted (buf, size)) - { - int pivot = pick_pivot (buf, size); - - unsigned char *left_half = buf; - size_t left_size = partition (buf, size, pivot); - unsigned char *right_half = left_half + left_size; - size_t right_size = size - left_size; - - if (left_size <= right_size) - { - qsort_bytes (left_half, left_size); - qsort_bytes (right_half, right_size); - } - else - { - qsort_bytes (right_half, right_size); - qsort_bytes (left_half, left_size); - } - } -} diff --git a/pintos-progos/tests/vm/qsort.h b/pintos-progos/tests/vm/qsort.h deleted file mode 100644 index 61b65f3..0000000 --- a/pintos-progos/tests/vm/qsort.h +++ /dev/null @@ -1,8 +0,0 @@ -#ifndef TESTS_VM_QSORT_H -#define TESTS_VM_QSORT_H 1 - -#include - -void qsort_bytes (unsigned char *buf, size_t size); - -#endif /* tests/vm/qsort.h */ diff --git a/pintos-progos/tests/vm/sample.inc b/pintos-progos/tests/vm/sample.inc deleted file mode 100644 index a60a139..0000000 --- a/pintos-progos/tests/vm/sample.inc +++ /dev/null @@ -1,19 +0,0 @@ -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 at once. For example, the following\n" - "code shows how to destructure a cons (SOME-CONS) into its two slots\n" - "(THE-CAR and THE-CDR):\n" - "\n" - " (MULTIPLE-VALUE-BIND (THE-CAR THE-CDR) (CAR SOME-CONS) ...)\n" - "\n" - "For symmetry with CAR, CDR returns a second value which is the CAR of\n" - "the object. In a related change, the functions MAKE-ARRAY and CONS\n" - "have been fixed so they don't allocate any storage except on the\n" - "stack. This should hopefully help people who don't like using the\n" - "garbage collector because it cold boots the machine so often.\n" -}; diff --git a/pintos-progos/tests/vm/sample.txt b/pintos-progos/tests/vm/sample.txt deleted file mode 100644 index c446830..0000000 --- a/pintos-progos/tests/vm/sample.txt +++ /dev/null @@ -1,17 +0,0 @@ -=== ALL USERS PLEASE NOTE ======================== - -CAR and CDR now return extra values. - -The function CAR now returns two values. Since it has to go to the -trouble to figure out if the object is carcdr-able anyway, we figured -you might as well get both halves at once. For example, the following -code shows how to destructure a cons (SOME-CONS) into its two slots -(THE-CAR and THE-CDR): - - (MULTIPLE-VALUE-BIND (THE-CAR THE-CDR) (CAR SOME-CONS) ...) - -For symmetry with CAR, CDR returns a second value which is the CAR of -the object. In a related change, the functions MAKE-ARRAY and CONS -have been fixed so they don't allocate any storage except on the -stack. This should hopefully help people who don't like using the -garbage collector because it cold boots the machine so often. -- cgit v1.2.3