diff options
author | Elliott Hughes <enh@google.com> | 2014-04-08 17:14:01 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-04-08 17:16:13 -0700 |
commit | 9f525644df99cb2f7f81a23ca23840f0a8f82275 (patch) | |
tree | edfe771f84024370aba4988e016534e5c535984e /tests/stdlib_test.cpp | |
parent | ac70d2e1fe71f98232942237c2b463ea3adbf662 (diff) |
Implement _Exit(3).
Change-Id: Ida6ac844cc87d38c9645b197dd8188bb73e27dbe
Diffstat (limited to 'tests/stdlib_test.cpp')
-rw-r--r-- | tests/stdlib_test.cpp | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/stdlib_test.cpp b/tests/stdlib_test.cpp index 3a3fe28ae..bb395f04f 100644 --- a/tests/stdlib_test.cpp +++ b/tests/stdlib_test.cpp @@ -202,3 +202,17 @@ TEST(stdlib, strtof) { TEST(stdlib, strtold) { ASSERT_DOUBLE_EQ(1.23, strtold("1.23", NULL)); } + +TEST(unistd, _Exit) { + int pid = fork(); + ASSERT_NE(-1, pid) << strerror(errno); + + if (pid == 0) { + _Exit(99); + } + + int status; + ASSERT_EQ(pid, waitpid(pid, &status, 0)); + ASSERT_TRUE(WIFEXITED(status)); + ASSERT_EQ(99, WEXITSTATUS(status)); +} |