X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Ftests%2Fuserprog%2Fwrite-boundary.c;fp=src%2Ftests%2Fuserprog%2Fwrite-boundary.c;h=639e981635acd8a986d9b06439115ee827312c5d;hb=615bf3b3d2a8573ed6fb9ddc0055745e163ac999;hp=0000000000000000000000000000000000000000;hpb=5780c9f434cca090f88463b7f0199d49b4ded288;p=pintos-anon diff --git a/src/tests/userprog/write-boundary.c b/src/tests/userprog/write-boundary.c new file mode 100644 index 0000000..639e981 --- /dev/null +++ b/src/tests/userprog/write-boundary.c @@ -0,0 +1,22 @@ +#include +#include +#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_p; + + sample_p = copy_string_across_boundary (sample); + + CHECK ((handle = open ("sample.txt")) > 1, "open \"sample.txt\""); + + byte_cnt = write (handle, sample_p, sizeof sample - 1); + if (byte_cnt != sizeof sample - 1) + fail ("write() returned %d instead of %zu", byte_cnt, sizeof sample - 1); +}