mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Fix hermeticity issue with new test
This commit is contained in:
parent
3e702e8f65
commit
4a6be2154d
4 changed files with 50 additions and 28 deletions
|
@ -156,34 +156,30 @@ TEST(system, kill) {
|
|||
if (!IsWindows()) ASSERT_EQ(SIGTERM, WTERMSIG(ws));
|
||||
}
|
||||
|
||||
// TODO(G4Vi): Please fix this regression?
|
||||
// TEST(system, exitStatusPreservedAfterSemiColon) {
|
||||
// ASSERT_EQ(1, WEXITSTATUS(system("false;")));
|
||||
// ASSERT_EQ(1, WEXITSTATUS(system("false; ")));
|
||||
// if (!IsWindows() && !IsMetal()) {
|
||||
// ASSERT_EQ(1, WEXITSTATUS(system("/bin/false;")));
|
||||
// ASSERT_EQ(1, WEXITSTATUS(system("/bin/false;")));
|
||||
// }
|
||||
// int pipefd[2];
|
||||
// int stdoutBack = dup(1);
|
||||
// ASSERT_NE(-1, stdoutBack);
|
||||
// ASSERT_EQ(0, pipe(pipefd));
|
||||
// ASSERT_NE(-1, dup2(pipefd[1], 1));
|
||||
// ASSERT_EQ(0, WEXITSTATUS(system("false; echo $?")));
|
||||
// char buf[3] = {0};
|
||||
// ASSERT_EQ(2, read(pipefd[0], buf, 2));
|
||||
// ASSERT_STREQ("1\n", buf);
|
||||
// if (!IsWindows() && !IsMetal()) {
|
||||
// ASSERT_EQ(0, WEXITSTATUS(system("/bin/false; echo $?")));
|
||||
// buf[0] = 0;
|
||||
// buf[1] = 0;
|
||||
// ASSERT_EQ(2, read(pipefd[0], buf, 2));
|
||||
// ASSERT_STREQ("1\n", buf);
|
||||
// }
|
||||
// ASSERT_NE(-1, dup2(stdoutBack, 1));
|
||||
// ASSERT_EQ(0, close(pipefd[1]));
|
||||
// ASSERT_EQ(0, close(pipefd[0]));
|
||||
// }
|
||||
TEST(system, exitStatusPreservedAfterSemiColon) {
|
||||
testlib_extract("/zip/false.com", "false.com", 0755);
|
||||
ASSERT_EQ(1, WEXITSTATUS(system("false;")));
|
||||
ASSERT_EQ(1, WEXITSTATUS(system("false; ")));
|
||||
ASSERT_EQ(1, WEXITSTATUS(system("./false.com;")));
|
||||
ASSERT_EQ(1, WEXITSTATUS(system("./false.com;")));
|
||||
int pipefd[2];
|
||||
int stdoutBack = dup(1);
|
||||
ASSERT_NE(-1, stdoutBack);
|
||||
ASSERT_EQ(0, pipe(pipefd));
|
||||
ASSERT_NE(-1, dup2(pipefd[1], 1));
|
||||
ASSERT_EQ(0, WEXITSTATUS(system("false; echo $?")));
|
||||
char buf[3] = {0};
|
||||
ASSERT_EQ(2, read(pipefd[0], buf, 2));
|
||||
ASSERT_STREQ("1\n", buf);
|
||||
ASSERT_EQ(0, WEXITSTATUS(system("./false.com; echo $?")));
|
||||
buf[0] = 0;
|
||||
buf[1] = 0;
|
||||
ASSERT_EQ(2, read(pipefd[0], buf, 2));
|
||||
ASSERT_STREQ("1\n", buf);
|
||||
ASSERT_NE(-1, dup2(stdoutBack, 1));
|
||||
ASSERT_EQ(0, close(pipefd[1]));
|
||||
ASSERT_EQ(0, close(pipefd[0]));
|
||||
}
|
||||
|
||||
TEST(system, allowsLoneCloseCurlyBrace) {
|
||||
int pipefd[2];
|
||||
|
|
|
@ -69,6 +69,7 @@ o/$(MODE)/test/libc/stdio/system_test.com.dbg: \
|
|||
o/$(MODE)/test/libc/stdio/stdio.pkg \
|
||||
o/$(MODE)/tool/build/echo.com.zip.o \
|
||||
o/$(MODE)/tool/build/cocmd.com.zip.o \
|
||||
o/$(MODE)/tool/build/false.com.zip.o \
|
||||
$(LIBC_TESTMAIN) \
|
||||
$(CRT) \
|
||||
$(APE_NO_MODIFY_SELF)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue