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 |
|---|---|---|---|---|---|
#ifndef FILESYS_FSUTIL_H
#define FILESYS_FSUTIL_H
void fsutil_ls (char **argv);
void fsutil_cat (char **argv);
void fsutil_rm (char **argv);
void fsutil_extract (char **argv);
void fsutil_append (char **argv);
#endif /* filesys/fsutil.h */
| 10cm | trunk/10cm/pintos/src/filesys/fsutil.h | C | oos | 243 |
#include "filesys/directory.h"
#include <stdio.h>
#include <string.h>
#include <list.h>
#include "filesys/filesys.h"
#include "filesys/inode.h"
#include "threads/malloc.h"
/* A directory. */
struct dir
{
struct inode *inode; /* Backing store. */
off_t pos; /* Current ... | 10cm | trunk/10cm/pintos/src/filesys/directory.c | C | oos | 5,843 |
include ../Makefile.kernel
| 10cm | trunk/10cm/pintos/src/filesys/Makefile | Makefile | oos | 27 |
#include "filesys/filesys.h"
#include <debug.h>
#include <stdio.h>
#include <string.h>
#include "filesys/file.h"
#include "filesys/free-map.h"
#include "filesys/inode.h"
#include "filesys/cache.h"
#include "filesys/directory.h"
#include "devices/disk.h"
/* The disk that contains the file system. */
struct disk *filesy... | 10cm | trunk/10cm/pintos/src/filesys/filesys.c | C | oos | 2,590 |
#include "filesys/free-map.h"
#include <bitmap.h>
#include <debug.h>
#include "filesys/file.h"
#include "filesys/filesys.h"
#include "filesys/inode.h"
static struct file *free_map_file; /* Free map file. */
static struct bitmap *free_map; /* Free map, one bit per disk sector. */
/* Initialize the free map. */
... | 10cm | trunk/10cm/pintos/src/filesys/free-map.c | C | oos | 2,328 |
#include <random.h>
#include "tests/lib.h"
#include "tests/main.h"
/* tests/main.c */
int
main (int argc UNUSED, char *argv[])
{
test_name = argv[0];
msg ("begin");
random_init (0);
test_main ();
msg ("end");
return 0;
}
| 10cm | trunk/10cm/pintos/src/tests/main.c | C | oos | 236 |
#ifndef TESTS_LIB_H
#define TESTS_LIB_H
#include <debug.h>
#include <stdbool.h>
#include <stddef.h>
#include <syscall.h>
extern const char *test_name;
extern bool quiet;
void msg (const char *, ...) PRINTF_FORMAT (1, 2);
void fail (const char *, ...) PRINTF_FORMAT (1, 2) NO_RETURN;
/* Takes an expression to test fo... | 10cm | trunk/10cm/pintos/src/tests/lib.h | C | oos | 1,767 |
/* Test program for sorting and searching in lib/stdlib.c.
Attempts to test the sorting and searching functionality that
is not sufficiently tested elsewhere in Pintos.
This is not a test we will run on your submitted projects.
It is here for completeness.
*/
#undef NDEBUG
#include <debug.h>
#include <li... | 10cm | trunk/10cm/pintos/src/tests/internal/stdlib.c | C | oos | 2,886 |
/* Test program for printf() in lib/stdio.c.
Attempts to test printf() functionality that is not
sufficiently tested elsewhere in Pintos.
This is not a test we will run on your submitted projects.
It is here for completeness.
*/
#undef NDEBUG
#include <limits.h>
#include <stdarg.h>
#include <stddef.h>
#i... | 10cm | trunk/10cm/pintos/src/tests/internal/stdio.c | C | oos | 7,238 |
/* Test program for lib/kernel/list.c.
Attempts to test the list functionality that is not
sufficiently tested elsewhere in Pintos.
This is not a test we will run on your submitted projects.
It is here for completeness.
*/
#undef NDEBUG
#include <debug.h>
#include <list.h>
#include <random.h>
#include <s... | 10cm | trunk/10cm/pintos/src/tests/internal/list.c | C | oos | 4,884 |
use strict;
use warnings;
use tests::arc4;
my (@arc4);
sub random_init {
if (@arc4 == 0) {
my ($seed) = @_;
$seed = 0 if !defined $seed;
@arc4 = arc4_init (pack ("V", $seed));
}
}
sub random_bytes {
random_init ();
my ($n) = @_;
return arc4_crypt (\@arc4, "\0" x $n);
}
sub random_ulong {
... | 10cm | trunk/10cm/pintos/src/tests/random.pm | Perl | oos | 386 |
#ifndef TESTS_MAIN_H
#define TESTS_MAIN_H
void test_main (void);
#endif /* tests/main.h */
| 10cm | trunk/10cm/pintos/src/tests/main.h | C | oos | 93 |
/* -*- c -*- */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
const char *child_cmd = "child-rox " CHILD_CNT;
int handle;
pid_t child;
char buffer[16];
/* Open child-rox, read from it, write back same data. */
CHECK ((handle = open ("child-rox")) > 1, "open ... | 10cm | trunk/10cm/pintos/src/tests/userprog/rox-child.inc | C | oos | 919 |
/* Writes data spanning two pages in virtual address space,
which must succeed. */
#include <string.h>
#include <syscall.h>
#include "tests/userprog/boundary.h"
#include "tests/userprog/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle;
int byte_cnt;
char *sample_... | 10cm | trunk/10cm/pintos/src/tests/userprog/write-boundary.c | C | oos | 621 |
/* Opens a file and then tries to close it twice. The second
close must either fail silently or terminate with exit code
-1. */
#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\"");
msg (... | 10cm | trunk/10cm/pintos/src/tests/userprog/close-twice.c | C | oos | 421 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(create-empty) begin
(create-empty) create(""): 0
(create-empty) end
create-empty: exit(0)
EOF
(create-empty) begin
create-empty: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-empty.ck | Perl | oos | 245 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(create-long) begin
(create-long) create("x..."): 0
(create-long) end
create-long: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-long.ck | Perl | oos | 188 |
/* Tries to create a file with the null pointer as its name.
The process must be terminated with exit code -1. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("create(NULL): %d", create (NULL, 0));
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-null.c | C | oos | 239 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(open-bad-ptr) begin
(open-bad-ptr) end
open-bad-ptr: exit(0)
EOF
(open-bad-ptr) begin
open-bad-ptr: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-bad-ptr.ck | Perl | oos | 216 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(wait-twice) begin
(child-simple) run
child-simple: exit(81)
(wait-twice) wait(exec()) = 81
(wait-twice) wait(exec()) = -1
(wait-twice) end
wait-twice: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/wait-twice.ck | Perl | oos | 257 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(wait-bad-pid) begin
(wait-bad-pid) end
wait-bad-pid: exit(0)
EOF
(wait-bad-pid) begin
wait-bad-pid: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/wait-bad-pid.ck | Perl | oos | 216 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(write-boundary) begin
(write-boundary) open "sample.txt"
(write-boundary) end
write-boundary: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/write-boundary.ck | Perl | oos | 200 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']);
(bad-jump) begin
bad-jump: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/bad-jump.ck | Perl | oos | 158 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(args) begin
(args) argc = 3
(args) argv[0] = 'args-dbl-space'
(args) argv[1] = 'two'
(args) argv[2] = 'spaces!'
(args) argv[3] = null
(args) end
args-dbl-space: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/args-dbl-space.ck | Perl | oos | 267 |
/* Verifies that trying to create a file under a name that
already exists will fail. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
CHECK (create ("quux.dat", 0), "create quux.dat");
CHECK (create ("warble.dat", 0), "create warble.dat");
CHECK (!create ("quux.... | 10cm | trunk/10cm/pintos/src/tests/userprog/create-exists.c | C | oos | 485 |
/* Ensure that the executable of a running process cannot be
modified. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle;
char buffer[16];
CHECK ((handle = open ("rox-simple")) > 1, "open \"rox-simple\"");
CHECK (read (handle, buffer, sizeof buffe... | 10cm | trunk/10cm/pintos/src/tests/userprog/rox-simple.c | C | oos | 476 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(wait-simple) begin
(child-simple) run
child-simple: exit(81)
(wait-simple) wait(exec()) = 81
(wait-simple) end
wait-simple: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/wait-simple.ck | Perl | oos | 230 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(read-stdout) begin
(read-stdout) end
read-stdout: exit(0)
EOF
(read-stdout) begin
read-stdout: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-stdout.ck | Perl | oos | 211 |
/* Passes a bad pointer to the create system call,
which must cause the process to be terminated with exit code
-1. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("create(0x20101234): %d", create ((char *) 0x20101234, 0));
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-bad-ptr.c | C | oos | 268 |
/* Child process run by wait-killed test.
Sets the stack pointer (%esp) to an invalid value and invokes
a system call, which should then terminate the process with a
-1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
asm volatile ("movl $0x20101234, %esp; int $0x30");
... | 10cm | trunk/10cm/pintos/src/tests/userprog/child-bad.c | C | oos | 361 |
/* Tries to create a file with the empty string as its name. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("create(\"\"): %d", create ("", 0));
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-empty.c | C | oos | 184 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(multi-recurse) begin 15
(multi-recurse) exec("multi-recurse 14")
(multi-recurse) begin 14
(multi-recurse) exec("multi-recurse 13")
(multi-recurse) begin 13
(multi-recurse) exec("multi-recurse 12")
(multi-recurse) begin 12
(multi-rec... | 10cm | trunk/10cm/pintos/src/tests/userprog/multi-recurse.ck | Perl | oos | 1,824 |
/* This program attempts to write to memory at an address that is not mapped.
This should terminate the process with a -1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
*(int *)NULL = 42;
fail ("should have exited with -1");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/bad-write.c | C | oos | 275 |
/* Tries to close the console output stream, which must either
fail silently or terminate with exit code -1. */
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
close (1);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-stdout.c | C | oos | 202 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(sc-bad-arg) begin
sc-bad-arg: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/sc-bad-arg.ck | Perl | oos | 137 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(sc-bad-sp) begin
sc-bad-sp: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/sc-bad-sp.ck | Perl | oos | 135 |
/* This program attempts to read memory at an address that is not mapped.
This should terminate the process with a -1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("Congratulations - you have successfully dereferenced NULL: %d",
*(int *)NULL);
fail ("should... | 10cm | trunk/10cm/pintos/src/tests/userprog/bad-read.c | C | oos | 346 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(exec-once) begin
(child-simple) run
child-simple: exit(81)
(exec-once) end
exec-once: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/exec-once.ck | Perl | oos | 192 |
/* Passes an invalid pointer to the open 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)
{
msg ("open(0x20101234): %d", open ((char *) 0x20101234));
fail ("should have called exit(-1)");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-bad-ptr.c | C | oos | 307 |
/* Tries to read from an invalid fd,
which must either fail silently or terminate the process with
exit code -1. */
#include <limits.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
char buf;
read (0x20101234, &buf, 1);
read (5, &buf, 1);
read (1234, &buf, ... | 10cm | trunk/10cm/pintos/src/tests/userprog/read-bad-fd.c | C | oos | 427 |
/* Opens a file and then closes it. */
#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\"");
msg ("close \"sample.txt\"");
close (handle);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-normal.c | C | oos | 269 |
/* Passes an invalid pointer to the exec system call.
The process must be terminated with -1 exit code. */
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
exec ((char *) 0x20101234);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/exec-bad-ptr.c | C | oos | 214 |
/* Child process run by rox-child and rox-multichild tests.
Opens and tries to write to its own executable, verifying that
that is disallowed.
Then recursively executes itself to the depth indicated by the
first command-line argument. */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
#include <s... | 10cm | trunk/10cm/pintos/src/tests/userprog/child-rox.c | C | oos | 1,187 |
/* Sticks a system call number (SYS_EXIT) at the very top of the
stack, then invokes a system call with the stack pointer
(%esp) set to its address. The process must be terminated
with -1 exit code because the argument to the system call
would be above the top of the user address space. */
#include <sysca... | 10cm | trunk/10cm/pintos/src/tests/userprog/sc-bad-arg.c | C | oos | 552 |
/* Tries to close the keyboard input stream, which must either
fail silently or terminate with exit code -1. */
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
close (0);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-stdin.c | C | oos | 202 |
/* Tries to execute a nonexistent process.
The exec system call must return -1. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("exec(\"no-such-file\"): %d", exec ("no-such-file"));
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/exec-missing.c | C | oos | 244 |
/* Creates a file whose name spans the boundary between two pages.
This is valid, so it must succeed. */
#include <syscall.h>
#include "tests/userprog/boundary.h"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
CHECK (open (copy_string_across_boundary ("sample.txt")) > 1,
"open \... | 10cm | trunk/10cm/pintos/src/tests/userprog/open-boundary.c | C | oos | 339 |
/* Tests the exit system call. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
exit (57);
fail ("should have called exit(57)");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/exit.c | C | oos | 163 |
/* Tries to open a nonexistent file. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle = open ("no-such-file");
if (handle != -1)
fail ("open() returned %d", handle);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-missing.c | C | oos | 236 |
/* Tries to open a file with the null pointer as its name.
The process must be terminated with exit code -1. */
#include <stddef.h>
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
open (NULL);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-null.c | C | oos | 224 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
system call!
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/null.ck | Perl | oos | 110 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(open-boundary) begin
(open-boundary) open "sample.txt"
(open-boundary) end
open-boundary: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-boundary.ck | Perl | oos | 196 |
/* Try reading from fd 1 (stdout),
which may just fail or terminate the process with -1 exit
code. */
#include <stdio.h>
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
char buf;
read (STDOUT_FILENO, &buf, 1);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-stdout.c | C | oos | 247 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(close-stdout) begin
(close-stdout) end
close-stdout: exit(0)
EOF
(close-stdout) begin
close-stdout: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-stdout.ck | Perl | oos | 216 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(write-stdin) begin
(write-stdin) end
write-stdin: exit(0)
EOF
(write-stdin) begin
write-stdin: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/write-stdin.ck | Perl | oos | 211 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(open-missing) begin
(open-missing) end
open-missing: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-missing.ck | Perl | oos | 159 |
/* Tries to open the same file twice,
which must succeed and must return a different file descriptor
in each case. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int h1 = open ("sample.txt");
int h2 = open ("sample.txt");
CHECK ((h1 = open ("sample.txt")... | 10cm | trunk/10cm/pintos/src/tests/userprog/open-twice.c | C | oos | 493 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(open-null) begin
(open-null) end
open-null: exit(0)
EOF
(open-null) begin
open-null: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-null.ck | Perl | oos | 201 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(args) begin
(args) argc = 5
(args) argv[0] = 'args-multiple'
(args) argv[1] = 'some'
(args) argv[2] = 'arguments'
(args) argv[3] = 'for'
(args) argv[4] = 'you!'
(args) argv[5] = null
(args) end
args-multiple: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/args-multiple.ck | Perl | oos | 315 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF', <<'EOF', <<'EOF']);
(exec-missing) begin
load: no-such-file: open failed
(exec-missing) exec("no-such-file"): -1
(exec-missing) end
exec-missing: exit(0)
EOF
(exec-missing) begin
(exec-missing) exec("no-such-file"): -1
(exec-m... | 10cm | trunk/10cm/pintos/src/tests/userprog/exec-missing.ck | Perl | oos | 686 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(create-exists) begin
(create-exists) create quux.dat
(create-exists) create warble.dat
(create-exists) try to re-create quux.dat
(create-exists) create baffle.dat
(create-exists) try to re-create quux.dat
(create-exists) end
create-... | 10cm | trunk/10cm/pintos/src/tests/userprog/create-exists.ck | Perl | oos | 346 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']);
(bad-read) begin
bad-read: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/bad-read.ck | Perl | oos | 158 |
/* Tries to create a file with a name that is much too long,
which must fail. */
#include <string.h>
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
static char name[512];
memset (name, 'x', sizeof name);
name[sizeof name - 1] = '\0';
msg ("create(\"x...\"): ... | 10cm | trunk/10cm/pintos/src/tests/userprog/create-long.c | C | oos | 346 |
/* Try reading a file in the most normal way. */
#include "tests/userprog/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
check_file ("sample.txt", sample, sizeof sample - 1);
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-normal.c | C | oos | 218 |
/* Try writing a file in the most normal way. */
#include <syscall.h>
#include "tests/userprog/sample.inc"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle, byte_cnt;
CHECK (create ("sample.txt", sizeof sample - 1), "create \"sample.txt\"");
CHECK ((handle = open ("sample.txt"... | 10cm | trunk/10cm/pintos/src/tests/userprog/write-normal.c | C | oos | 527 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(read-boundary) begin
(read-boundary) open "sample.txt"
(read-boundary) end
read-boundary: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-boundary.ck | Perl | oos | 196 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, [<<'EOF']);
(bad-write2) begin
bad-write2: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/bad-write2.ck | Perl | oos | 162 |
/* This program attempts to execute code at a kernel virtual address.
This should terminate the process with a -1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("Congratulations - you have successfully called kernel code: %d",
((int (*)(void))0xC0000000)());
... | 10cm | trunk/10cm/pintos/src/tests/userprog/bad-jump2.c | C | oos | 361 |
/* Opens a file and then runs a subprocess that tries to close
the file. (Pintos does not have inheritance of file handles,
so this must fail.) The parent process then attempts to use
the file handle, which must succeed. */
#include <stdio.h>
#include <syscall.h>
#include "tests/userprog/sample.inc"
#includ... | 10cm | trunk/10cm/pintos/src/tests/userprog/multi-child-fd.c | C | oos | 693 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(args) begin
(args) argc = 2
(args) argv[0] = 'args-single'
(args) argv[1] = 'onearg'
(args) argv[2] = null
(args) end
args-single: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/args-single.ck | Perl | oos | 237 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(close-bad-fd) begin
(close-bad-fd) end
close-bad-fd: exit(0)
EOF
(close-bad-fd) begin
close-bad-fd: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-bad-fd.ck | Perl | oos | 216 |
/* This program attempts to read kernel memory.
This should terminate the process with a -1 exit code. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("Congratulations - you have successfully read kernel memory: %d",
*(int *)0xC0000000);
fail ("should have exited with ... | 10cm | trunk/10cm/pintos/src/tests/userprog/bad-read2.c | C | oos | 328 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(read-bad-ptr) begin
(read-bad-ptr) open "sample.txt"
(read-bad-ptr) end
read-bad-ptr: exit(0)
EOF
(read-bad-ptr) begin
(read-bad-ptr) open "sample.txt"
read-bad-ptr: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/read-bad-ptr.ck | Perl | oos | 282 |
/* Try a 0-byte write, which should return 0 without writing
anything. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle, byte_cnt;
char buf;
CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
buf = 123;
byte_cnt = write (handle, ... | 10cm | trunk/10cm/pintos/src/tests/userprog/write-zero.c | C | oos | 409 |
/* Invokes a system call with the stack pointer (%esp) set to a
bad address. The process must be terminated with -1 exit
code.
For Project 3: The bad address lies approximately 64MB below
the code segment, so there is no ambiguity that this attempt
must be rejected even after stack growth is implement... | 10cm | trunk/10cm/pintos/src/tests/userprog/sc-bad-sp.c | C | oos | 653 |
/* Opens a file whose name spans the boundary between two pages.
This is valid, so it must succeed. */
#include <syscall.h>
#include "tests/userprog/boundary.h"
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("create(\"quux.dat\"): %d",
create (copy_string_across_boundary ("qu... | 10cm | trunk/10cm/pintos/src/tests/userprog/create-bound.c | C | oos | 337 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(write-bad-fd) begin
(write-bad-fd) end
write-bad-fd: exit(0)
EOF
(write-bad-fd) begin
write-bad-fd: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/write-bad-fd.ck | Perl | oos | 216 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(args) begin
(args) argc = 1
(args) argv[0] = 'args-none'
(args) argv[1] = null
(args) end
args-none: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/args-none.ck | Perl | oos | 207 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(sc-boundary-2) begin
sc-boundary-2: exit(67)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/sc-boundary-2.ck | Perl | oos | 143 |
/* Wait for a subprocess to finish. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
msg ("wait(exec()) = %d", wait (exec ("child-simple")));
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/wait-simple.c | C | oos | 195 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(rox-multichild) begin
(rox-multichild) open "child-rox"
(rox-multichild) read "child-rox"
(rox-multichild) write "child-rox"
(rox-multichild) exec "child-rox 5"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) exec... | 10cm | trunk/10cm/pintos/src/tests/userprog/rox-multichild.ck | Perl | oos | 1,103 |
/* Tries to write to an invalid fd,
which must either fail silently or terminate the process with
exit code -1. */
#include <limits.h>
#include <syscall.h>
#include "tests/main.h"
void
test_main (void)
{
char buf = 123;
write (0x01012342, &buf, 1);
write (7, &buf, 1);
write (2546, &buf, 1);
write (-5... | 10cm | trunk/10cm/pintos/src/tests/userprog/write-bad-fd.c | C | oos | 424 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(rox-child) begin
(rox-child) open "child-rox"
(rox-child) read "child-rox"
(rox-child) write "child-rox"
(rox-child) exec "child-rox 1"
(child-rox) begin
(child-rox) try to write "child-rox"
(child-rox) try to write "child-rox"
(chi... | 10cm | trunk/10cm/pintos/src/tests/userprog/rox-child.ck | Perl | oos | 427 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(sc-boundary) begin
sc-boundary: exit(42)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/sc-boundary.ck | Perl | oos | 139 |
/* Passes an invalid pointer to the read 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\"");
read (handle, (char *) 0xc010... | 10cm | trunk/10cm/pintos/src/tests/userprog/read-bad-ptr.c | C | oos | 378 |
/* Tests the halt system call. */
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
halt ();
fail ("should have halted");
}
| 10cm | trunk/10cm/pintos/src/tests/userprog/halt.c | C | oos | 152 |
#ifndef TESTS_USERPROG_BOUNDARY_H
#define TESTS_USERPROG_BOUNDARY_H
void *get_boundary_area (void);
char *copy_string_across_boundary (const char *);
#endif /* tests/userprog/boundary.h */
| 10cm | trunk/10cm/pintos/src/tests/userprog/boundary.h | C | oos | 191 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(create-normal) begin
(create-normal) create quux.dat
(create-normal) end
create-normal: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-normal.ck | Perl | oos | 194 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
our ($test);
my (@output) = read_text_file ("$test.output");
common_checks ("run", @output);
fail "missing 'begin' message\n"
if !grep ($_ eq '(halt) begin', @output);
fail "found 'fail' message--halt didn't really halt\n"
if grep ($_ eq '(halt) fail', @... | 10cm | trunk/10cm/pintos/src/tests/userprog/halt.ck | Perl | oos | 335 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, IGNORE_EXIT_CODES => 1, [<<'EOF']);
(multi-oom) begin
(multi-oom) success. program forked 10 times.
(multi-oom) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/no-vm/multi-oom.ck | Perl | oos | 226 |
# -*- makefile -*-
tests/userprog/no-vm_TESTS = tests/userprog/no-vm/multi-oom
tests/userprog/no-vm_PROGS = $(tests/userprog/no-vm_TESTS)
tests/userprog/no-vm/multi-oom_SRC = tests/userprog/no-vm/multi-oom.c \
tests/lib.c
tests/userprog/no-vm/multi-oom.output: TIMEOUT = 360
| 10cm | trunk/10cm/pintos/src/tests/userprog/no-vm/.svn/text-base/Make.tests.svn-base | Makefile | oos | 277 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected (IGNORE_USER_FAULTS => 1, IGNORE_EXIT_CODES => 1, [<<'EOF']);
(multi-oom) begin
(multi-oom) success. program forked 10 times.
(multi-oom) end
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/no-vm/.svn/text-base/multi-oom.ck.svn-base | Perl | oos | 226 |
# -*- makefile -*-
tests/userprog/no-vm_TESTS = tests/userprog/no-vm/multi-oom
tests/userprog/no-vm_PROGS = $(tests/userprog/no-vm_TESTS)
tests/userprog/no-vm/multi-oom_SRC = tests/userprog/no-vm/multi-oom.c \
tests/lib.c
tests/userprog/no-vm/multi-oom.output: TIMEOUT = 360
| 10cm | trunk/10cm/pintos/src/tests/userprog/no-vm/Make.tests | Makefile | oos | 277 |
/* Recursively executes itself until the child fails to execute.
We expect that at least 30 copies can run.
We count how many children your kernel was able to execute
before it fails to start a new process. We require that,
if a process doesn't actually get to start, exec() must
return -1, not a valid ... | 10cm | trunk/10cm/pintos/src/tests/userprog/no-vm/multi-oom.c | C | oos | 4,914 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(open-empty) begin
(open-empty) end
open-empty: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/open-empty.ck | Perl | oos | 153 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(create-bound) begin
(create-bound) create("quux.dat"): 1
(create-bound) end
create-bound: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/create-bound.ck | Perl | oos | 196 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF', <<'EOF']);
(close-stdin) begin
(close-stdin) end
close-stdin: exit(0)
EOF
(close-stdin) begin
close-stdin: exit(-1)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-stdin.ck | Perl | oos | 211 |
/* Try a 0-byte read, which should return 0 without reading
anything. */
#include <syscall.h>
#include "tests/lib.h"
#include "tests/main.h"
void
test_main (void)
{
int handle, byte_cnt;
char buf;
CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\"");
buf = 123;
byte_cnt = read (handle, &b... | 10cm | trunk/10cm/pintos/src/tests/userprog/read-zero.c | C | oos | 474 |
# -*- perl -*-
use strict;
use warnings;
use tests::tests;
check_expected ([<<'EOF']);
(close-normal) begin
(close-normal) open "sample.txt"
(close-normal) close "sample.txt"
(close-normal) end
close-normal: exit(0)
EOF
pass;
| 10cm | trunk/10cm/pintos/src/tests/userprog/close-normal.ck | Perl | oos | 226 |
# -*- 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/.svn/text-base/read-normal.ck.svn-base | Perl | oos | 286 |