This commit is contained in:
manojampalam 2016-03-06 19:37:43 -08:00
parent 95e7d99012
commit 43c3d105c3

View File

@ -71,21 +71,28 @@ void file_simple_fileio()
int f;
TEST_START("file io");
f = open("e:\\tmp.txt", O_WRONLY | O_CREAT | O_TRUNC);
f = open("tmp.txt", O_WRONLY | O_CREAT | O_TRUNC);
ASSERT_INT_NE(f, -1);
close(f);
f = open("e:\\tmp.txt", O_RDONLY);
f = open("tmp.txt", O_RDONLY);
ASSERT_INT_NE(f, -1);
struct stat st;
ret = fstat(f, &st);
ASSERT_INT_EQ(ret, 0);
ASSERT_INT_EQ(st.st_size, 0);
ret = read(f, small_read_buf, SMALL_RECV_BUF_SIZE);
ASSERT_INT_EQ(ret, 0);
close(f);
f = open("e:\\tmp.txt", O_WRONLY | O_CREAT | O_TRUNC);
f = open("tmp.txt", O_WRONLY | O_CREAT | O_TRUNC);
ASSERT_INT_NE(f, -1);
ret = write(f, small_write_buf, strlen(small_write_buf));
ASSERT_INT_EQ(ret, strlen(small_write_buf));
close(f);
f = open("e:\\tmp.txt", O_RDONLY);
f = open("tmp.txt", O_RDONLY);
ASSERT_INT_NE(f, -1);
ret = fstat(f, &st);
ASSERT_INT_EQ(ret, 0);
ASSERT_INT_EQ(st.st_size, strlen(small_write_buf));
ret = read(f, small_read_buf, SMALL_RECV_BUF_SIZE);
ASSERT_INT_EQ(ret, strlen(small_write_buf));
small_read_buf[ret] = '\0';
@ -222,7 +229,7 @@ void
file_tests()
{
w32posix_initialize();
//file_simple_fileio();
file_simple_fileio();
file_blocking_io_tests();
file_nonblocking_io_tests();
file_select_tests();