mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-26 14:28:30 +00:00
Write tests for new APE loader and fix bugs
- Add FreeBSD-specific mmap() flags - Reduce size of the APE loader from 8kb to 4kb - Work towards fixing the Makefile build on WSL - Automate testing of APE no-modify-self behaviors - Make the ape.S shell script code cleaner and tinier - Improve the APE sanity check to test behavior better - Fixed issue with ShowCrashReports() sigaltstack() on BSDs - Delete symbols for S_MODE magnums which wasted compile time If you checked out yesterday's APE commit, please run: rm -f /usr/bin/ape o/tmp/ape /tmp/ape "${TMPDIR:-/tmp}/ape" Because this change fixes certain aspects of the new ABI. We don't have automated migrations for APE loader versions yet. Thanks! You can also download prebuilt binaries here: - https://justine.lol/ape.elf (Linux/FreeBSD/NetBSD/OpenBSD) - https://justine.lol/ape.macho (Apple) Install the appropriate one as `/usr/bin/ape`.
This commit is contained in:
parent
056dc5f554
commit
4e9662cbc7
75 changed files with 759 additions and 443 deletions
|
@ -72,13 +72,13 @@ TEST(plinko, worksOrPrintsNiceError) {
|
|||
struct sigaction ignore, saveint, savequit, savepipe;
|
||||
ignore.sa_flags = 0;
|
||||
ignore.sa_handler = SIG_IGN;
|
||||
EXPECT_EQ(0, sigemptyset(&ignore.sa_mask));
|
||||
EXPECT_EQ(0, sigaction(SIGINT, &ignore, &saveint));
|
||||
EXPECT_EQ(0, sigaction(SIGQUIT, &ignore, &savequit));
|
||||
EXPECT_EQ(0, sigaction(SIGPIPE, &ignore, &savepipe));
|
||||
EXPECT_EQ(0, sigemptyset(&chldmask));
|
||||
EXPECT_EQ(0, sigaddset(&chldmask, SIGCHLD));
|
||||
EXPECT_EQ(0, sigprocmask(SIG_BLOCK, &chldmask, &savemask));
|
||||
sigemptyset(&ignore.sa_mask);
|
||||
sigaction(SIGINT, &ignore, &saveint);
|
||||
sigaction(SIGQUIT, &ignore, &savequit);
|
||||
sigaction(SIGPIPE, &ignore, &savepipe);
|
||||
sigemptyset(&chldmask);
|
||||
sigaddset(&chldmask, SIGCHLD);
|
||||
sigprocmask(SIG_BLOCK, &chldmask, &savemask);
|
||||
ASSERT_NE(-1, pipe2(pfds[0], O_CLOEXEC));
|
||||
ASSERT_NE(-1, pipe2(pfds[1], O_CLOEXEC));
|
||||
ASSERT_NE(-1, (pid = fork()));
|
||||
|
@ -90,14 +90,14 @@ TEST(plinko, worksOrPrintsNiceError) {
|
|||
close(2), dup(pfds[1][1]);
|
||||
sigaction(SIGINT, &saveint, 0);
|
||||
sigaction(SIGQUIT, &savequit, 0);
|
||||
sigaction(SIGQUIT, &savepipe, 0);
|
||||
sigaction(SIGPIPE, &savepipe, 0);
|
||||
sigprocmask(SIG_SETMASK, &savemask, 0);
|
||||
execve("bin/plinko.com", (char *const[]){"bin/plinko.com", 0},
|
||||
(char *const[]){0});
|
||||
_exit(127);
|
||||
}
|
||||
EXPECT_NE(-1, close(pfds[0][0]));
|
||||
EXPECT_NE(-1, close(pfds[1][1]));
|
||||
close(pfds[0][0]);
|
||||
close(pfds[1][1]);
|
||||
for (i = 0; i < ARRAYLEN(kSauces); ++i) {
|
||||
EXPECT_NE(-1, (fdin = open(kSauces[i], O_RDONLY)));
|
||||
rc = _copyfd(fdin, pfds[0][1], -1);
|
||||
|
@ -118,10 +118,10 @@ TEST(plinko, worksOrPrintsNiceError) {
|
|||
} else {
|
||||
EXPECT_EQ(1, WEXITSTATUS(wstatus));
|
||||
}
|
||||
EXPECT_EQ(0, sigaction(SIGINT, &saveint, 0));
|
||||
EXPECT_EQ(0, sigaction(SIGQUIT, &savequit, 0));
|
||||
EXPECT_EQ(0, sigaction(SIGPIPE, &savepipe, 0));
|
||||
EXPECT_EQ(0, sigprocmask(SIG_SETMASK, &savemask, 0));
|
||||
sigaction(SIGINT, &saveint, 0);
|
||||
sigaction(SIGQUIT, &savequit, 0);
|
||||
sigaction(SIGPIPE, &savepipe, 0);
|
||||
sigprocmask(SIG_SETMASK, &savemask, 0);
|
||||
if (g_testlib_failed) {
|
||||
kprintf("note: got the following in pipe: %s%n", buf);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue