mirror of
https://github.com/PowerShell/Win32-OpenSSH.git
synced 2025-07-22 21:45:09 +02:00
3-6 C10
This commit is contained in:
parent
95e7d99012
commit
43c3d105c3
@ -71,21 +71,28 @@ void file_simple_fileio()
|
|||||||
|
|
||||||
int f;
|
int f;
|
||||||
TEST_START("file io");
|
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);
|
ASSERT_INT_NE(f, -1);
|
||||||
close(f);
|
close(f);
|
||||||
f = open("e:\\tmp.txt", O_RDONLY);
|
f = open("tmp.txt", O_RDONLY);
|
||||||
ASSERT_INT_NE(f, -1);
|
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);
|
ret = read(f, small_read_buf, SMALL_RECV_BUF_SIZE);
|
||||||
ASSERT_INT_EQ(ret, 0);
|
ASSERT_INT_EQ(ret, 0);
|
||||||
close(f);
|
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);
|
ASSERT_INT_NE(f, -1);
|
||||||
ret = write(f, small_write_buf, strlen(small_write_buf));
|
ret = write(f, small_write_buf, strlen(small_write_buf));
|
||||||
ASSERT_INT_EQ(ret, strlen(small_write_buf));
|
ASSERT_INT_EQ(ret, strlen(small_write_buf));
|
||||||
close(f);
|
close(f);
|
||||||
f = open("e:\\tmp.txt", O_RDONLY);
|
f = open("tmp.txt", O_RDONLY);
|
||||||
ASSERT_INT_NE(f, -1);
|
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);
|
ret = read(f, small_read_buf, SMALL_RECV_BUF_SIZE);
|
||||||
ASSERT_INT_EQ(ret, strlen(small_write_buf));
|
ASSERT_INT_EQ(ret, strlen(small_write_buf));
|
||||||
small_read_buf[ret] = '\0';
|
small_read_buf[ret] = '\0';
|
||||||
@ -222,7 +229,7 @@ void
|
|||||||
file_tests()
|
file_tests()
|
||||||
{
|
{
|
||||||
w32posix_initialize();
|
w32posix_initialize();
|
||||||
//file_simple_fileio();
|
file_simple_fileio();
|
||||||
file_blocking_io_tests();
|
file_blocking_io_tests();
|
||||||
file_nonblocking_io_tests();
|
file_nonblocking_io_tests();
|
||||||
file_select_tests();
|
file_select_tests();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user