Merge "Add a basic unit test for system(3)."

This commit is contained in:
Elliott Hughes 2014-03-11 20:02:49 +00:00 committed by Gerrit Code Review
commit 753e139906

View File

@ -172,3 +172,15 @@ TEST(stdlib, mkstemp64) {
ASSERT_EQ(0, fstat64(tf.fd, &sb));
ASSERT_EQ(O_LARGEFILE, fcntl(tf.fd, F_GETFL) & O_LARGEFILE);
}
TEST(stdlib, system) {
int status;
status = system("exit 0");
ASSERT_TRUE(WIFEXITED(status));
ASSERT_EQ(0, WEXITSTATUS(status));
status = system("exit 1");
ASSERT_TRUE(WIFEXITED(status));
ASSERT_EQ(1, WEXITSTATUS(status));
}