Add a basic unit test for system(3).

Change-Id: Ibc5ac21f3663685d89ce261b58d6ea386fc1ff88
This commit is contained in:
Elliott Hughes 2014-03-11 12:54:44 -07:00
parent dd8c7863c6
commit 3cdf5739cd

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));
}