Index: native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc |
diff --git a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc |
index a93d0305034a3992050c3e3bbd1a626db6bbd8ef..0b9b3ddd01ef1df3f44251a8e3f5bc37819471e3 100644 |
--- a/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc |
+++ b/native_client_sdk/src/tests/nacl_io_test/kernel_proxy_test.cc |
@@ -527,6 +527,19 @@ TEST_F(KernelProxyTest, MemMountDup) { |
// fd, new_fd, dup_fd -> "/bar" |
} |
+TEST_F(KernelProxyTest, Dup2Allocation) { |
Sam Clegg
2014/12/12 00:44:40
Comment here? I would like a better test name bu
bradn
2014/12/12 22:58:18
Added more.
|
+ int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777); |
+ ASSERT_GT(fd, -1); |
+ |
+ int dup_fd = ki_dup(fd); |
+ ASSERT_EQ(fd + 1, dup_fd); |
binji
2014/12/12 18:55:20
Is this guaranteed to be true? The fd returned sho
bradn
2014/12/12 22:58:18
Commented more verbosely.
The test assumes the ini
|
+ |
+ ASSERT_EQ(100, ki_dup2(fd, 100)); |
+ |
+ int dup_fd2 = ki_dup(fd); |
+ ASSERT_EQ(fd + 2, dup_fd2); |
+} |
+ |
TEST_F(KernelProxyTest, Lstat) { |
int fd = ki_open("/foo", O_CREAT | O_RDWR, 0777); |
ASSERT_GT(fd, -1); |