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/userprog/rox-simple.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 pintos-progos/tests/userprog/rox-simple.c (limited to 'pintos-progos/tests/userprog/rox-simple.c') diff --git a/pintos-progos/tests/userprog/rox-simple.c b/pintos-progos/tests/userprog/rox-simple.c new file mode 100644 index 0000000..e84a064 --- /dev/null +++ b/pintos-progos/tests/userprog/rox-simple.c @@ -0,0 +1,19 @@ +/* Ensure that the executable of a running process cannot be + modified. */ + +#include +#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 buffer) == (int) sizeof buffer, + "read \"rox-simple\""); + CHECK (write (handle, buffer, sizeof buffer) == 0, + "try to write \"rox-simple\""); +} -- cgit v1.2.3