1 /* Verifies that a deleted file may still be written to and read
8 #include "tests/main.h"
16 const char *file_name = "deleteme";
19 CHECK (create (file_name, sizeof buf1), "create \"%s\"", file_name);
20 CHECK ((fd = open (file_name)) > 1, "open \"%s\"", file_name);
21 CHECK (remove (file_name), "remove \"%s\"", file_name);
22 random_bytes (buf1, sizeof buf1);
23 CHECK (write (fd, buf1, sizeof buf1) > 0, "write \"%s\"", file_name);
24 msg ("seek \"%s\" to 0", file_name);
26 CHECK (read (fd, buf2, sizeof buf2) > 0, "read \"%s\"", file_name);
27 compare_bytes (buf2, buf1, sizeof buf1, 0, file_name);
28 msg ("close \"%s\"", file_name);