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 ([<<'EOF']);
(read-normal) begin
(read-normal) open "sample.txt" for verification
(read-normal) verified contents of "sample.txt"
(read-normal) close "sample.txt"
(read-normal) end
read-normal: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-normal.ck | Perl | oos | 286 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(create-null) begin
create-null: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-null.ck | Perl | oos | 139 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(read-zero) begin
(read-zero) open "sample.txt"
(read-zero) end
read-zero: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-zero.ck | Perl | oos | 180 |
/* Passes an invalid pointer to the write system call.
The process must be terminated with -1 exit code. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle;
CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
write (handle, (char *) 0x10123420, 123);
fail ("should have exited with -1");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/write-bad-ptr.c | C | oos | 375 |
/* Ensure that the executable of a running process cannot be
modified, even by a child process. */
#define CHILD_CNT "1"
#include "tests/userprog/rox-child.inc"
| 10cm | trunk/10cm/pintos/src/tests/userprog/rox-child.c | C | oos | 165 |
/* Utility function for tests that try to break system calls by
passing them data that crosses from one virtual page to
another. */
#include <inttypes.h>
#include <round.h>
#include <string.h>
#include "tests/userprog/boundary.h"
static char dst[8192];
/* Returns the beginning of a page. There are at least 2048
modifiable bytes on either side of the pointer returned. */
void *
get_boundary_area (void)
{
char *p = (char *) ROUND_UP ((uintptr_t) dst, 4096);
if (p - dst < 2048)
p += 4096;
return p;
}
/* Returns a copy of SRC split across the boundary between two
pages. */
char *
copy_string_across_boundary (const char *src)
{
char *p = get_boundary_area ();
p -= strlen (src) < 4096 ? strlen (src) / 2 : 4096;
strlcpy (p, src, 4096);
return p;
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/boundary.c | C | oos | 789 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']);
(bad-read2) begin
bad-read2: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/bad-read2.ck | Perl | oos | 160 |
/* Child process run by exec-multiple, exec-one, wait-simple, and
wait-twice tests.
Just prints a single message and terminates. */
#include <stdio.h>
#include "tests/lib.h"
const char *test_name = "child-simple";
int
main (void)
{
msg ("run");
return 81;
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/child-simple.c | C | oos | 272 |
/* Invokes a system call with one byte of the system call's
argument on a separate page from the rest of the bytes. This
must work. */
#include <syscall-nr.h>
#include "tests/userprog/boundary.h"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
/* Make one byte of a syscall argument hang over into a second
page. */
int *p = (int *) ((char *) get_boundary_area () - 7);
p[0] = SYS_EXIT;
p[1] = 67;
/* Invoke the system call. */
asm volatile ("movl %0, %%esp; int $0x30" : : "g" (p));
fail ("should have called exit(67)");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/sc-boundary-2.c | C | oos | 577 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(exec-multiple) begin
(child-simple) run
child-simple: exit(81)
(child-simple) run
child-simple: exit(81)
(child-simple) run
child-simple: exit(81)
(child-simple) run
child-simple: exit(81)
(exec-multiple) end
exec-multiple: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/exec-multiple.ck | Perl | oos | 330 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(exit) begin
exit: exit(57)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/exit.ck | Perl | oos | 125 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(write-normal) begin
(write-normal) create "test.txt"
(write-normal) open "test.txt"
(write-normal) end
write-normal: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/write-normal.ck | Perl | oos | 223 |
#ifndef TESTS_CKSUM_H
#define TESTS_CKSUM_H
#include <stddef.h>
unsigned long cksum(const void *, size_t);
#endif /* tests/cksum.h */
| 10cm | trunk/10cm/pintos/src/tests/cksum.h | C | oos | 137 |
# -*- makefile -*-
include $(patsubst %,$(SRCDIR)/%/Make.tests,$(TEST_SUBDIRS))
PROGS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_PROGS))
TESTS = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_TESTS))
EXTRA_GRADES = $(foreach subdir,$(TEST_SUBDIRS),$($(subdir)_EXTRA_GRADES))
OUTPUTS = $(addsuffix .output,$(TESTS) $(EXTRA_GRADES))
ERRORS = $(addsuffix .errors,$(TESTS) $(EXTRA_GRADES))
RESULTS = $(addsuffix .result,$(TESTS) $(EXTRA_GRADES))
ifdef PROGS
include ../../Makefile.userprog
endif
TIMEOUT = 60
clean::
rm -f $(OUTPUTS) $(ERRORS) $(RESULTS)
grade:: results
$(SRCDIR)/tests/make-grade $(SRCDIR) $< $(GRADING_FILE) | tee $@
check:: results
@cat $<
@COUNT="`egrep '^(pass|FAIL) ' $< | wc -l | sed 's/[ ]//g;'`"; \
FAILURES="`egrep '^FAIL ' $< | wc -l | sed 's/[ ]//g;'`"; \
if [ $$FAILURES = 0 ]; then \
echo "All $$COUNT tests passed."; \
else \
echo "$$FAILURES of $$COUNT tests failed."; \
exit 1; \
fi
results: $(RESULTS)
@for d in $(TESTS) $(EXTRA_GRADES); do \
if echo PASS | cmp -s $$d.result -; then \
echo "pass $$d"; \
else \
echo "FAIL $$d"; \
fi; \
done > $@
outputs:: $(OUTPUTS)
$(foreach prog,$(PROGS),$(eval $(prog).output: $(prog)))
$(foreach test,$(TESTS),$(eval $(test).output: $($(test)_PUTFILES)))
$(foreach test,$(TESTS),$(eval $(test).output: TEST = $(test)))
# Prevent an environment variable VERBOSE from surprising us.
VERBOSE =
TESTCMD = pintos -v -k -T $(TIMEOUT)
TESTCMD += $(SIMULATOR)
TESTCMD += $(PINTOSOPTS)
ifeq ($(filter userprog, $(KERNEL_SUBDIRS)), userprog)
TESTCMD += --fs-disk=$(FSDISK)
TESTCMD += $(foreach file,$(PUTFILES),-p $(file) -a $(notdir $(file)))
endif
ifeq ($(filter vm, $(KERNEL_SUBDIRS)), vm)
TESTCMD += --swap-disk=4
endif
TESTCMD += -- -q
TESTCMD += $(KERNELFLAGS)
ifeq ($(filter userprog, $(KERNEL_SUBDIRS)), userprog)
TESTCMD += -f
endif
TESTCMD += $(if $($(TEST)_ARGS),run '$(*F) $($(TEST)_ARGS)',run $(*F))
TESTCMD += < /dev/null
TESTCMD += 2> $(TEST).errors $(if $(VERBOSE),|tee,>) $(TEST).output
%.output: os.dsk
$(TESTCMD)
%.result: %.ck %.output
perl -I$(SRCDIR) $< $* $@
| 10cm | trunk/10cm/pintos/src/tests/.svn/text-base/Make.tests.svn-base | Makefile | oos | 2,138 |
#! /usr/bin/perl
use strict;
use warnings;
@ARGV == 3 || die;
my ($src_dir, $results_file, $grading_file) = @ARGV;
# Read pass/file verdicts from $results_file.
open (RESULTS, '<', $results_file) || die "$results_file: open: $!\n";
my (%verdicts, %verdict_counts);
while (<RESULTS>) {
my ($verdict, $test) = /^(pass|FAIL) (.*)$/ or die;
$verdicts{$test} = $verdict eq 'pass';
}
close RESULTS;
my (@failures);
my (@overall, @rubrics, @summary);
my ($pct_actual, $pct_possible) = (0, 0);
# Read grading file.
my (@items);
open (GRADING, '<', $grading_file) || die "$grading_file: open: $!\n";
while (<GRADING>) {
s/#.*//;
next if /^\s*$/;
my ($max_pct, $rubric_suffix) = /^\s*(\d+(?:\.\d+)?)%\t(.*)/ or die;
my ($dir) = $rubric_suffix =~ /^(.*)\//;
my ($rubric_file) = "$src_dir/$rubric_suffix";
open (RUBRIC, '<', $rubric_file) or die "$rubric_file: open: $!\n";
# Rubric file must begin with title line.
my $title = <RUBRIC>;
chomp $title;
$title =~ s/:$// or die;
$title .= " ($rubric_suffix):";
push (@rubrics, $title);
my ($score, $possible) = (0, 0);
my ($cnt, $passed) = (0, 0);
my ($was_score) = 0;
while (<RUBRIC>) {
chomp;
push (@rubrics, "\t$_"), next if /^-/;
push (@rubrics, ""), next if /^\s*$/;
my ($poss, $name) = /^(\d+)\t(.*)$/ or die;
my ($test) = "$dir/$name";
my ($points) = 0;
if (!defined $verdicts{$test}) {
push (@overall, "warning: $test not tested, assuming failure");
} elsif ($verdicts{$test}) {
$points = $poss;
$passed++;
}
push (@failures, $test) if !$points;
$verdict_counts{$test}++;
push (@rubrics, sprintf ("\t%4s%2d/%2d %s",
$points ? '' : '**', $points, $poss, $test));
$score += $points;
$possible += $poss;
$cnt++;
}
close (RUBRIC);
push (@rubrics, "");
push (@rubrics, "\t- Section summary.");
push (@rubrics, sprintf ("\t%4s%3d/%3d %s",
'', $passed, $cnt, 'tests passed'));
push (@rubrics, sprintf ("\t%4s%3d/%3d %s",
'', $score, $possible, 'points subtotal'));
push (@rubrics, '');
my ($pct) = ($score / $possible) * $max_pct;
push (@summary, sprintf ("%-45s %3d/%3d %5.1f%%/%5.1f%%",
$rubric_suffix,
$score, $possible,
$pct, $max_pct));
$pct_actual += $pct;
$pct_possible += $max_pct;
}
close GRADING;
my ($sum_line)
= "--------------------------------------------- --- --- ------ ------";
unshift (@summary,
"SUMMARY BY TEST SET",
'',
sprintf ("%-45s %3s %3s %6s %6s",
"Test Set", "Pts", "Max", "% Ttl", "% Max"),
$sum_line);
push (@summary,
$sum_line,
sprintf ("%-45s %3s %3s %5.1f%%/%5.1f%%",
'Total', '', '', $pct_actual, $pct_possible));
unshift (@rubrics,
"SUMMARY OF INDIVIDUAL TESTS",
'');
foreach my $name (keys (%verdicts)) {
my ($count) = $verdict_counts{$name};
if (!defined ($count) || $count != 1) {
if (!defined ($count) || !$count) {
push (@overall, "warning: test $name doesn't count for grading");
} else {
push (@overall,
"warning: test $name counted $count times in grading");
}
}
}
push (@overall, sprintf ("TOTAL TESTING SCORE: %.1f%%", $pct_actual));
if (sprintf ("%.1f", $pct_actual) eq sprintf ("%.1f", $pct_possible)) {
push (@overall, "ALL TESTED PASSED -- PERFECT SCORE");
}
my (@divider) = ('', '- ' x 38, '');
print map ("$_\n", @overall, @divider, @summary, @divider, @rubrics);
for my $test (@failures) {
print map ("$_\n", @divider);
print "DETAILS OF $test FAILURE:\n\n";
if (open (RESULT, '<', "$test.result")) {
my $first_line = <RESULT>;
my ($cnt) = 0;
while (<RESULT>) {
print;
$cnt++;
}
close (RESULT);
}
if (open (OUTPUT, '<', "$test.output")) {
print "\nOUTPUT FROM $test:\n\n";
my ($panics, $boots) = (0, 0);
while (<OUTPUT>) {
if (/PANIC/ && ++$panics > 2) {
print "[...details of additional panic(s) omitted...]\n";
last;
}
print;
if (/Pintos booting/ && ++$boots > 1) {
print "[...details of reboot(s) omitted...]\n";
last;
}
}
close (OUTPUT);
}
}
| 10cm | trunk/10cm/pintos/src/tests/.svn/text-base/make-grade.svn-base | Perl | oos | 4,096 |
/* Creates a 128 kB file and repeatedly shuffles data in it
through a memory mapping. */
#include <stdio.h>
#include <string.h>
#include <syscall.h>
#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));
}
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-shuffle.c | C | oos | 858 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/process_death.pm | Perl | oos | 618 |
/* Maps and unmaps a file and verifies that the mapped region is
inaccessible afterward. */
#include <syscall.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-unmap.c | C | oos | 517 |
/* Verifies that mapping over the code segment is disallowed. */
#include <stdint.h>
#include <round.h>
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-code.c | C | oos | 465 |
#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 */
| 10cm | trunk/10cm/pintos/src/tests/vm/parallel-merge.h | C | oos | 170 |
/* 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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-write-code-2.c | C | oos | 364 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-exit.ck | Perl | oos | 420 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-data.ck | Perl | oos | 247 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-par.ck | Perl | oos | 790 |
#include "tests/main.h"
#include "tests/vm/parallel-merge.h"
void
test_main (void)
{
parallel_merge ("child-sort", 123);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-par.c | C | oos | 127 |
/* Maps the same file into memory twice and verifies that the
same data is readable in both. */
#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[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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-twice.c | C | oos | 742 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/page-parallel.ck | Perl | oos | 439 |
/* Verifies that mmap'd regions are only written back on munmap
if the data was actually modified in memory. */
#include <string.h>
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-clean.c | C | oos | 1,663 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-stk.ck | Perl | oos | 244 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-misalign.ck | Perl | oos | 247 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-stk-sc.ck | Perl | oos | 403 |
/* Reads from a file into a bad address.
The process must be terminated with -1 exit code. */
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-bad-read.c | C | oos | 373 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-seq.ck | Perl | oos | 764 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-write-code2.ck | Perl | oos | 180 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-zero.ck | Perl | oos | 248 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('mmap-unmap');
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-unmap.ck | Perl | oos | 126 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-pusha.ck | Perl | oos | 163 |
/* 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 <string.h>
#include <syscall.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-stk-sc.c | C | oos | 917 |
/* Expand the stack by 32 bytes all at once using the PUSHA
instruction.
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)
{
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. */
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-pusha.c | C | oos | 616 |
/* 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 <syscall.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-zero.c | C | oos | 763 |
#include "tests/main.h"
#include "tests/vm/parallel-merge.h"
void
test_main (void)
{
parallel_merge ("child-qsort", 72);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-stk.c | C | oos | 127 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/page-merge-stk.ck | Perl | oos | 790 |
/* Deletes and closes file that is mapped into memory
and verifies that it can still be read through the mapping. */
#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;
/* 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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-remove.c | C | oos | 1,275 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('pt-write-code');
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-write-code.ck | Perl | oos | 129 |
#include "tests/vm/qsort.h"
#include <stdbool.h>
#include <debug.h>
#include <random.h>
/* 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);
}
}
}
| 10cm | trunk/10cm/pintos/src/tests/vm/qsort.c | C | oos | 3,265 |
/* Read from an address 4,096 bytes below the stack pointer.
The process must be terminated with -1 exit code. */
#include <string.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-bad.c | C | oos | 304 |
/* Verifies that misaligned memory mappings are disallowed. */
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-misalign.c | C | oos | 353 |
/* Verifies that memory mappings at address 0 are disallowed. */
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-null.c | C | oos | 322 |
/* Child process of page-parallel.
Encrypts 1 MB of zeros, then decrypts it, and ensures that
the zeros are back. */
#include <string.h>
#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;
}
| 10cm | trunk/10cm/pintos/src/tests/vm/child-linear.c | C | oos | 754 |
/* Allocates and writes to a 64 kB object on the stack.
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 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));
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-big-stk-obj.c | C | oos | 444 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-inherit.ck | Perl | oos | 393 |
# -*- 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, [<<EOF]);
(mmap-shuffle) begin
(mmap-shuffle) create "buffer"
(mmap-shuffle) open "buffer"
(mmap-shuffle) mmap "buffer"
(mmap-shuffle) init: cksum=$init
(mmap-shuffle) shuffle 0: cksum=$shuffle[0]
(mmap-shuffle) shuffle 1: cksum=$shuffle[1]
(mmap-shuffle) shuffle 2: cksum=$shuffle[2]
(mmap-shuffle) shuffle 3: cksum=$shuffle[3]
(mmap-shuffle) shuffle 4: cksum=$shuffle[4]
(mmap-shuffle) shuffle 5: cksum=$shuffle[5]
(mmap-shuffle) shuffle 6: cksum=$shuffle[6]
(mmap-shuffle) shuffle 7: cksum=$shuffle[7]
(mmap-shuffle) shuffle 8: cksum=$shuffle[8]
(mmap-shuffle) shuffle 9: cksum=$shuffle[9]
(mmap-shuffle) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-shuffle.ck | Perl | oos | 1,267 |
/* Verifies that mapping over the stack segment is disallowed. */
#include <stdint.h>
#include <round.h>
#include <syscall.h>
#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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-over-stk.c | C | oos | 459 |
/* Mmaps a 128 kB file "sorts" the bytes in it, using quick sort,
a multi-pass divide and conquer algorithm. */
#include <debug.h>
#include <syscall.h>
#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;
}
| 10cm | trunk/10cm/pintos/src/tests/vm/child-qsort-mm.c | C | oos | 583 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-overlap.ck | Perl | oos | 297 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-grow-bad.ck | Perl | oos | 164 |
/* 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");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-write-code.c | C | oos | 241 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-read.ck | Perl | oos | 215 |
/* Tries to mmap an invalid fd,
which must either fail silently or terminate the process with
exit code -1. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
CHECK (mmap (0x5678, (void *) 0x10000000) == MAP_FAILED,
"try to mmap invalid fd");
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-bad-fd.c | C | oos | 310 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-merge-seq.ck.svn-base | Perl | oos | 764 |
# -*- 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/.svn/text-base/pt-big-stk-obj.ck.svn-base | Perl | oos | 200 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-remove.ck.svn-base | Perl | oos | 327 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-misalign.ck.svn-base | Perl | oos | 247 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-grow-bad.ck.svn-base | Perl | oos | 164 |
# -*- 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, [<<EOF]);
(mmap-shuffle) begin
(mmap-shuffle) create "buffer"
(mmap-shuffle) open "buffer"
(mmap-shuffle) mmap "buffer"
(mmap-shuffle) init: cksum=$init
(mmap-shuffle) shuffle 0: cksum=$shuffle[0]
(mmap-shuffle) shuffle 1: cksum=$shuffle[1]
(mmap-shuffle) shuffle 2: cksum=$shuffle[2]
(mmap-shuffle) shuffle 3: cksum=$shuffle[3]
(mmap-shuffle) shuffle 4: cksum=$shuffle[4]
(mmap-shuffle) shuffle 5: cksum=$shuffle[5]
(mmap-shuffle) shuffle 6: cksum=$shuffle[6]
(mmap-shuffle) shuffle 7: cksum=$shuffle[7]
(mmap-shuffle) shuffle 8: cksum=$shuffle[8]
(mmap-shuffle) shuffle 9: cksum=$shuffle[9]
(mmap-shuffle) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-shuffle.ck.svn-base | Perl | oos | 1,267 |
# -*- 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 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 lru_10cm)
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-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/lru_10cm_SRC = tests/vm/lru_10cm.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
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/Make.tests.svn-base | Makefile | oos | 5,526 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-zero.ck.svn-base | Perl | oos | 248 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('pt-write-code');
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-write-code.ck.svn-base | Perl | oos | 129 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-merge-stk.ck.svn-base | Perl | oos | 790 |
# -*- 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/.svn/text-base/mmap-over-code.ck.svn-base | Perl | oos | 247 |
# -*- 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/.svn/text-base/pt-grow-stack.ck.svn-base | Perl | oos | 197 |
# -*- 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/.svn/text-base/pt-bad-read.ck.svn-base | Perl | oos | 171 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-over-stk.ck.svn-base | Perl | oos | 244 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-linear.ck.svn-base | Perl | oos | 314 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-over-data.ck.svn-base | Perl | oos | 247 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-write-code2.ck.svn-base | Perl | oos | 180 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-read.ck.svn-base | Perl | oos | 215 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-grow-stk-sc.ck.svn-base | Perl | oos | 403 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-parallel.ck.svn-base | Perl | oos | 439 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('mmap-unmap');
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-unmap.ck.svn-base | Perl | oos | 126 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-inherit.ck.svn-base | Perl | oos | 393 |
# -*- 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/.svn/text-base/mmap-close.ck.svn-base | Perl | oos | 219 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-grow-pusha.ck.svn-base | Perl | oos | 163 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-merge-mm.ck.svn-base | Perl | oos | 768 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-merge-par.ck.svn-base | Perl | oos | 790 |
# -*- 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/.svn/text-base/mmap-bad-fd.ck.svn-base | Perl | oos | 285 |
# -*- 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, [<<EOF]);
(page-shuffle) begin
(page-shuffle) init: cksum=$init
(page-shuffle) shuffle 0: cksum=$shuffle[0]
(page-shuffle) shuffle 1: cksum=$shuffle[1]
(page-shuffle) shuffle 2: cksum=$shuffle[2]
(page-shuffle) shuffle 3: cksum=$shuffle[3]
(page-shuffle) shuffle 4: cksum=$shuffle[4]
(page-shuffle) shuffle 5: cksum=$shuffle[5]
(page-shuffle) shuffle 6: cksum=$shuffle[6]
(page-shuffle) shuffle 7: cksum=$shuffle[7]
(page-shuffle) shuffle 8: cksum=$shuffle[8]
(page-shuffle) shuffle 9: cksum=$shuffle[9]
(page-shuffle) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/page-shuffle.ck.svn-base | Perl | oos | 1,178 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-overlap.ck.svn-base | Perl | oos | 297 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-clean.ck.svn-base | Perl | oos | 397 |
# -*- 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/.svn/text-base/mmap-write.ck.svn-base | Perl | oos | 304 |
# -*- 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/.svn/text-base/mmap-null.ck.svn-base | Perl | oos | 222 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/process_death.pm.svn-base | Perl | oos | 618 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-exit.ck.svn-base | Perl | oos | 420 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/mmap-twice.ck.svn-base | Perl | oos | 417 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('pt-bad-addr');
| 10cm | trunk/10cm/pintos/src/tests/vm/.svn/text-base/pt-bad-addr.ck.svn-base | Perl | oos | 127 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
use tests::vm::process_death;
check_process_death ('pt-bad-addr');
| 10cm | trunk/10cm/pintos/src/tests/vm/pt-bad-addr.ck | Perl | oos | 127 |
# -*- 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;
| 10cm | trunk/10cm/pintos/src/tests/vm/page-linear.ck | Perl | oos | 314 |
/* Verifies that memory mappings persist after file close. */
#include <string.h>
#include <syscall.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-close.c | C | oos | 585 |
/* Executes child-mm-wrt and verifies that the writes that should
have occurred really did. */
#include <syscall.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/mmap-exit.c | C | oos | 526 |
/* Encrypts, then decrypts, 2 MB of memory and verifies that the
values are as they should be. */
#include <string.h>
#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);
}
| 10cm | trunk/10cm/pintos/src/tests/vm/page-linear.c | C | oos | 949 |