From b5f0874cd96ee2a62aabc645b9626c2749cb6a01 Mon Sep 17 00:00:00 2001 From: manuel Date: Mon, 26 Mar 2012 12:54:45 +0200 Subject: initial pintos checkin --- pintos-progos/tests/filesys/extended/dir-open.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 pintos-progos/tests/filesys/extended/dir-open.c (limited to 'pintos-progos/tests/filesys/extended/dir-open.c') diff --git a/pintos-progos/tests/filesys/extended/dir-open.c b/pintos-progos/tests/filesys/extended/dir-open.c new file mode 100644 index 0000000..29d18b8 --- /dev/null +++ b/pintos-progos/tests/filesys/extended/dir-open.c @@ -0,0 +1,21 @@ +/* Opens a directory, then tries to write to it, which must + fail. */ + +#include +#include "tests/lib.h" +#include "tests/main.h" + +void +test_main (void) +{ + int fd; + int retval; + + CHECK (mkdir ("xyzzy"), "mkdir \"xyzzy\""); + CHECK ((fd = open ("xyzzy")) > 1, "open \"xyzzy\""); + + msg ("write \"xyzzy\""); + retval = write (fd, "foobar", 6); + CHECK (retval == -1, + "write \"xyzzy\" (must return -1, actually %d)", retval); +} -- cgit v1.2.3