00001 
00002 
00003 #include <syscall.h>
00004 #include "tests/userprog/sample.inc"
00005 #include "tests/lib.h"
00006 #include "tests/main.h"
00007 
00008 void
00009 test_main (void) 
00010 {
00011   int handle, byte_cnt;
00012 
00013   CHECK (create ("test.txt", sizeof sample - 1), "create \"test.txt\"");
00014   CHECK ((handle = open ("test.txt")) > 1, "open \"test.txt\"");
00015 
00016   byte_cnt = write (handle, sample, sizeof sample - 1);
00017   if (byte_cnt != sizeof sample - 1)
00018     fail ("write() returned %d instead of %zu", byte_cnt, sizeof sample - 1);
00019 }
00020