Stop using .com extension in monorepo

The WIN32 CreateProcess() function does not require an .exe or .com
suffix in order to spawn an executable. Now that we have Cosmo bash
we're no longer so dependent on the cmd.exe prompt.
This commit is contained in:
Justine Tunney 2024-03-02 16:57:56 -08:00
parent c8383f25b4
commit a6baba1b07
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
239 changed files with 2092 additions and 2244 deletions

View file

@ -11,13 +11,13 @@ TEST_DSP_CORE_OBJS = \
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%.o)
TEST_DSP_CORE_COMS = \
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_DSP_CORE_SRCS:%.c=o/$(MODE)/%)
TEST_DSP_CORE_TESTS = \
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_DSP_CORE_CHECKS = \
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_DSP_CORE_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_DSP_CORE_DIRECTDEPS = \
DSP_CORE \
@ -37,7 +37,7 @@ o/$(MODE)/test/dsp/core/core.pkg: \
$(TEST_DSP_CORE_OBJS) \
$(foreach x,$(TEST_DSP_CORE_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/dsp/core/%.com.dbg: \
o/$(MODE)/test/dsp/core/%.dbg: \
$(TEST_DSP_CORE_DEPS) \
o/$(MODE)/test/dsp/core/%.o \
$(LIBC_TESTMAIN) \

View file

@ -11,13 +11,13 @@ TEST_DSP_SCALE_OBJS = \
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%.o)
TEST_DSP_SCALE_COMS = \
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_DSP_SCALE_SRCS:%.c=o/$(MODE)/%)
TEST_DSP_SCALE_TESTS = \
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_DSP_SCALE_CHECKS = \
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_DSP_SCALE_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_DSP_SCALE_DIRECTDEPS = \
DSP_CORE \
@ -42,7 +42,7 @@ o/$(MODE)/test/dsp/scale/scale.pkg: \
$(TEST_DSP_SCALE_OBJS) \
$(foreach x,$(TEST_DSP_SCALE_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/dsp/scale/%.com.dbg: \
o/$(MODE)/test/dsp/scale/%.dbg: \
$(TEST_DSP_SCALE_DEPS) \
o/$(MODE)/test/dsp/scale/%.o \
o/$(MODE)/test/dsp/scale/scale.pkg \

View file

@ -11,13 +11,13 @@ TEST_DSP_TTY_OBJS = \
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.o)
TEST_DSP_TTY_COMS = \
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_DSP_TTY_SRCS:%.c=o/$(MODE)/%)
TEST_DSP_TTY_TESTS = \
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_DSP_TTY_CHECKS = \
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_DSP_TTY_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_DSP_TTY_DIRECTDEPS = \
DSP_TTY \
@ -38,7 +38,7 @@ o/$(MODE)/test/dsp/tty/tty.pkg: \
$(TEST_DSP_TTY_OBJS) \
$(foreach x,$(TEST_DSP_TTY_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/dsp/tty/%.com.dbg: \
o/$(MODE)/test/dsp/tty/%.dbg: \
$(TEST_DSP_TTY_DEPS) \
o/$(MODE)/test/dsp/tty/%.o \
o/$(MODE)/test/dsp/tty/tty.pkg \

View file

@ -13,21 +13,21 @@ TEST_LIBC_CALLS_OBJS = \
$(TEST_LIBC_CALLS_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_CALLS_COMS = \
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%)
TEST_LIBC_CALLS_BINS = \
$(TEST_LIBC_CALLS_COMS) \
$(TEST_LIBC_CALLS_COMS:%=%.dbg) \
o/$(MODE)/test/libc/calls/life-nomod.com \
o/$(MODE)/test/libc/calls/life-classic.com \
o/$(MODE)/test/libc/calls/zipread.com.dbg \
o/$(MODE)/test/libc/calls/zipread.com
o/$(MODE)/test/libc/calls/life-nomod \
o/$(MODE)/test/libc/calls/life-classic \
o/$(MODE)/test/libc/calls/zipread.dbg \
o/$(MODE)/test/libc/calls/zipread
TEST_LIBC_CALLS_TESTS = \
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_CALLS_CHECKS = \
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_CALLS_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_CALLS_DIRECTDEPS = \
DSP_CORE \
@ -61,7 +61,7 @@ o/$(MODE)/test/libc/calls/calls.pkg: \
$(TEST_LIBC_CALLS_OBJS) \
$(foreach x,$(TEST_LIBC_CALLS_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/calls/%.com.dbg: \
o/$(MODE)/test/libc/calls/%.dbg: \
$(TEST_LIBC_CALLS_DEPS) \
o/$(MODE)/test/libc/calls/%.o \
o/$(MODE)/test/libc/calls/calls.pkg \
@ -70,7 +70,7 @@ o/$(MODE)/test/libc/calls/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/calls/stat_test.com.dbg: \
o/$(MODE)/test/libc/calls/stat_test.dbg: \
$(TEST_LIBC_CALLS_DEPS) \
o/$(MODE)/test/libc/calls/stat_test.o \
o/$(MODE)/third_party/python/Lib/test/tokenize_tests-latin1-coding-cookie-and-utf8-bom-sig.txt.zip.o \
@ -80,7 +80,7 @@ o/$(MODE)/test/libc/calls/stat_test.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/calls/unveil_test.com.dbg: \
o/$(MODE)/test/libc/calls/unveil_test.dbg: \
$(TEST_LIBC_CALLS_DEPS) \
o/$(MODE)/test/libc/calls/unveil_test.o \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
@ -91,7 +91,7 @@ o/$(MODE)/test/libc/calls/unveil_test.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/calls/pledge_test.com.dbg: \
o/$(MODE)/test/libc/calls/pledge_test.dbg: \
$(TEST_LIBC_CALLS_DEPS) \
o/$(MODE)/test/libc/calls/pledge_test.o \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
@ -102,14 +102,14 @@ o/$(MODE)/test/libc/calls/pledge_test.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/calls/life-classic.com.dbg: \
o/$(MODE)/test/libc/calls/life-classic.dbg: \
$(LIBC_RUNTIME) \
o/$(MODE)/test/libc/calls/life.o \
$(CRT) \
$(APE)
@$(APELINK)
o/$(MODE)/test/libc/calls/life-nomod.com.dbg: \
o/$(MODE)/test/libc/calls/life-nomod.dbg: \
$(LIBC_RUNTIME) \
o/$(MODE)/test/libc/calls/life.o \
$(CRT) \
@ -117,43 +117,43 @@ o/$(MODE)/test/libc/calls/life-nomod.com.dbg: \
@$(APELINK)
o/$(MODE)/test/libc/calls/tiny64.elf.zip.o \
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
o/$(MODE)/test/libc/calls/life-classic.com.zip.o \
o/$(MODE)/test/libc/calls/zipread.com.zip.o: private \
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
o/$(MODE)/test/libc/calls/life-classic.zip.o \
o/$(MODE)/test/libc/calls/zipread.zip.o: private \
ZIPOBJ_FLAGS += \
-B
# TODO(jart): Have pledge() support SIOCGIFCONF
o/$(MODE)/test/libc/calls/ioctl_test.com.runs: \
o/$(MODE)/test/libc/calls/ioctl_test.runs: \
private .PLEDGE =
o/$(MODE)/test/libc/calls/lseek_test.com.runs \
o/$(MODE)/test/libc/calls/poll_test.com.runs: \
o/$(MODE)/test/libc/calls/lseek_test.runs \
o/$(MODE)/test/libc/calls/poll_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
o/$(MODE)/test/libc/calls/fcntl_test.com.runs \
o/$(MODE)/test/libc/calls/lock_test.com.runs \
o/$(MODE)/test/libc/calls/lock2_test.com.runs \
o/$(MODE)/test/libc/calls/lock_ofd_test.com.runs: \
o/$(MODE)/test/libc/calls/fcntl_test.runs \
o/$(MODE)/test/libc/calls/lock_test.runs \
o/$(MODE)/test/libc/calls/lock2_test.runs \
o/$(MODE)/test/libc/calls/lock_ofd_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
o/$(MODE)/test/libc/calls/unveil_test.com.runs \
o/$(MODE)/test/libc/calls/openbsd_test.com.runs: \
o/$(MODE)/test/libc/calls/unveil_test.runs \
o/$(MODE)/test/libc/calls/openbsd_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc unveil
o/$(MODE)/test/libc/calls/fexecve_test.com.runs: \
o/$(MODE)/test/libc/calls/fexecve_test.runs: \
private .UNSANDBOXED = 1 # for memfd_create()
o/$(MODE)/test/libc/calls/execve_test.com.runs: \
o/$(MODE)/test/libc/calls/execve_test.runs: \
private .UNSANDBOXED = 1 # for memfd_create()
o/$(MODE)/test/libc/calls/read_test.com.runs: \
o/$(MODE)/test/libc/calls/read_test.runs: \
private .UNVEIL += /dev/zero
# TODO(jart): Update nointernet() to allow AF_INET6
o/$(MODE)/test/libc/calls/pledge_test.com.runs: \
o/$(MODE)/test/libc/calls/pledge_test.runs: \
private .INTERNET = 1
o/$(MODE)/test/libc/calls/pledge_test.com.runs: \
o/$(MODE)/test/libc/calls/pledge_test.runs: \
private .PLEDGE =
.PHONY: o/$(MODE)/test/libc/calls

View file

@ -55,35 +55,34 @@ TEST(commandv, testPathSearch) {
}
TEST(commandv, testSlashes_wontSearchPath_butChecksAccess) {
EXPECT_SYS(0, 3, creat("home/sh.com", 0755));
EXPECT_SYS(0, 3, creat("home/sh", 0755));
EXPECT_SYS(0, 2, write(3, "MZ", 2));
EXPECT_SYS(0, 0, close(3));
EXPECT_STREQ("home/sh.com",
commandv("home/sh.com", pathbuf, sizeof(pathbuf)));
EXPECT_STREQ("home/sh", commandv("home/sh", pathbuf, sizeof(pathbuf)));
}
TEST(commandv, testSameDir_doesntHappenByDefaultUnlessItsWindows) {
EXPECT_SYS(0, 3, creat("bog.com", 0755));
EXPECT_SYS(0, 3, creat("bog", 0755));
EXPECT_SYS(0, 2, write(3, "MZ", 2));
EXPECT_SYS(0, 0, close(3));
EXPECT_STREQ(NULL, commandv("bog.com", pathbuf, sizeof(pathbuf)));
EXPECT_STREQ(NULL, commandv("bog", pathbuf, sizeof(pathbuf)));
EXPECT_EQ(ENOENT, errno);
}
TEST(commandv, testSameDir_willHappenWithColonBlank) {
ASSERT_NE(-1, setenv("PATH", "bin:", true));
EXPECT_SYS(0, 3, creat("bog.com", 0755));
EXPECT_SYS(0, 3, creat("bog", 0755));
EXPECT_SYS(0, 2, write(3, "MZ", 2));
EXPECT_SYS(0, 0, close(3));
EXPECT_STREQ("bog.com", commandv("bog.com", pathbuf, sizeof(pathbuf)));
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
}
TEST(commandv, testSameDir_willHappenWithColonBlank2) {
ASSERT_NE(-1, setenv("PATH", ":bin", true));
EXPECT_SYS(0, 3, creat("bog.com", 0755));
EXPECT_SYS(0, 3, creat("bog", 0755));
EXPECT_SYS(0, 2, write(3, "MZ", 2));
EXPECT_SYS(0, 0, close(3));
EXPECT_STREQ("bog.com", commandv("bog.com", pathbuf, sizeof(pathbuf)));
EXPECT_STREQ("bog", commandv("bog", pathbuf, sizeof(pathbuf)));
}
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) {
@ -95,9 +94,8 @@ TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable) {
TEST(commandv, test_DirPaths_wontConsiderDirectoriesExecutable2) {
ASSERT_NE(-1, setenv("PATH", ":bin", true));
EXPECT_SYS(0, 0, mkdir("this_is_a_directory.com", 0755));
EXPECT_STREQ(NULL,
commandv("this_is_a_directory.com", pathbuf, sizeof(pathbuf)));
EXPECT_SYS(0, 0, mkdir("this_is_a_directory", 0755));
EXPECT_STREQ(NULL, commandv("this_is_a_directory", pathbuf, sizeof(pathbuf)));
EXPECT_EQ(ENOENT, errno);
}

View file

@ -124,7 +124,7 @@ TEST(GetProgramExecutableName, movedSelf) {
if (skiptests) return;
if (IsAarch64() && IsQemuUser()) {
// clang-format off
// TODO(mrdomino): fix: make -j8 m=aarch64 o/aarch64/test/libc/calls/getprogramexecutablename_test.com.ok
// TODO(mrdomino): fix: make -j8 m=aarch64 o/aarch64/test/libc/calls/getprogramexecutablename_test.ok
// possibly related to the intersection of binfmt_misc and qemu-aarch64
// clang-format on
return;

View file

@ -85,9 +85,9 @@ TEST(mkntcmdline, fixit) {
}
TEST(mkntcmdline, testWut) {
char *argv[] = {"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛.com", "--strace", NULL};
char *argv[] = {"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛", "--strace", NULL};
EXPECT_NE(-1, mkntcmdline(cmdline, argv));
EXPECT_STREQ(u"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛.com --strace", cmdline);
EXPECT_STREQ(u"C:\\Users\\jart\\𝑟𝑒𝑑𝑏𝑒𝑎𝑛 --strace", cmdline);
}
BENCH(mkntcmdline, lotsOfArgs) {

View file

@ -37,8 +37,8 @@ TEST(mkntpath, testSlashes) {
* all it takes to make the feature entirely useless to us, similar to
* the law of noncontradiction. We address the issue as follows:
*/
EXPECT_EQ(9, __mkntpath("o/foo.com", p));
EXPECT_STREQ(u"o\\foo.com", p);
EXPECT_EQ(5, __mkntpath("o/foo", p));
EXPECT_STREQ(u"o\\foo", p);
}
TEST(mkntpath, testUnicode) {

View file

@ -6,58 +6,58 @@ PKGS += TEST_LIBC_FMT
TEST_LIBC_FMT_SRCS := $(wildcard test/libc/fmt/*.c)
TEST_LIBC_FMT_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_FMT_SRCS))
TEST_LIBC_FMT_BINS = $(TEST_LIBC_FMT_COMS) $(TEST_LIBC_FMT_COMS:%=%.dbg)
TEST_LIBC_FMT_TESTS = $(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_LIBC_FMT_TESTS = $(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_FMT_OBJS = \
TEST_LIBC_FMT_OBJS = \
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_FMT_COMS = \
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%.com)
TEST_LIBC_FMT_COMS = \
$(TEST_LIBC_FMT_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_FMT_CHECKS = \
$(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
TEST_LIBC_FMT_CHECKS = \
$(TEST_LIBC_FMT_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_FMT_DIRECTDEPS = \
LIBC_FMT \
LIBC_INTRIN \
LIBC_LOG \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_TESTLIB \
LIBC_TINYMATH \
LIBC_X \
TEST_LIBC_FMT_DIRECTDEPS = \
LIBC_FMT \
LIBC_INTRIN \
LIBC_LOG \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_TESTLIB \
LIBC_TINYMATH \
LIBC_X \
THIRD_PARTY_GDTOA
TEST_LIBC_FMT_DEPS := \
TEST_LIBC_FMT_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x))))
o/$(MODE)/test/libc/fmt/fmt.pkg: \
$(TEST_LIBC_FMT_OBJS) \
o/$(MODE)/test/libc/fmt/fmt.pkg: \
$(TEST_LIBC_FMT_OBJS) \
$(foreach x,$(TEST_LIBC_FMT_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/fmt/%.com.dbg: \
$(TEST_LIBC_FMT_DEPS) \
o/$(MODE)/test/libc/fmt/%.o \
o/$(MODE)/test/libc/fmt/fmt.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
o/$(MODE)/test/libc/fmt/%.dbg: \
$(TEST_LIBC_FMT_DEPS) \
o/$(MODE)/test/libc/fmt/%.o \
o/$(MODE)/test/libc/fmt/fmt.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
$(TEST_LIBC_FMT_OBJS): test/libc/fmt/BUILD.mk
$(TEST_LIBC_FMT_OBJS): private \
DEFAULT_CCFLAGS += \
$(TEST_LIBC_FMT_OBJS): private \
DEFAULT_CCFLAGS += \
-fno-builtin
o/$(MODE)/test/libc/fmt/fprintf_test.com.runs: \
o/$(MODE)/test/libc/fmt/fprintf_test.runs: \
private .UNVEIL += w:/dev/full
.PHONY: o/$(MODE)/test/libc/fmt
o/$(MODE)/test/libc/fmt: \
$(TEST_LIBC_FMT_BINS) \
o/$(MODE)/test/libc/fmt: \
$(TEST_LIBC_FMT_BINS) \
$(TEST_LIBC_FMT_CHECKS)

View file

@ -23,19 +23,19 @@
#include "libc/x/x.h"
TEST(stripexts, test) {
char s[] = "foo/bar.com.dbg";
char s[] = "foo/bar.dbg";
EXPECT_STREQ("foo/bar", stripexts(s));
}
TEST(stripexts, test2) {
char s[] = "foo/bar.com.dbg";
char s[] = "foo/bar.dbg";
EXPECT_STREQ("bar", stripexts(basename(s)));
}
TEST(xstripexts, test) {
EXPECT_STREQ("foo/bar", gc(xstripexts("foo/bar.com.dbg")));
EXPECT_STREQ("foo/bar", gc(xstripexts("foo/bar.dbg")));
}
TEST(xstripexts, test2) {
EXPECT_STREQ("bar", gc(xstripexts(basename("foo/bar.com.dbg"))));
EXPECT_STREQ("bar", gc(xstripexts(basename("foo/bar.dbg"))));
}

View file

@ -10,17 +10,17 @@ TEST_LIBC_INTRIN_OBJS = \
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_INTRIN_COMS = \
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_INTRIN_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_INTRIN_BINS = \
$(TEST_LIBC_INTRIN_COMS) \
$(TEST_LIBC_INTRIN_COMS:%=%.dbg)
TEST_LIBC_INTRIN_TESTS = \
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_INTRIN_CHECKS = \
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_INTRIN_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_INTRIN_DIRECTDEPS = \
LIBC_CALLS \
@ -50,7 +50,7 @@ o/$(MODE)/test/libc/intrin/intrin.pkg: \
$(TEST_LIBC_INTRIN_OBJS) \
$(foreach x,$(TEST_LIBC_INTRIN_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/intrin/%.com.dbg: \
o/$(MODE)/test/libc/intrin/%.dbg: \
$(TEST_LIBC_INTRIN_DEPS) \
o/$(MODE)/test/libc/intrin/%.o \
o/$(MODE)/test/libc/intrin/intrin.pkg \
@ -60,7 +60,7 @@ o/$(MODE)/test/libc/intrin/%.com.dbg: \
@$(APELINK)
# Test what happens when *NSYNC isn't linked.
o/$(MODE)/test/libc/intrin/lock_test.com.dbg: \
o/$(MODE)/test/libc/intrin/lock_test.dbg: \
$(TEST_LIBC_INTRIN_DEPS) \
o/$(MODE)/test/libc/intrin/lock_test.o \
o/$(MODE)/test/libc/intrin/intrin.pkg \

View file

@ -31,7 +31,7 @@
*
* This test can be run as follows:
*
* make o//test/libc/intrin/lockscale_test.com.runs V=5 TESTARGS=-b
* make o//test/libc/intrin/lockscale_test.runs V=5 TESTARGS=-b
*
* It's intended to demonstrate the importance of futexes. On systems
* that don't have them, this test consumes orders of a magnitude more

View file

@ -8,21 +8,21 @@ TEST_LIBC_LOG_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_LOG_SRCS))
TEST_LIBC_LOG_OBJS = \
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%.o) \
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o
o/$(MODE)/test/libc/log/backtrace.zip.o \
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o
TEST_LIBC_LOG_COMS = \
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_LOG_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_LOG_BINS = \
$(TEST_LIBC_LOG_COMS) \
$(TEST_LIBC_LOG_COMS:%=%.dbg)
TEST_LIBC_LOG_TESTS = \
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_LOG_CHECKS = \
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_LOG_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_LOG_DIRECTDEPS = \
LIBC_CALLS \
@ -47,7 +47,7 @@ o/$(MODE)/test/libc/log/log.pkg: \
$(TEST_LIBC_LOG_OBJS) \
$(foreach x,$(TEST_LIBC_LOG_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/log/%.com.dbg: \
o/$(MODE)/test/libc/log/%.dbg: \
$(TEST_LIBC_LOG_DEPS) \
o/$(MODE)/test/libc/log/%.o \
o/$(MODE)/test/libc/log/log.pkg \
@ -56,10 +56,10 @@ o/$(MODE)/test/libc/log/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/log/backtrace_test.com.dbg: \
o/$(MODE)/test/libc/log/backtrace_test.dbg: \
$(TEST_LIBC_LOG_DEPS) \
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o \
o/$(MODE)/test/libc/log/backtrace.zip.o \
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o \
o/$(MODE)/test/libc/log/backtrace_test.o \
o/$(MODE)/test/libc/log/log.pkg \
$(LIBC_TESTMAIN) \
@ -67,15 +67,15 @@ o/$(MODE)/test/libc/log/backtrace_test.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/log/backtrace.com.dbg: \
o/$(MODE)/test/libc/log/backtrace.dbg: \
$(TEST_LIBC_LOG_DEPS) \
o/$(MODE)/test/libc/log/backtrace.o \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/log/backtrace.com.zip.o \
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o: private \
o/$(MODE)/test/libc/log/backtrace.zip.o \
o/$(MODE)/test/libc/log/backtrace.dbg.zip.o: private \
ZIPOBJ_FLAGS += \
-B

View file

@ -41,14 +41,14 @@
#ifdef __x86_64__
#if 0
__static_yoink("backtrace.com");
__static_yoink("backtrace.com.dbg");
__static_yoink("backtrace");
__static_yoink("backtrace.dbg");
void SetUpOnce(void) {
testlib_enable_tmp_setup_teardown_once();
ASSERT_NE(-1, mkdir("bin", 0755));
testlib_extract("/zip/backtrace.com", "bin/backtrace.com", 0755);
testlib_extract("/zip/backtrace.com.dbg", "bin/backtrace.com.dbg", 0755);
testlib_extract("/zip/backtrace", "bin/backtrace", 0755);
testlib_extract("/zip/backtrace.dbg", "bin/backtrace.dbg", 0755);
}
static bool OutputHasSymbol(const char *output, const char *s) {
@ -56,7 +56,7 @@ static bool OutputHasSymbol(const char *output, const char *s) {
}
// UNFREED MEMORY
// o/dbg/test/libc/log/backtrace_test.com
// o/dbg/test/libc/log/backtrace_test
// max allocated space 655,360
// total allocated space 80
// total free space 327,600
@ -95,7 +95,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "6", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "6", 0});
_Exit(127);
}
close(fds[1]);
@ -126,7 +126,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
}
// error: Uncaught SIGFPE (FPE_INTDIV) on nightmare pid 11724
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
// ENOTTY[25]
// Linux nightmare SMP Thu, 12 Aug 2021 06:16:45 UTC
//
@ -164,9 +164,9 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
// /* 22 frames mapped w/ 1,879,015,395 frames gapped */
//
// 00400000-0045b000 r-xp 00000000 08:03 4587526
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
// 0045b000-00461000 rw-p 0005b000 08:03 4587526
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721
// 00461000-004a0000 rw-p 00000000 00:00 0
// 80070000-80090000 rw-p 00000000 00:00 0
// e007ffd0000-e0080000000 rw-p 00000000 00:00 0
@ -176,7 +176,7 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
// 7ffe075a8000-7ffe075ab000 r--p 00000000 00:00 0 [vvar]
// 7ffe075ab000-7ffe075ac000 r-xp 00000000 00:00 0 [vdso]
//
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.com.tmp.11721 1
// /home/jart/cosmo/o/dbg/test/libc/log/backtrace_test.tmp.11721 1
TEST(ShowCrashReports, testDivideByZero) {
size_t got;
ssize_t rc;
@ -187,7 +187,7 @@ TEST(ShowCrashReports, testDivideByZero) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "1", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "1", 0});
_Exit(127);
}
close(fds[1]);
@ -312,7 +312,7 @@ TEST(ShowCrashReports, testBssOverrunCrash) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "2", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "2", 0});
_Exit(127);
}
close(fds[1]);
@ -387,7 +387,7 @@ TEST(ShowCrashReports, testNpeCrash) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "7", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "7", 0});
_Exit(127);
}
close(fds[1]);
@ -431,7 +431,7 @@ TEST(ShowCrashReports, testDataOverrunCrash) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "4", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "4", 0});
_Exit(127);
}
close(fds[1]);
@ -479,7 +479,7 @@ TEST(ShowCrashReports, testNpeCrashAfterFinalize) {
if (!pid) {
dup2(fds[1], 1);
dup2(fds[1], 2);
execv("bin/backtrace.com", (char *const[]){"bin/backtrace.com", "8", 0});
execv("bin/backtrace", (char *const[]){"bin/backtrace", "8", 0});
_Exit(127);
}
close(fds[1]);

View file

@ -13,20 +13,20 @@ TEST_LIBC_MEM_OBJS = \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.o)
TEST_LIBC_MEM_COMS = \
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com)
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%)
TEST_LIBC_MEM_BINS = \
$(TEST_LIBC_MEM_COMS) \
$(TEST_LIBC_MEM_COMS:%=%.dbg)
TEST_LIBC_MEM_TESTS = \
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.ok) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com.ok)
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.ok) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.ok)
TEST_LIBC_MEM_CHECKS = \
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.runs) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com.runs)
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.runs) \
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.runs)
TEST_LIBC_MEM_DIRECTDEPS = \
LIBC_CALLS \
@ -55,7 +55,7 @@ o/$(MODE)/test/libc/mem/mem.pkg: \
$(TEST_LIBC_MEM_OBJS) \
$(foreach x,$(TEST_LIBC_MEM_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/mem/%.com.dbg: \
o/$(MODE)/test/libc/mem/%.dbg: \
$(TEST_LIBC_MEM_DEPS) \
o/$(MODE)/test/libc/mem/%.o \
o/$(MODE)/test/libc/mem/mem.pkg \
@ -74,7 +74,7 @@ o/$(MODE)/test/libc/mem/prog/sock.o: \
################################################################################
o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
o/$(MODE)/test/libc/mem/prog/life.dbg: \
$(LIBC_RUNTIME) \
o/$(MODE)/test/libc/mem/prog/life.o \
$(CRT) \
@ -82,14 +82,14 @@ o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
@$(APELINK)
o/$(MODE)/test/libc/mem/prog/life.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/life.com
o/$(MODE)/tool/build/assimilate \
o/$(MODE)/test/libc/mem/prog/life
@$(COMPILE) -wACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/life.com \
build/bootstrap/cp \
o/$(MODE)/test/libc/mem/prog/life \
o/$(MODE)/test/libc/mem/prog/life.elf
@$(COMPILE) -wAASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com -bcef \
o/$(MODE)/tool/build/assimilate -bcef \
o/$(MODE)/test/libc/mem/prog/life.elf
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: private \
@ -98,13 +98,13 @@ o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: private \
################################################################################
o/$(MODE)/test/libc/mem/prog/life.com.zip.o: private \
o/$(MODE)/test/libc/mem/prog/life.zip.o: private \
ZIPOBJ_FLAGS += \
-B
################################################################################
o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
o/$(MODE)/test/libc/mem/prog/sock.dbg: \
$(LIBC_RUNTIME) \
$(LIBC_SOCK) \
o/$(MODE)/test/libc/mem/prog/sock.o \
@ -113,14 +113,14 @@ o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
@$(APELINK)
o/$(MODE)/test/libc/mem/prog/sock.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/sock.com
o/$(MODE)/tool/build/assimilate \
o/$(MODE)/test/libc/mem/prog/sock
@$(COMPILE) -wACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/sock.com \
build/bootstrap/cp \
o/$(MODE)/test/libc/mem/prog/sock \
o/$(MODE)/test/libc/mem/prog/sock.elf
@$(COMPILE) -wAASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com -cef \
o/$(MODE)/tool/build/assimilate -cef \
o/$(MODE)/test/libc/mem/prog/sock.elf
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o: private \

View file

@ -12,17 +12,17 @@ TEST_LIBC_NEXGEN32E_OBJS = \
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_NEXGEN32E_COMS = \
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_NEXGEN32E_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_NEXGEN32E_BINS = \
$(TEST_LIBC_NEXGEN32E_COMS) \
$(TEST_LIBC_NEXGEN32E_COMS:%=%.dbg)
TEST_LIBC_NEXGEN32E_TESTS = \
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_NEXGEN32E_CHECKS = \
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_NEXGEN32E_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_NEXGEN32E_DIRECTDEPS = \
LIBC_CALLS \
@ -48,7 +48,7 @@ o/$(MODE)/test/libc/nexgen32e/nexgen32e.pkg: \
$(TEST_LIBC_NEXGEN32E_OBJS) \
$(foreach x,$(TEST_LIBC_NEXGEN32E_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/nexgen32e/%.com.dbg: \
o/$(MODE)/test/libc/nexgen32e/%.dbg: \
$(TEST_LIBC_NEXGEN32E_DEPS) \
o/$(MODE)/test/libc/nexgen32e/%.o \
o/$(MODE)/test/libc/nexgen32e/nexgen32e.pkg \
@ -58,10 +58,10 @@ o/$(MODE)/test/libc/nexgen32e/%.com.dbg: \
@$(APELINK)
# we can't run this test on openbsd because rwx memory isn't allowed
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com.ok: \
o/$(MODE)/tool/build/runit.com \
o/$(MODE)/tool/build/runitd.com \
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.com
o/$(MODE)/test/libc/nexgen32e/stackrwx_test.ok: \
o/$(MODE)/tool/build/runit \
o/$(MODE)/tool/build/runitd \
o/$(MODE)/test/libc/nexgen32e/stackrwx_test
@$(COMPILE) -wATEST -tT$@ $^ $(filter-out openbsd,$(HOSTS))
$(TEST_LIBC_NEXGEN32E_OBJS): private \

View file

@ -6,90 +6,90 @@ PKGS += TEST_LIBC_PROC
TEST_LIBC_PROC_SRCS := $(wildcard test/libc/proc/*.c)
TEST_LIBC_PROC_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_PROC_SRCS))
TEST_LIBC_PROC_OBJS = \
TEST_LIBC_PROC_OBJS = \
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_PROC_COMS = \
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%.com)
TEST_LIBC_PROC_COMS = \
$(TEST_LIBC_PROC_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_PROC_BINS = \
$(TEST_LIBC_PROC_COMS) \
TEST_LIBC_PROC_BINS = \
$(TEST_LIBC_PROC_COMS) \
$(TEST_LIBC_PROC_COMS:%=%.dbg)
TEST_LIBC_PROC_TESTS = \
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_LIBC_PROC_TESTS = \
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_PROC_CHECKS = \
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
TEST_LIBC_PROC_CHECKS = \
$(TEST_LIBC_PROC_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_PROC_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_NT_KERNEL32 \
LIBC_RUNTIME \
LIBC_PROC \
LIBC_STR \
LIBC_SYSV \
LIBC_TESTLIB \
LIBC_THREAD \
LIBC_X \
THIRD_PARTY_MUSL \
TEST_LIBC_PROC_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_NT_KERNEL32 \
LIBC_RUNTIME \
LIBC_PROC \
LIBC_STR \
LIBC_SYSV \
LIBC_TESTLIB \
LIBC_THREAD \
LIBC_X \
THIRD_PARTY_MUSL \
THIRD_PARTY_TR
TEST_LIBC_PROC_DEPS := \
TEST_LIBC_PROC_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x))))
o/$(MODE)/test/libc/proc/proc.pkg: \
$(TEST_LIBC_PROC_OBJS) \
o/$(MODE)/test/libc/proc/proc.pkg: \
$(TEST_LIBC_PROC_OBJS) \
$(foreach x,$(TEST_LIBC_PROC_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/proc/%.com.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/%.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/tool/build/echo.com.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
o/$(MODE)/test/libc/proc/%.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/%.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/tool/build/echo.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/proc/posix_spawn_test.com.runs: \
o/$(MODE)/test/libc/proc/posix_spawn_test.runs: \
private QUOTA += -M8192m
o/$(MODE)/test/libc/proc/posix_spawn_test.com.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/posix_spawn_test.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/tool/build/echo.com.zip.o \
o/$(MODE)/tool/build/cocmd.com.zip.o \
o/$(MODE)/test/libc/mem/prog/life.com.zip.o \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
o/$(MODE)/test/libc/proc/life-pe.com.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
o/$(MODE)/test/libc/proc/posix_spawn_test.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/posix_spawn_test.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/tool/build/echo.zip.o \
o/$(MODE)/tool/build/cocmd.zip.o \
o/$(MODE)/test/libc/mem/prog/life.zip.o \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
o/$(MODE)/test/libc/proc/life-pe.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/proc/system_test.com.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/system_test.o \
o/$(MODE)/test/libc/proc/proc.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) \
o/$(MODE)/test/libc/proc/system_test.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/system_test.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/tool/build/echo.zip.o \
o/$(MODE)/tool/build/cocmd.zip.o \
o/$(MODE)/tool/build/false.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/proc/execve_test.com.dbg: \
o/$(MODE)/test/libc/proc/execve_test.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/execve_test.o \
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
o/$(MODE)/test/libc/proc/execve_test_prog1.com.zip.o \
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
o/$(MODE)/test/libc/proc/execve_test_prog1.zip.o \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o \
o/$(MODE)/test/libc/proc/proc.pkg \
@ -98,26 +98,26 @@ o/$(MODE)/test/libc/proc/execve_test.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/proc/fexecve_test.com.dbg: \
o/$(MODE)/test/libc/proc/fexecve_test.dbg: \
$(TEST_LIBC_PROC_DEPS) \
o/$(MODE)/test/libc/proc/fexecve_test.o \
o/$(MODE)/test/libc/proc/fexecve_test.o \
o/$(MODE)/test/libc/proc/proc.pkg \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o \
o/$(MODE)/test/libc/calls/zipread.com.zip.o \
o/$(MODE)/test/libc/calls/life-nomod.zip.o \
o/$(MODE)/test/libc/calls/zipread.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/proc/execve_test_prog1.com.zip.o \
o/$(MODE)/test/libc/proc/life-pe.com.zip.o: private \
ZIPOBJ_FLAGS += \
o/$(MODE)/test/libc/proc/execve_test_prog1.zip.o \
o/$(MODE)/test/libc/proc/life-pe.zip.o: private \
ZIPOBJ_FLAGS += \
-B
$(TEST_LIBC_PROC_OBJS): test/libc/proc/BUILD.mk
.PHONY: o/$(MODE)/test/libc/proc
o/$(MODE)/test/libc/proc: \
$(TEST_LIBC_PROC_BINS) \
o/$(MODE)/test/libc/proc: \
$(TEST_LIBC_PROC_BINS) \
$(TEST_LIBC_PROC_CHECKS)

View file

@ -51,8 +51,8 @@ void GenBuf(char buf[8], int x) {
TEST(execve, testArgPassing) {
int i;
char ibuf[12], buf[8];
const char *prog = "./execve_test_prog1.com";
testlib_extract("/zip/execve_test_prog1.com", prog, 0755);
const char *prog = "./execve_test_prog1";
testlib_extract("/zip/execve_test_prog1", prog, 0755);
for (i = 0; i < N; ++i) {
FormatInt32(ibuf, i);
GenBuf(buf, i);
@ -84,12 +84,12 @@ TEST(execve, ziposAPE) {
if (IsFreebsd()) return; // TODO: fixme on freebsd
if (IsLinux() && !__is_linux_2_6_23()) return; // TODO: fixme on old linux
if (!IsLinux() && !IsFreebsd()) {
EXPECT_EQ(-1, execve("/zip/life-nomod.com", (char *const[]){0},
(char *const[]){0}));
EXPECT_EQ(
-1, execve("/zip/life-nomod", (char *const[]){0}, (char *const[]){0}));
return;
}
SPAWN(fork);
execve("/zip/life-nomod.com", (char *const[]){0}, (char *const[]){0});
execve("/zip/life-nomod", (char *const[]){0}, (char *const[]){0});
kprintf("execve failed: %m\n");
EXITS(42);
}

View file

@ -102,9 +102,9 @@ TEST(fexecve, memfd_create) {
TEST(fexecve, APE) {
if (!IsLinux() && !IsFreebsd()) return;
testlib_extract("/zip/life-nomod.com", "life-nomod.com", 0555);
testlib_extract("/zip/life-nomod", "life-nomod", 0555);
SPAWN(fork);
int fd = open("life-nomod.com", O_RDONLY);
int fd = open("life-nomod", O_RDONLY);
ASSERT_NE(-1, fd);
fexecve(fd, (char *const[]){0}, (char *const[]){0});
EXITS(42);
@ -112,9 +112,9 @@ TEST(fexecve, APE) {
TEST(fexecve, APE_cloexec) {
if (!IsLinux() && !IsFreebsd()) return;
testlib_extract("/zip/life-nomod.com", "life-nomod.com", 0555);
testlib_extract("/zip/life-nomod", "life-nomod", 0555);
SPAWN(fork);
int fd = open("life-nomod.com", O_RDONLY | O_CLOEXEC);
int fd = open("life-nomod", O_RDONLY | O_CLOEXEC);
ASSERT_NE(-1, fd);
fexecve(fd, (char *const[]){0}, (char *const[]){0});
EXITS(42);
@ -132,7 +132,7 @@ TEST(fexecve, zipos) {
TEST(fexecve, ziposAPE) {
if (!IsLinux() && !IsFreebsd()) return;
int fd = open("/zip/life-nomod.com", O_RDONLY);
int fd = open("/zip/life-nomod", O_RDONLY);
ASSERT_NE(-1, fd);
SPAWN(fork);
fexecve(fd, (char *const[]){0}, (char *const[]){0});
@ -143,7 +143,7 @@ TEST(fexecve, ziposAPE) {
TEST(fexecve, ziposAPEHasZipos) {
if (1) return; // TODO: fixme
if (!IsLinux() && !IsFreebsd()) return;
int fd = open("/zip/zipread.com", O_RDONLY);
int fd = open("/zip/zipread", O_RDONLY);
ASSERT_NE(-1, fd);
SPAWN(fork);
ASSERT_NE(-1, fd);

View file

@ -29,7 +29,7 @@
void SetUp(void) {
if (getpriority(PRIO_PROCESS, getpid()) != 0) {
kprintf("getpriority_test.com must be launched at priority zero\n");
kprintf("getpriority_test must be launched at priority zero\n");
exit(0);
}
}

View file

@ -118,10 +118,10 @@ TEST(posix_spawn, self) {
TEST(posix_spawn, ape) {
int ws, pid;
char *prog = "./life.com";
char *prog = "./life";
char *args[] = {prog, 0};
char *envs[] = {0};
testlib_extract("/zip/life.com", prog, 0755);
testlib_extract("/zip/life", prog, 0755);
ASSERT_EQ(0, posix_spawn(&pid, prog, NULL, NULL, args, envs));
ASSERT_NE(-1, waitpid(pid, &ws, 0));
ASSERT_TRUE(WIFEXITED(ws));
@ -145,9 +145,9 @@ TEST(posix_spawn, elf) {
TEST(posix_spawn, pipe) {
char buf[10];
int p[2], pid, status;
const char *pn = "./echo.com";
const char *pn = "./echo";
posix_spawn_file_actions_t fa;
testlib_extract("/zip/echo.com", "echo.com", 0755);
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_SYS(0, 0, pipe(p));
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
ASSERT_EQ(0, posix_spawn_file_actions_addclose(&fa, p[0]));
@ -165,17 +165,17 @@ TEST(posix_spawn, pipe) {
TEST(posix_spawn, chdir) {
int ws, pid, p[2];
char buf[16] = {0};
char *args[] = {"cocmd.com", "-c", "cat hello.txt", 0};
char *args[] = {"cocmd", "-c", "cat hello.txt", 0};
char *envs[] = {0};
posix_spawn_file_actions_t fa;
testlib_extract("/zip/cocmd.com", "cocmd.com", 0755);
testlib_extract("/zip/cocmd", "cocmd", 0755);
ASSERT_SYS(0, 0, mkdir("subdir", 0777));
ASSERT_SYS(0, 0, xbarf("subdir/hello.txt", "hello\n", -1));
ASSERT_SYS(0, 0, pipe2(p, O_CLOEXEC));
ASSERT_EQ(0, posix_spawn_file_actions_init(&fa));
ASSERT_EQ(0, posix_spawn_file_actions_adddup2(&fa, p[1], 1));
ASSERT_EQ(0, posix_spawn_file_actions_addchdir_np(&fa, "subdir"));
ASSERT_EQ(0, posix_spawn(&pid, "../cocmd.com", &fa, 0, args, envs));
ASSERT_EQ(0, posix_spawn(&pid, "../cocmd", &fa, 0, args, envs));
ASSERT_EQ(0, posix_spawn_file_actions_destroy(&fa));
ASSERT_SYS(0, 0, close(p[1]));
ASSERT_NE(-1, waitpid(pid, &ws, 0));
@ -201,8 +201,8 @@ TEST(posix_spawn, torture) {
posix_spawn_file_actions_t fa;
signal(SIGUSR2, OhMyGoth);
sigfillset(&allsig);
if (!fileexists("echo.com")) {
testlib_extract("/zip/echo.com", "echo.com", 0755);
if (!fileexists("echo")) {
testlib_extract("/zip/echo", "echo", 0755);
}
// XXX: NetBSD doesn't seem to let us set the scheduler to itself ;_;
ASSERT_EQ(0, posix_spawnattr_init(&attr));
@ -220,10 +220,10 @@ TEST(posix_spawn, torture) {
for (int i = 0; i < n; ++i) {
char *volatile zzz = malloc(13);
volatile int fd = open("/dev/null", O_WRONLY);
char *args[] = {"./echo.com", NULL};
char *args[] = {"./echo", NULL};
char *envs[] = {NULL};
raise(SIGUSR2);
ASSERT_EQ(0, posix_spawn(&pid, "./echo.com", &fa, &attr, args, envs));
ASSERT_EQ(0, posix_spawn(&pid, "./echo", &fa, &attr, args, envs));
ASSERT_FALSE(__vforked);
ASSERT_NE(-1, waitpid(pid, &ws, 0));
EXPECT_FALSE(WIFSIGNALED(ws));
@ -246,7 +246,7 @@ void *Torturer(void *arg) {
TEST(posix_spawn, agony) {
int i, n = 4;
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
testlib_extract("/zip/echo.com", "echo.com", 0755);
testlib_extract("/zip/echo", "echo", 0755);
for (i = 0; i < n; ++i) {
ASSERT_EQ(0, pthread_create(t + i, 0, Torturer, 0));
}
@ -264,11 +264,11 @@ TEST(posix_spawn, etxtbsy) {
if (IsNetbsd()) return; // they don't appear impacted by this race condition
if (IsOpenbsd()) return; // they don't appear impacted by this race condition
int ws, me, pid, thief;
char *prog = "./life.com";
char *prog = "./life";
char *args[] = {prog, 0};
char *envs[] = {0};
sigset_t ss, old;
testlib_extract("/zip/life.com", prog, 0755);
testlib_extract("/zip/life", prog, 0755);
for (int i = 0; i < 2; ++i) {
sigemptyset(&ss);
sigaddset(&ss, SIGUSR1);
@ -382,22 +382,21 @@ BENCH(posix_spawn, bench) {
creat("tiny64", 0755);
write(3, kTinyLinuxExit, 128);
close(3);
testlib_extract("/zip/life.com", "life.com", 0755);
testlib_extract("/zip/life", "life", 0755);
testlib_extract("/zip/life.elf", "life.elf", 0755);
testlib_extract("/zip/life-pe.com", "life-pe.com", 0755);
testlib_extract("/zip/life-pe", "life-pe", 0755);
kprintf("%s %s (MODE=" MODE
" rss=%'zu tiny64=%'zu life.com=%'zu life.elf=%'zu)\n",
" rss=%'zu tiny64=%'zu life=%'zu life.elf=%'zu)\n",
__describe_os(), GetHost(), GetRss(), GetSize("tiny64"),
GetSize("life.com"), GetSize("life.elf"));
ForkExecveWait("./life.com");
EZBENCH2("posix_spawn life.com", donothing, PosixSpawnWait("./life.com"));
EZBENCH2("vfork life.com", donothing, VforkExecveWait("./life.com"));
EZBENCH2("fork life.com", donothing, ForkExecveWait("./life.com"));
GetSize("life"), GetSize("life.elf"));
ForkExecveWait("./life");
EZBENCH2("posix_spawn life", donothing, PosixSpawnWait("./life"));
EZBENCH2("vfork life", donothing, VforkExecveWait("./life"));
EZBENCH2("fork life", donothing, ForkExecveWait("./life"));
if (IsWindows()) {
EZBENCH2("posix_spawn life-pe.com", donothing,
PosixSpawnWait("./life-pe.com"));
EZBENCH2("vfork life-pe.com", donothing, VforkExecveWait("./life-pe.com"));
EZBENCH2("fork life-pe.com", donothing, ForkExecveWait("./life-pe.com"));
EZBENCH2("posix_spawn life-pe", donothing, PosixSpawnWait("./life-pe"));
EZBENCH2("vfork life-pe", donothing, VforkExecveWait("./life-pe"));
EZBENCH2("fork life-pe", donothing, ForkExecveWait("./life-pe"));
}
if (IsXnu() || IsWindows() || IsMetal()) return;
EZBENCH2("posix_spawn life.elf", donothing, PosixSpawnWait("./life.elf"));

View file

@ -21,7 +21,6 @@
#include "libc/dce.h"
#include "libc/intrin/kprintf.h"
#include "libc/mem/gc.h"
#include "libc/mem/gc.h"
#include "libc/paths.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
@ -81,14 +80,14 @@ TEST(system, exit) {
}
TEST(system, testStdoutRedirect) {
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, system("./echo.com hello >hello.txt"));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, system("./echo hello >hello.txt"));
EXPECT_STREQ("hello\n", gc(xslurp("hello.txt", 0)));
}
TEST(system, testStdoutRedirect_withSpacesInFilename) {
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, system("./echo.com hello >\"hello there.txt\""));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, system("./echo hello >\"hello there.txt\""));
EXPECT_STREQ("hello\n", gc(xslurp("hello there.txt", 0)));
}
@ -109,10 +108,10 @@ TEST(system, testStderrRedirect_toStdout) {
buf[1] = 0;
buf[2] = 0;
buf[3] = 0;
testlib_extract("/zip/echo.com", "echo.com", 0755);
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_NE(-1, dup2(1, 2));
success = false;
if (GETEXITSTATUS(system("./echo.com aaa 2>&1")) == 0) {
if (GETEXITSTATUS(system("./echo aaa 2>&1")) == 0) {
success = read(pipefd[0], buf, 4) == (4);
}
ASSERT_NE(-1, dup2(stderrBack, 2));
@ -176,17 +175,17 @@ TEST(system, kill) {
}
TEST(system, exitStatusPreservedAfterSemiColon) {
testlib_extract("/zip/false.com", "false.com", 0755);
testlib_extract("/zip/false", "false", 0755);
ASSERT_EQ(1, GETEXITSTATUS(system("false;")));
ASSERT_EQ(1, GETEXITSTATUS(system("false; ")));
ASSERT_EQ(1, GETEXITSTATUS(system("./false.com;")));
ASSERT_EQ(1, GETEXITSTATUS(system("./false.com;")));
ASSERT_EQ(1, GETEXITSTATUS(system("./false;")));
ASSERT_EQ(1, GETEXITSTATUS(system("./false;")));
CaptureStdout();
ASSERT_EQ(0, GETEXITSTATUS(system("false; echo $?")));
char buf[9] = {0};
ASSERT_EQ(2, read(pipefd[0], buf, 8));
ASSERT_STREQ("1\n", buf);
ASSERT_EQ(0, GETEXITSTATUS(system("./false.com; echo $?")));
ASSERT_EQ(0, GETEXITSTATUS(system("./false; echo $?")));
ASSERT_EQ(2, read(pipefd[0], buf, 8));
ASSERT_STREQ("1\n", buf);
ASSERT_EQ(0, GETEXITSTATUS(system("echo -n hi")));
@ -222,17 +221,17 @@ TEST(system, allowsLoneCloseCurlyBrace) {
ASSERT_EQ(5, read(pipefd[0], buf, 5));
ASSERT_STREQ("aaa}\n", buf);
bzero(buf, 6);
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com \"aaa\"}")));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo \"aaa\"}")));
ASSERT_EQ(5, read(pipefd[0], buf, 5));
ASSERT_STREQ("aaa}\n", buf);
RestoreStdout();
}
TEST(system, glob) {
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, system("./ec*.com aaa"));
ASSERT_EQ(0, system("./ec?o.com aaa"));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, system("./ec* aaa"));
ASSERT_EQ(0, system("./ec?o aaa"));
}
TEST(system, env) {
@ -253,8 +252,8 @@ TEST(system, env) {
TEST(system, pipelineCanOutputToFile) {
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | tr a-z A-Z >res")));
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | tr a-z A-Z >res")));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | tr a-z A-Z >res")));
ASSERT_STREQ("HELLO\n", gc(xslurp("res", 0)));
}
@ -267,11 +266,11 @@ TEST(system, pipelineCanOutputBackToSelf) {
ASSERT_EQ(0, GETEXITSTATUS(system("echo hello | exec tr a-z A-Z")));
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
ASSERT_STREQ("HELLO\n", buf);
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | tr a-z A-Z")));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | tr a-z A-Z")));
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
ASSERT_STREQ("HELLO\n", buf);
ASSERT_EQ(0, GETEXITSTATUS(system("./echo.com hello | exec tr a-z A-Z")));
ASSERT_EQ(0, GETEXITSTATUS(system("./echo hello | exec tr a-z A-Z")));
ASSERT_SYS(0, 6, read(pipefd[0], buf, 16));
ASSERT_STREQ("HELLO\n", buf);
RestoreStdout();
@ -280,10 +279,10 @@ TEST(system, pipelineCanOutputBackToSelf) {
int system2(const char *);
BENCH(system, bench) {
testlib_extract("/zip/echo.com", "echo.com", 0755);
EZBENCH2("system cmd", donothing, system("./echo.com hi >/dev/null"));
testlib_extract("/zip/echo", "echo", 0755);
EZBENCH2("system cmd", donothing, system("./echo hi >/dev/null"));
EZBENCH2("systemvpe cmd", donothing,
systemvpe("./echo.com", (char *[]){"./echo.com", "hi", 0}, 0));
systemvpe("./echo", (char *[]){"./echo", "hi", 0}, 0));
EZBENCH2("cocmd echo", donothing, system("echo hi >/dev/null"));
EZBENCH2("cocmd exit", donothing, system("exit"));
}

View file

@ -14,9 +14,9 @@ o/$(MODE)/test/libc/release/cosmopolitan.zip: \
o/$(MODE)/ape/ape-copy-self.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/zip/zip.com
o/$(MODE)/third_party/zip/zip
@$(COMPILE) -AZIP -T$@ \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/third_party/zip/zip \
-b$(TMPDIR) -qj $@ \
o/cosmopolitan.h \
o/$(MODE)/ape/ape.lds \
@ -46,7 +46,7 @@ o/$(MODE)/test/libc/release/smoke.o: \
-Wl,-z,noexecstack \
$<
o/$(MODE)/test/libc/release/smoke.com.dbg: \
o/$(MODE)/test/libc/release/smoke.dbg: \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
@ -67,7 +67,7 @@ o/$(MODE)/test/libc/release/smoke.com.dbg: \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smoke-nms.com.dbg: \
o/$(MODE)/test/libc/release/smoke-nms.dbg: \
o/$(MODE)/test/libc/release/smoke.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
@ -88,13 +88,13 @@ o/$(MODE)/test/libc/release/smoke-nms.com.dbg: \
o/$(MODE)/cosmopolitan.a \
-o $@
o/$(MODE)/test/libc/release/smoke-chibicc.com.dbg: \
o/$(MODE)/test/libc/release/smoke-chibicc.dbg: \
o/$(MODE)/test/libc/release/smoke-chibicc.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/chibicc/chibicc.com
o/$(MODE)/third_party/chibicc/chibicc
@$(COMPILE) -ALD $(LD) \
-static \
-no-pie \
@ -113,9 +113,9 @@ o/$(MODE)/test/libc/release/smoke-chibicc.com.dbg: \
o/$(MODE)/test/libc/release/smoke-chibicc.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h \
o/$(MODE)/third_party/chibicc/chibicc.com
o/$(MODE)/third_party/chibicc/chibicc
@$(COMPILE) -wACHIBICC \
o/$(MODE)/third_party/chibicc/chibicc.com \
o/$(MODE)/third_party/chibicc/chibicc \
$(CHIBICC_FLAGS) \
-o $@ \
-c \
@ -131,7 +131,7 @@ o/$(MODE)/test/libc/release/smoke-chibicc.o: \
-include o/cosmopolitan.h \
$<
o/$(MODE)/test/libc/release/smokecxx.com.dbg: \
o/$(MODE)/test/libc/release/smokecxx.dbg: \
o/$(MODE)/test/libc/release/smokecxx.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
@ -171,7 +171,7 @@ o/$(MODE)/test/libc/release/smokecxx.o: \
-include o/cosmopolitan.h \
test/libc/release/smokecxx.cc
o/$(MODE)/test/libc/release/smokeansi.com.dbg: \
o/$(MODE)/test/libc/release/smokeansi.dbg: \
o/$(MODE)/test/libc/release/smokeansi.o \
o/$(MODE)/ape/ape.lds \
o/$(MODE)/libc/crt/crt.o \
@ -216,27 +216,27 @@ o/$(MODE)/test/libc/release/smokeansi.o: \
# TODO(jart): Rewrite these shell scripts as C code.
# o/$(MODE)/test/libc/release/metal.ok: \
# test/libc/release/metal.sh \
# o/$(MODE)/examples/hello.com \
# o/$(MODE)/tool/build/blinkenlights.com.dbg
# o/$(MODE)/examples/hello \
# o/$(MODE)/tool/build/blinkenlights.dbg
# @$(COMPILE) -ASHTEST -tT$@ $<
# o/$(MODE)/test/libc/release/emulate.ok: \
# test/libc/release/emulate.sh \
# o/$(MODE)/examples/hello.com \
# o/$(MODE)/tool/build/blinkenlights.com.dbg
# o/$(MODE)/examples/hello \
# o/$(MODE)/tool/build/blinkenlights.dbg
# @$(COMPILE) -ASHTEST -tT$@ $<
.PHONY: o/$(MODE)/test/libc/release
o/$(MODE)/test/libc/release: \
o/$(MODE)/test/libc/release/smoke.com \
o/$(MODE)/test/libc/release/smoke.com.runs \
o/$(MODE)/test/libc/release/smoke-nms.com \
o/$(MODE)/test/libc/release/smoke-nms.com.runs \
o/$(MODE)/test/libc/release/smoke-chibicc.com \
o/$(MODE)/test/libc/release/smoke-chibicc.com.runs \
o/$(MODE)/test/libc/release/smokecxx.com \
o/$(MODE)/test/libc/release/smokecxx.com.runs \
o/$(MODE)/test/libc/release/smokeansi.com \
o/$(MODE)/test/libc/release/smokeansi.com.runs
o/$(MODE)/test/libc/release/smoke \
o/$(MODE)/test/libc/release/smoke.runs \
o/$(MODE)/test/libc/release/smoke-nms \
o/$(MODE)/test/libc/release/smoke-nms.runs \
o/$(MODE)/test/libc/release/smoke-chibicc \
o/$(MODE)/test/libc/release/smoke-chibicc.runs \
o/$(MODE)/test/libc/release/smokecxx \
o/$(MODE)/test/libc/release/smokecxx.runs \
o/$(MODE)/test/libc/release/smokeansi \
o/$(MODE)/test/libc/release/smokeansi.runs
endif
endif

View file

@ -9,7 +9,7 @@ if [ "$MODE" = opt ] || [ "$MODE" = optlinux ]; then
fi
# smoke test userspace binary emulation
CMD="o/$MODE/tool/build/blinkenlights.com.dbg o/$MODE/examples/hello.com"
CMD="o/$MODE/tool/build/blinkenlights.dbg o/$MODE/examples/hello"
if OUTPUT="$($CMD)"; then
if [ x"$OUTPUT" = x"hello world" ]; then
exit 0

View file

@ -13,7 +13,7 @@ fi
$MKDIR o/$MODE/test/libc/release/
# smoke test booting on bare metal and printing data to serial uart
CMD="o/$MODE/tool/build/blinkenlights.com.dbg -r o/$MODE/examples/hello.com"
CMD="o/$MODE/tool/build/blinkenlights.dbg -r o/$MODE/examples/hello"
if OUTPUT="$($CMD)"; then
if [ x"$OUTPUT" = x"hello world" ]; then
exit 0

View file

@ -10,17 +10,17 @@ TEST_LIBC_RUNTIME_OBJS = \
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_RUNTIME_COMS = \
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_RUNTIME_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_RUNTIME_BINS = \
$(TEST_LIBC_RUNTIME_COMS) \
$(TEST_LIBC_RUNTIME_COMS:%=%.dbg)
TEST_LIBC_RUNTIME_TESTS = \
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_RUNTIME_CHECKS = \
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_RUNTIME_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_RUNTIME_DIRECTDEPS = \
LIBC_CALLS \
@ -49,7 +49,7 @@ o/$(MODE)/test/libc/runtime/runtime.pkg: \
$(TEST_LIBC_RUNTIME_OBJS) \
$(foreach x,$(TEST_LIBC_RUNTIME_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/runtime/%.com.dbg: \
o/$(MODE)/test/libc/runtime/%.dbg: \
$(TEST_LIBC_RUNTIME_DEPS) \
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o \
o/$(MODE)/test/libc/runtime/prog/ftraceasm.txt.zip.o \
@ -61,7 +61,7 @@ o/$(MODE)/test/libc/runtime/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/runtime/ape_test.com.dbg: \
o/$(MODE)/test/libc/runtime/ape_test.dbg: \
$(TEST_LIBC_RUNTIME_DEPS) \
o/$(MODE)/test/libc/runtime/ape_test.o \
o/$(MODE)/test/libc/runtime/runtime.pkg \
@ -74,8 +74,8 @@ $(TEST_LIBC_RUNTIME_OBJS): private \
DEFAULT_CCFLAGS += \
-fno-builtin
o/$(MODE)/test/libc/runtime/getenv_test.com.runs: \
o/$(MODE)/test/libc/runtime/getenv_test.com
o/$(MODE)/test/libc/runtime/getenv_test.runs: \
o/$(MODE)/test/libc/runtime/getenv_test
@HELLO=THERE build/runit $@ $<
o/$(MODE)/test/libc/runtime/itsatrap_test.o: private \

View file

@ -95,9 +95,9 @@ TEST(GetDosArgv, realWorldUsage) {
size_t size = ARG_MAX / 2;
char *buf = malloc(size * sizeof(char));
char **argv = malloc(max * sizeof(char *));
EXPECT_EQ(5, GetDosArgv(u"C:\\Users\\jtunn\\printargs.com oh yes yes yes",
buf, size, argv, max));
EXPECT_STREQ("C:\\Users\\jtunn\\printargs.com", argv[0]);
EXPECT_EQ(5, GetDosArgv(u"C:\\Users\\jtunn\\printargs oh yes yes yes", buf,
size, argv, max));
EXPECT_STREQ("C:\\Users\\jtunn\\printargs", argv[0]);
EXPECT_STREQ("oh", argv[1]);
EXPECT_STREQ("yes", argv[2]);
EXPECT_STREQ("yes", argv[3]);

View file

@ -6,85 +6,85 @@ PKGS += TEST_LIBC_SOCK
TEST_LIBC_SOCK_SRCS := $(wildcard test/libc/sock/*.c)
TEST_LIBC_SOCK_SRCS_TEST = $(filter %_test.c,$(TEST_LIBC_SOCK_SRCS))
TEST_LIBC_SOCK_OBJS = \
TEST_LIBC_SOCK_OBJS = \
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_SOCK_COMS = \
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%.com)
TEST_LIBC_SOCK_COMS = \
$(TEST_LIBC_SOCK_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_SOCK_BINS = \
$(TEST_LIBC_SOCK_COMS) \
TEST_LIBC_SOCK_BINS = \
$(TEST_LIBC_SOCK_COMS) \
$(TEST_LIBC_SOCK_COMS:%=%.dbg)
TEST_LIBC_SOCK_TESTS = \
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_LIBC_SOCK_TESTS = \
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_SOCK_CHECKS = \
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
TEST_LIBC_SOCK_CHECKS = \
$(TEST_LIBC_SOCK_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_SOCK_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_PROC \
LIBC_RUNTIME \
LIBC_SOCK \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_THREAD \
LIBC_LOG \
LIBC_SYSV_CALLS \
LIBC_TESTLIB \
LIBC_X \
TEST_LIBC_SOCK_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_PROC \
LIBC_RUNTIME \
LIBC_SOCK \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_THREAD \
LIBC_LOG \
LIBC_SYSV_CALLS \
LIBC_TESTLIB \
LIBC_X \
TOOL_DECODE_LIB
TEST_LIBC_SOCK_DEPS := \
TEST_LIBC_SOCK_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x))))
o/$(MODE)/test/libc/sock/sock.pkg: \
$(TEST_LIBC_SOCK_OBJS) \
o/$(MODE)/test/libc/sock/sock.pkg: \
$(TEST_LIBC_SOCK_OBJS) \
$(foreach x,$(TEST_LIBC_SOCK_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/sock/%.com.dbg: \
$(TEST_LIBC_SOCK_DEPS) \
o/$(MODE)/test/libc/sock/%.o \
o/$(MODE)/test/libc/sock/sock.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
o/$(MODE)/test/libc/sock/%.dbg: \
$(TEST_LIBC_SOCK_DEPS) \
o/$(MODE)/test/libc/sock/%.o \
o/$(MODE)/test/libc/sock/sock.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/sock/unix_test.com.runs: \
o/$(MODE)/test/libc/sock/unix_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc unix
o/$(MODE)/test/libc/sock/connect_test.com.runs \
o/$(MODE)/test/libc/sock/recvfrom_test.com.runs \
o/$(MODE)/test/libc/sock/nonblock_test.com.runs \
o/$(MODE)/test/libc/sock/socket_test.com.runs \
o/$(MODE)/test/libc/sock/shutdown_test.com.runs \
o/$(MODE)/test/libc/sock/setsockopt_test.com.runs \
o/$(MODE)/test/libc/sock/sendfile_test.com.runs \
o/$(MODE)/test/libc/sock/poll_test.com.runs \
o/$(MODE)/test/libc/sock/pollfd_test.com.runs: \
o/$(MODE)/test/libc/sock/connect_test.runs \
o/$(MODE)/test/libc/sock/recvfrom_test.runs \
o/$(MODE)/test/libc/sock/nonblock_test.runs \
o/$(MODE)/test/libc/sock/socket_test.runs \
o/$(MODE)/test/libc/sock/shutdown_test.runs \
o/$(MODE)/test/libc/sock/setsockopt_test.runs \
o/$(MODE)/test/libc/sock/sendfile_test.runs \
o/$(MODE)/test/libc/sock/poll_test.runs \
o/$(MODE)/test/libc/sock/pollfd_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
o/$(MODE)/test/libc/sock/sendrecvmsg_test.com.runs: \
o/$(MODE)/test/libc/sock/sendrecvmsg_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
o/$(MODE)/test/libc/sock/socket_test.com.runs: \
o/$(MODE)/test/libc/sock/socket_test.runs: \
private .INTERNET = 1 # todo: ipv6 filtering
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
o/$(MODE)/test/libc/sock/recvmsg_test.runs: \
private .INTERNET = 1 # need to bind to 0.0.0.0
o/$(MODE)/test/libc/sock/recvmsg_test.com.runs: \
o/$(MODE)/test/libc/sock/recvmsg_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet recvfd sendfd
$(TEST_LIBC_SOCK_OBJS): test/libc/sock/BUILD.mk
.PHONY: o/$(MODE)/test/libc/sock
o/$(MODE)/test/libc/sock: \
$(TEST_LIBC_SOCK_BINS) \
o/$(MODE)/test/libc/sock: \
$(TEST_LIBC_SOCK_BINS) \
$(TEST_LIBC_SOCK_CHECKS)

View file

@ -12,17 +12,17 @@ TEST_LIBC_STDIO_OBJS = \
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_STDIO_COMS = \
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_STDIO_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_STDIO_BINS = \
$(TEST_LIBC_STDIO_COMS) \
$(TEST_LIBC_STDIO_COMS:%=%.dbg)
TEST_LIBC_STDIO_TESTS = \
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_STDIO_CHECKS = \
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_STDIO_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_STDIO_DIRECTDEPS = \
LIBC_CALLS \
@ -55,21 +55,21 @@ o/$(MODE)/test/libc/stdio/stdio.pkg: \
$(TEST_LIBC_STDIO_OBJS) \
$(foreach x,$(TEST_LIBC_STDIO_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/stdio/%.com.dbg: \
o/$(MODE)/test/libc/stdio/%.dbg: \
$(TEST_LIBC_STDIO_DEPS) \
o/$(MODE)/test/libc/stdio/%.o \
o/$(MODE)/test/libc/stdio/stdio.pkg \
o/$(MODE)/tool/build/echo.com.zip.o \
o/$(MODE)/tool/build/echo.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/stdio/popen_test.com.dbg: \
o/$(MODE)/test/libc/stdio/popen_test.dbg: \
$(TEST_LIBC_STDIO_DEPS) \
o/$(MODE)/test/libc/stdio/popen_test.o \
o/$(MODE)/test/libc/stdio/stdio.pkg \
o/$(MODE)/tool/build/echo.com.zip.o \
o/$(MODE)/tool/build/echo.zip.o \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)

View file

@ -27,7 +27,6 @@
#include "libc/limits.h"
#include "libc/mem/critbit0.h"
#include "libc/mem/gc.h"
#include "libc/mem/gc.h"
#include "libc/mem/mem.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/append.h"
@ -424,7 +423,7 @@ static int walk(const char *fpath, //
TEST(dirstream, walk) {
ASSERT_SYS(0, 0, nftw("/zip", walk, 128, FTW_PHYS | FTW_DEPTH));
ASSERT_STREQ("FTW_F /zip/echo.com\n"
ASSERT_STREQ("FTW_F /zip/echo\n"
"FTW_F /zip/libc/testlib/hyperion.txt\n"
"FTW_F /zip/libc/testlib/moby.txt\n"
"FTW_DP /zip/libc/testlib\n"

View file

@ -62,8 +62,8 @@ void CheckForFdLeaks(void) {
TEST(popen, command) {
char foo[6];
testlib_extract("/zip/echo.com", "echo.com", 0755);
ASSERT_NE(NULL, (f = popen("./echo.com hello", "r")));
testlib_extract("/zip/echo", "echo", 0755);
ASSERT_NE(NULL, (f = popen("./echo hello", "r")));
ASSERT_NE(NULL, fgets(foo, sizeof(foo), f));
ASSERT_STREQ("hello", foo);
ASSERT_EQ(0, pclose(f));
@ -142,7 +142,7 @@ void *Worker(void *arg) {
arg2 = malloc(13);
FormatInt32(arg1, _rand64());
FormatInt32(arg2, _rand64());
sprintf(cmd, "echo %s; ./echo.com %s", arg1, arg2);
sprintf(cmd, "echo %s; ./echo %s", arg1, arg2);
strcat(arg1, "\n");
strcat(arg2, "\n");
ASSERT_NE(NULL, (f = popen(cmd, "r")));
@ -163,7 +163,7 @@ TEST(popen, torture) {
}
int i, n = 4;
pthread_t *t = gc(malloc(sizeof(pthread_t) * n));
testlib_extract("/zip/echo.com", "echo.com", 0755);
testlib_extract("/zip/echo", "echo", 0755);
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_create(t + i, 0, Worker, 0));
for (i = 0; i < n; ++i) ASSERT_EQ(0, pthread_join(t[i], 0));
CheckForFdLeaks();

View file

@ -101,7 +101,7 @@ TEST(zipdir, testListZip) {
ASSERT_STREQ("..", ent->d_name);
ASSERT_EQ(DT_DIR, ent->d_type);
ASSERT_NE(NULL, (ent = readdir(dir)));
ASSERT_STREQ("echo.com", ent->d_name);
ASSERT_STREQ("echo", ent->d_name);
ASSERT_EQ(DT_REG, ent->d_type);
ASSERT_NE(NULL, (ent = readdir(dir)));
ASSERT_STREQ("libc", ent->d_name);

View file

@ -10,78 +10,78 @@ TEST_LIBC_STR_SRCS = $(TEST_LIBC_STR_SRCS_C) $(TEST_LIBC_STR_SRCS_CC)
TEST_LIBC_STR_SRCS_TEST_C = $(filter %_test.c,$(TEST_LIBC_STR_FILES))
TEST_LIBC_STR_SRCS_TEST_CC = $(filter %_test.cc,$(TEST_LIBC_STR_FILES))
TEST_LIBC_STR_OBJS = \
$(TEST_LIBC_STR_SRCS_C:%.c=o/$(MODE)/%.o) \
TEST_LIBC_STR_OBJS = \
$(TEST_LIBC_STR_SRCS_C:%.c=o/$(MODE)/%.o) \
$(TEST_LIBC_STR_SRCS_CC:%.cc=o/$(MODE)/%.o)
TEST_LIBC_STR_COMS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com)
TEST_LIBC_STR_COMS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%)
TEST_LIBC_STR_BINS = \
$(TEST_LIBC_STR_COMS) \
TEST_LIBC_STR_BINS = \
$(TEST_LIBC_STR_COMS) \
$(TEST_LIBC_STR_COMS:%=%.dbg)
TEST_LIBC_STR_TESTS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com.ok) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com.ok)
TEST_LIBC_STR_TESTS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.ok) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.ok)
TEST_LIBC_STR_CHECKS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.com.runs) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.com.runs)
TEST_LIBC_STR_CHECKS = \
$(TEST_LIBC_STR_SRCS_TEST_C:%.c=o/$(MODE)/%.runs) \
$(TEST_LIBC_STR_SRCS_TEST_CC:%.cc=o/$(MODE)/%.runs)
TEST_LIBC_STR_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_LOG \
LIBC_TINYMATH \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_SYSV_CALLS \
LIBC_TESTLIB \
LIBC_X \
THIRD_PARTY_COMPILER_RT \
THIRD_PARTY_MBEDTLS \
THIRD_PARTY_REGEX \
THIRD_PARTY_ZLIB \
THIRD_PARTY_LIBCXX \
THIRD_PARTY_SMALLZ4 \
TEST_LIBC_STR_DIRECTDEPS = \
LIBC_CALLS \
LIBC_FMT \
LIBC_INTRIN \
LIBC_LOG \
LIBC_TINYMATH \
LIBC_MEM \
LIBC_NEXGEN32E \
LIBC_RUNTIME \
LIBC_STDIO \
LIBC_STR \
LIBC_SYSV \
LIBC_SYSV_CALLS \
LIBC_TESTLIB \
LIBC_X \
THIRD_PARTY_COMPILER_RT \
THIRD_PARTY_MBEDTLS \
THIRD_PARTY_REGEX \
THIRD_PARTY_ZLIB \
THIRD_PARTY_LIBCXX \
THIRD_PARTY_SMALLZ4 \
THIRD_PARTY_VQSORT
TEST_LIBC_STR_DEPS := \
TEST_LIBC_STR_DEPS := \
$(call uniq,$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x))))
o/$(MODE)/test/libc/str/str.pkg: \
$(TEST_LIBC_STR_OBJS) \
o/$(MODE)/test/libc/str/str.pkg: \
$(TEST_LIBC_STR_OBJS) \
$(foreach x,$(TEST_LIBC_STR_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/str/tpenc_test.o: private \
CFLAGS += \
o/$(MODE)/test/libc/str/tpenc_test.o: private \
CFLAGS += \
$(TRADITIONAL)
o/$(MODE)/test/libc/str/%.com.dbg: \
$(TEST_LIBC_STR_DEPS) \
o/$(MODE)/test/libc/str/%.o \
o/$(MODE)/test/libc/str/str.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
o/$(MODE)/test/libc/str/%.dbg: \
$(TEST_LIBC_STR_DEPS) \
o/$(MODE)/test/libc/str/%.o \
o/$(MODE)/test/libc/str/str.pkg \
$(LIBC_TESTMAIN) \
$(CRT) \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
$(TEST_LIBC_STR_OBJS): private \
DEFAULT_CCFLAGS += \
$(TEST_LIBC_STR_OBJS): private \
DEFAULT_CCFLAGS += \
-fno-builtin
o/$(MODE)/test/libc/str/memmove_test.o: private \
CFLAGS += \
o/$(MODE)/test/libc/str/memmove_test.o: private \
CFLAGS += \
-O2 -D_FORTIFY_SOURCE=2
.PHONY: o/$(MODE)/test/libc/str
o/$(MODE)/test/libc/str: \
$(TEST_LIBC_STR_BINS) \
o/$(MODE)/test/libc/str: \
$(TEST_LIBC_STR_BINS) \
$(TEST_LIBC_STR_CHECKS)

View file

@ -38,7 +38,7 @@ TEST(regex, testDns) {
regex_t rx;
EXPECT_EQ(REG_OK, regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED));
EXPECT_EQ(REG_OK, regexec(&rx, "", 0, NULL, 0));
EXPECT_EQ(REG_OK, regexec(&rx, "foo.com", 0, NULL, 0));
EXPECT_EQ(REG_OK, regexec(&rx, "foo", 0, NULL, 0));
EXPECT_EQ(REG_NOMATCH, regexec(&rx, "bar@example", 0, NULL, 0));
regfree(&rx);
}
@ -96,16 +96,16 @@ TEST(regex, testUnicodeCharacterClass) {
void A(void) {
regex_t rx;
regcomp(&rx, "^[-._0-9A-Za-z]*$", REG_EXTENDED);
regexec(&rx, "foo.com", 0, NULL, 0);
regexec(&rx, "foo", 0, NULL, 0);
regfree(&rx);
}
void B(regex_t *rx) {
regexec(rx, "foo.com", 0, NULL, 0);
regexec(rx, "foo", 0, NULL, 0);
}
void C(void) {
regex_t rx;
regcomp(&rx, "^[-._0-9A-Za-z]*$", 0);
regexec(&rx, "foo.com", 0, NULL, 0);
regexec(&rx, "foo", 0, NULL, 0);
regfree(&rx);
}
void D(regex_t *rx, regmatch_t *m) {

View file

@ -16,17 +16,17 @@ TEST_LIBC_THREAD_OBJS = \
$(TEST_LIBC_THREAD_SRCS_CC:%.cc=o/$(MODE)/%.o)
TEST_LIBC_THREAD_COMS = \
$(TEST_LIBC_THREAD_OBJS:%.o=%.com)
$(TEST_LIBC_THREAD_OBJS:%.o=%)
TEST_LIBC_THREAD_BINS = \
$(TEST_LIBC_THREAD_COMS) \
$(TEST_LIBC_THREAD_COMS:%=%.dbg)
TEST_LIBC_THREAD_TESTS = \
$(TEST_LIBC_THREAD_OBJS:%.o=%.com.ok)
$(TEST_LIBC_THREAD_OBJS:%.o=%.ok)
TEST_LIBC_THREAD_CHECKS = \
$(TEST_LIBC_THREAD_OBJS:%.o=%.com.runs)
$(TEST_LIBC_THREAD_OBJS:%.o=%.runs)
TEST_LIBC_THREAD_DIRECTDEPS = \
LIBC_CALLS \
@ -58,7 +58,7 @@ o/$(MODE)/test/libc/thread/thread.pkg: \
$(TEST_LIBC_THREAD_OBJS) \
$(foreach x,$(TEST_LIBC_THREAD_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/thread/%.com.dbg: \
o/$(MODE)/test/libc/thread/%.dbg: \
$(TEST_LIBC_THREAD_DEPS) \
o/$(MODE)/test/libc/thread/%.o \
o/$(MODE)/test/libc/thread/thread.pkg \
@ -67,7 +67,7 @@ o/$(MODE)/test/libc/thread/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/libc/thread/pthread_kill_test.com.runs: \
o/$(MODE)/test/libc/thread/pthread_kill_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
.PHONY: o/$(MODE)/test/libc/thread

View file

@ -11,11 +11,11 @@ TEST_LIBC_TIME_OBJS = \
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_TIME_COMS = \
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_TIME_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_TIME_TESTS = $(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_LIBC_TIME_TESTS = $(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_TIME_CHECKS = \
$(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_TIME_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_TIME_DIRECTDEPS = \
LIBC_CALLS \
@ -36,7 +36,7 @@ o/$(MODE)/test/libc/time/time.pkg: \
$(TEST_LIBC_TIME_OBJS) \
$(foreach x,$(TEST_LIBC_TIME_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/time/%.com.dbg: \
o/$(MODE)/test/libc/time/%.dbg: \
$(TEST_LIBC_TIME_DEPS) \
o/$(MODE)/test/libc/time/%.o \
o/$(MODE)/test/libc/time/time.pkg \

View file

@ -10,17 +10,17 @@ TEST_LIBC_TINYMATH_OBJS = \
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_TINYMATH_COMS = \
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_TINYMATH_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_TINYMATH_BINS = \
$(TEST_LIBC_TINYMATH_COMS) \
$(TEST_LIBC_TINYMATH_COMS:%=%.dbg)
TEST_LIBC_TINYMATH_TESTS = \
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_TINYMATH_CHECKS = \
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_TINYMATH_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_TINYMATH_DIRECTDEPS = \
LIBC_CALLS \
@ -47,7 +47,7 @@ o/$(MODE)/test/libc/tinymath/tinymath.pkg: \
$(TEST_LIBC_TINYMATH_OBJS) \
$(foreach x,$(TEST_LIBC_TINYMATH_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/tinymath/%.com.dbg: \
o/$(MODE)/test/libc/tinymath/%.dbg: \
$(TEST_LIBC_TINYMATH_DEPS) \
o/$(MODE)/test/libc/tinymath/%.o \
o/$(MODE)/test/libc/tinymath/tinymath.pkg \

View file

@ -10,17 +10,17 @@ TEST_LIBC_X_OBJS = \
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_X_COMS = \
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_X_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_X_BINS = \
$(TEST_LIBC_X_COMS) \
$(TEST_LIBC_X_COMS:%=%.dbg)
TEST_LIBC_X_TESTS = \
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_LIBC_X_CHECKS = \
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_X_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_LIBC_X_DIRECTDEPS = \
LIBC_CALLS \
@ -45,7 +45,7 @@ o/$(MODE)/test/libc/x/x.pkg: \
$(TEST_LIBC_X_OBJS) \
$(foreach x,$(TEST_LIBC_X_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/x/%.com.dbg: \
o/$(MODE)/test/libc/x/%.dbg: \
$(TEST_LIBC_X_DEPS) \
o/$(MODE)/test/libc/x/%.o \
o/$(MODE)/test/libc/x/x.pkg \

View file

@ -56,17 +56,17 @@ TEST_LIBC_XED_OBJS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.o)
TEST_LIBC_XED_COMS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%)
TEST_LIBC_XED_BINS = \
$(TEST_LIBC_XED_COMS) \
$(TEST_LIBC_XED_COMS:%=%.dbg)
TEST_LIBC_XED_TESTS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.ok)
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.ok)
TEST_LIBC_XED_CHECKS = \
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.com.runs)
$(TEST_LIBC_XED_SRCS:%.c=o/$(MODE)/%.runs)
TEST_LIBC_XED_DIRECTDEPS = \
LIBC_INTRIN \
@ -85,7 +85,7 @@ o/$(MODE)/test/libc/xed/xed.pkg: \
$(TEST_LIBC_XED_OBJS) \
$(foreach x,$(TEST_LIBC_XED_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libc/xed/%.com.dbg: \
o/$(MODE)/test/libc/xed/%.dbg: \
$(TEST_LIBC_XED_DEPS) \
o/$(MODE)/test/libc/xed/%.o \
o/$(MODE)/test/libc/xed/xed.pkg \

View file

@ -6,7 +6,7 @@ PKGS += TEST_LIBCXX
TEST_LIBCXX_FILES := $(wildcard test/libcxx/*)
TEST_LIBCXX_SRCS = $(filter %.cc,$(TEST_LIBCXX_FILES))
TEST_LIBCXX_OBJS = $(TEST_LIBCXX_SRCS:%.cc=o/$(MODE)/%.o)
TEST_LIBCXX_COMS = $(TEST_LIBCXX_OBJS:%.o=%.com)
TEST_LIBCXX_COMS = $(TEST_LIBCXX_OBJS:%.o=%)
TEST_LIBCXX_BINS = $(TEST_LIBCXX_COMS) $(TEST_LIBCXX_COMS:%=%.dbg)
TEST_LIBCXX_CHECKS = $(TEST_LIBCXX_COMS:%=%.runs)
TEST_LIBCXX_TESTS = $(TEST_LIBCXX_COMS:%=%.ok)
@ -31,7 +31,7 @@ o/$(MODE)/test/libcxx/libcxx.pkg: \
$(TEST_LIBCXX_OBJS) \
$(foreach x,$(TEST_LIBCXX_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/libcxx/%.com.dbg: \
o/$(MODE)/test/libcxx/%.dbg: \
$(TEST_LIBCXX_DEPS) \
o/$(MODE)/test/libcxx/%.o \
o/$(MODE)/test/libcxx/libcxx.pkg \
@ -42,7 +42,7 @@ o/$(MODE)/test/libcxx/%.com.dbg: \
$(TEST_LIBCXX_OBJS): private CCFLAGS += -fexceptions -frtti
o/$(MODE)/test/libcxx/openmp_test.o: private CXXFLAGS += -fopenmp
o/$(MODE)/test/libcxx/openmp_test.com.runs: private QUOTA += -C100
o/$(MODE)/test/libcxx/openmp_test.runs: private QUOTA += -C100
.PHONY: o/$(MODE)/test/libcxx
o/$(MODE)/test/libcxx: \

View file

@ -6,10 +6,10 @@ PKGS += TEST_MATH
TEST_MATH_SRCS := $(wildcard test/math/*.c)
TEST_MATH_SRCS_TEST = $(filter %_test.c,$(TEST_MATH_SRCS))
TEST_MATH_OBJS = $(TEST_MATH_SRCS:%.c=o/$(MODE)/%.o)
TEST_MATH_COMS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com)
TEST_MATH_COMS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%)
TEST_MATH_BINS = $(TEST_MATH_COMS) $(TEST_MATH_COMS:%=%.dbg)
TEST_MATH_TESTS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
TEST_MATH_CHECKS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
TEST_MATH_TESTS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_MATH_CHECKS = $(TEST_MATH_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_MATH_DIRECTDEPS = \
LIBC_INTRIN \
@ -25,9 +25,9 @@ o/$(MODE)/test/math/math.pkg: \
$(TEST_MATH_OBJS) \
$(foreach x,$(TEST_MATH_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/math/%.com.dbg: \
o/$(MODE)/test/math/%.dbg: \
$(TEST_MATH_DEPS) \
o/$(MODE)/test/math/%.o \
o/$(MODE)/test/math/%.o \
o/$(MODE)/test/math/math.pkg \
$(CRT) \
$(APE_NO_MODIFY_SELF)

View file

@ -11,13 +11,13 @@ TEST_NET_FINGER_OBJS = \
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%.o)
TEST_NET_FINGER_COMS = \
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_NET_FINGER_SRCS:%.c=o/$(MODE)/%)
TEST_NET_FINGER_TESTS = \
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_NET_FINGER_CHECKS = \
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_NET_FINGER_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_NET_FINGER_DIRECTDEPS = \
NET_FINGER \
@ -32,7 +32,7 @@ o/$(MODE)/test/net/finger/finger.pkg: \
$(TEST_NET_FINGER_OBJS) \
$(foreach x,$(TEST_NET_FINGER_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/net/finger/%.com.dbg: \
o/$(MODE)/test/net/finger/%.dbg: \
$(TEST_NET_FINGER_DEPS) \
o/$(MODE)/test/net/finger/%.o \
$(LIBC_TESTMAIN) \

View file

@ -13,17 +13,17 @@ TEST_POSIX_OBJS = \
$(TEST_POSIX_SRCS:%.c=o/$(MODE)/%.o)
TEST_POSIX_COMS = \
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com)
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%)
TEST_POSIX_BINS = \
$(TEST_POSIX_COMS) \
$(TEST_POSIX_COMS:%=%.dbg)
TEST_POSIX_TESTS = \
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_POSIX_CHECKS = \
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_POSIX_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_POSIX_DIRECTDEPS = \
LIBC_CALLS \
@ -43,7 +43,7 @@ o/$(MODE)/test/posix/posix.pkg: \
$(TEST_POSIX_OBJS) \
$(foreach x,$(TEST_POSIX_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/posix/%.com.dbg: \
o/$(MODE)/test/posix/%.dbg: \
$(TEST_POSIX_DEPS) \
o/$(MODE)/test/posix/%.o \
o/$(MODE)/test/posix/posix.pkg \

View file

@ -32,7 +32,7 @@
#include <unistd.h>
// clang-format off
// sh -c 'build/bootstrap/make.com -j8 V=1 o//test/posix/sigchld_test.com.runs'
// sh -c 'build/bootstrap/make -j8 V=1 o//test/posix/sigchld_test.runs'
// clang-format on
void Assert(const char *file, int line, bool ok) {

View file

@ -9,24 +9,24 @@ TEST_TOOL_ARGS_FILES := $(wildcard test/tool/args/*)
TEST_TOOL_ARGS_SRCS = $(filter %.c,$(TEST_TOOL_ARGS_FILES))
TEST_TOOL_ARGS_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_ARGS_SRCS))
TEST_TOOL_ARGS_HDRS = $(filter %.h,$(TEST_TOOL_ARGS_FILES))
TEST_TOOL_ARGS_COMS = $(TEST_TOOL_ARGS_OBJS:%.o=%.com)
TEST_TOOL_ARGS_COMS = $(TEST_TOOL_ARGS_OBJS:%.o=%)
TEST_TOOL_ARGS_OBJS = \
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%.o)
TEST_TOOL_ARGS_COMS = \
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_TOOL_ARGS_SRCS:%.c=o/$(MODE)/%)
TEST_TOOL_ARGS_BINS = \
$(TEST_TOOL_ARGS_COMS) \
$(TEST_TOOL_ARGS_COMS:%=%.dbg)
TEST_TOOL_ARGS_TESTS = \
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_TOOL_ARGS_CHECKS = \
$(TEST_TOOL_ARGS_HDRS:%=o/$(MODE)/%.ok) \
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_TOOL_ARGS_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_TOOL_ARGS_DIRECTDEPS = \
LIBC_CALLS \
@ -56,7 +56,7 @@ $(TEST_TOOL_ARGS_A).pkg: \
$(TEST_TOOL_ARGS_OBJS) \
$(foreach x,$(TEST_TOOL_ARGS_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/tool/args/%.com.dbg: \
o/$(MODE)/test/tool/args/%.dbg: \
$(TEST_TOOL_ARGS_DEPS) \
$(TEST_TOOL_ARGS_A) \
o/$(MODE)/test/tool/args/%.o \

View file

@ -9,24 +9,24 @@ TEST_TOOL_BUILD_LIB_FILES := $(wildcard test/tool/build/lib/*)
TEST_TOOL_BUILD_LIB_SRCS = $(filter %.c,$(TEST_TOOL_BUILD_LIB_FILES))
TEST_TOOL_BUILD_LIB_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_BUILD_LIB_SRCS))
TEST_TOOL_BUILD_LIB_HDRS = $(filter %.h,$(TEST_TOOL_BUILD_LIB_FILES))
TEST_TOOL_BUILD_LIB_COMS = $(TEST_TOOL_BUILD_LIB_OBJS:%.o=%.com)
TEST_TOOL_BUILD_LIB_COMS = $(TEST_TOOL_BUILD_LIB_OBJS:%.o=%)
TEST_TOOL_BUILD_LIB_OBJS = \
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%.o)
TEST_TOOL_BUILD_LIB_COMS = \
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_TOOL_BUILD_LIB_SRCS:%.c=o/$(MODE)/%)
TEST_TOOL_BUILD_LIB_BINS = \
$(TEST_TOOL_BUILD_LIB_COMS) \
$(TEST_TOOL_BUILD_LIB_COMS:%=%.dbg)
TEST_TOOL_BUILD_LIB_TESTS = \
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_TOOL_BUILD_LIB_CHECKS = \
$(TEST_TOOL_BUILD_LIB_HDRS:%=o/$(MODE)/%.ok) \
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_TOOL_BUILD_LIB_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_TOOL_BUILD_LIB_DIRECTDEPS = \
LIBC_CALLS \
@ -57,7 +57,7 @@ $(TEST_TOOL_BUILD_LIB_A).pkg: \
$(TEST_TOOL_BUILD_LIB_OBJS) \
$(foreach x,$(TEST_TOOL_BUILD_LIB_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/tool/build/lib/%.com.dbg: \
o/$(MODE)/test/tool/build/lib/%.dbg: \
$(TEST_TOOL_BUILD_LIB_DEPS) \
$(TEST_TOOL_BUILD_LIB_A) \
o/$(MODE)/test/tool/build/lib/%.o \

View file

@ -5,21 +5,21 @@ t=/tmp/pledge-test
if [ $# = 0 ]; then
if ! [ $(id -u) = 0 ]; then
make -j16 MODE=fastbuild \
o/fastbuild/examples/ls.com \
o/fastbuild/tool/curl/curl.com \
o/fastbuild/examples/life.com \
o/fastbuild/examples/hello.com \
o/fastbuild/examples/printargs.com \
o/fastbuild/tool/build/assimilate.com \
o/fastbuild/tool/build/pledge.com || exit
o/fastbuild/examples/ls \
o/fastbuild/tool/curl/curl \
o/fastbuild/examples/life \
o/fastbuild/examples/hello \
o/fastbuild/examples/printargs \
o/fastbuild/tool/build/assimilate \
o/fastbuild/tool/build/pledge || exit
make -j16 MODE=$m \
o/$m/examples/ls.com \
o/$m/tool/curl/curl.com \
o/$m/examples/life.com \
o/$m/examples/hello.com \
o/$m/examples/printargs.com \
o/$m/tool/build/assimilate.com \
o/$m/tool/build/pledge.com || exit
o/$m/examples/ls \
o/$m/tool/curl/curl \
o/$m/examples/life \
o/$m/examples/hello \
o/$m/examples/printargs \
o/$m/tool/build/assimilate \
o/$m/tool/build/pledge || exit
test/tool/build/pledge_test.sh ape_binfmt_test_suite || exit
test/tool/build/pledge_test.sh ape_loader_test_suite || exit
test/tool/build/pledge_test.sh ape_assimilated_test_suite || exit
@ -59,41 +59,41 @@ if [ "$1" = setuid_setup ]; then
rm -rf $t || exit
mkdir -p $t || exit
chmod 01777 $t || exit
cp o/$m/tool/build/pledge.com $t || exit
chmod 06755 $t/pledge.com || exit
cp o/$m/tool/build/pledge $t || exit
chmod 06755 $t/pledge || exit
elif [ "$1" = ape_binfmt_test_suite ]; then
ape/apeinstall.sh >/dev/null 2>&1
startit ape binfmt life.com
o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/life.com
startit ape binfmt life
o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/life
[ $? = 42 ]
checkem
startit ape binfmt hello.com
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/hello.com)" = "hello world" ]
startit ape binfmt hello
[ "$(o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/hello)" = "hello world" ]
checkem
startit ape binfmt curl.com
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
startit ape binfmt curl
[ "$(o/fastbuild/tool/build/pledge -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
checkem
elif [ "$1" = ape_loader_test_suite ]; then
ape/apeuninstall.sh >/dev/null 2>&1
startit ape loader life.com
o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/life.com
startit ape loader life
o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/life
[ $? = 42 ]
checkem
startit ape loader hello.com
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio rpath prot_exec' o/fastbuild/examples/hello.com)" = "hello world" ]
startit ape loader hello
[ "$(o/fastbuild/tool/build/pledge -p 'stdio rpath prot_exec' o/fastbuild/examples/hello)" = "hello world" ]
checkem
startit ape loader curl.com
[ "$(o/fastbuild/tool/build/pledge.com -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
startit ape loader curl
[ "$(o/fastbuild/tool/build/pledge -p 'stdio inet dns rpath prot_exec' o/fastbuild/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
checkem
ape/apeinstall.sh >/dev/null 2>&1
@ -102,76 +102,76 @@ elif [ "$1" = ape_assimilated_test_suite ]; then
mkdir -p $t/assimilated
startit ape assimilated life.com
cp o/fastbuild/examples/life.com $t/assimilated
o/fastbuild/tool/build/assimilate.com $t/assimilated/life.com
o/$m/tool/build/pledge.com -p 'stdio' $t/assimilated/life.com
startit ape assimilated life
cp o/fastbuild/examples/life $t/assimilated
o/fastbuild/tool/build/assimilate $t/assimilated/life
o/$m/tool/build/pledge -p 'stdio' $t/assimilated/life
[ $? = 42 ]
checkem
startit ape assimilated hello.com
cp o/fastbuild/examples/hello.com $t/assimilated
o/fastbuild/tool/build/assimilate.com $t/assimilated/hello.com
[ "$(o/$m/tool/build/pledge.com -p 'stdio' $t/assimilated/hello.com)" = "hello world" ]
startit ape assimilated hello
cp o/fastbuild/examples/hello $t/assimilated
o/fastbuild/tool/build/assimilate $t/assimilated/hello
[ "$(o/$m/tool/build/pledge -p 'stdio' $t/assimilated/hello)" = "hello world" ]
checkem
startit ape assimilated curl.com
cp o/fastbuild/tool/curl/curl.com $t/assimilated
o/fastbuild/tool/build/assimilate.com $t/assimilated/curl.com
[ "$(o/$m/tool/build/pledge.com -p 'stdio rpath inet dns' $t/assimilated/curl.com https://justine.lol/hello.txt)" = "hello world" ]
startit ape assimilated curl
cp o/fastbuild/tool/curl/curl $t/assimilated
o/fastbuild/tool/build/assimilate $t/assimilated/curl
[ "$(o/$m/tool/build/pledge -p 'stdio rpath inet dns' $t/assimilated/curl https://justine.lol/hello.txt)" = "hello world" ]
checkem
elif [ "$1" = ape_native_test_suite ]; then
startit ape native life.com
o/$m/tool/build/pledge.com -p 'stdio' o/$m/examples/life.com
startit ape native life
o/$m/tool/build/pledge -p 'stdio' o/$m/examples/life
[ $? = 42 ]
checkem
startit ape native hello.com
[ "$(o/$m/tool/build/pledge.com -p 'stdio' o/$m/examples/hello.com)" = "hello world" ]
startit ape native hello
[ "$(o/$m/tool/build/pledge -p 'stdio' o/$m/examples/hello)" = "hello world" ]
checkem
startit ape native curl.com
[ "$(o/$m/tool/build/pledge.com -p 'stdio rpath inet dns' o/$m/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
startit ape native curl
[ "$(o/$m/tool/build/pledge -p 'stdio rpath inet dns' o/$m/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
checkem
elif [ "$1" = setuid_test_suite ]; then
startit setuid life.com
$t/pledge.com -p 'stdio' o/$m/examples/life.com
startit setuid life
$t/pledge -p 'stdio' o/$m/examples/life
[ $? = 42 ]
checkem
startit setuid hello.com
[ "$($t/pledge.com -p 'stdio' o/$m/examples/hello.com)" = "hello world" ]
startit setuid hello
[ "$($t/pledge -p 'stdio' o/$m/examples/hello)" = "hello world" ]
checkem
startit setuid curl.com
[ "$($t/pledge.com -p 'stdio rpath inet dns' o/$m/tool/curl/curl.com https://justine.lol/hello.txt)" = "hello world" ]
startit setuid curl
[ "$($t/pledge -p 'stdio rpath inet dns' o/$m/tool/curl/curl https://justine.lol/hello.txt)" = "hello world" ]
checkem
startit setuid getuid
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep getuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep getuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
checkem
startit setuid geteuid
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep geteuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep geteuid | grep -o [[:digit:]]*)" = "$(id -u)" ]
checkem
startit setuid no capabilities
[ "$($t/pledge.com -p 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep CAP_ | wc -l)" = 0 ]
[ "$($t/pledge -p 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep CAP_ | wc -l)" = 0 ]
checkem
startit setuid maximum nice
$t/pledge.com -np 'stdio rpath proc tty' o/$m/examples/printargs.com 2>&1 | grep SCHED_IDLE >/dev/null
$t/pledge -np 'stdio rpath proc tty' o/$m/examples/printargs 2>&1 | grep SCHED_IDLE >/dev/null
checkem
startit setuid chroot
mkdir $t/jail &&
touch $t/jail/hi &&
cp o/$m/examples/ls.com $t/jail &&
$t/pledge.com -v / -c $t/jail -p 'stdio rpath' /ls.com / | grep 'DT_REG /hi' >/dev/null
cp o/$m/examples/ls $t/jail &&
$t/pledge -v / -c $t/jail -p 'stdio rpath' /ls / | grep 'DT_REG /hi' >/dev/null
checkem
fi

View file

@ -10,22 +10,22 @@ TEST_TOOL_NET_SRCS = $(filter %.c,$(TEST_TOOL_NET_FILES))
TEST_TOOL_NET_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_NET_SRCS))
TEST_TOOL_NET_LUAS_TEST = $(filter %_test.lua,$(TEST_TOOL_NET_FILES))
TEST_TOOL_NET_HDRS = $(filter %.h,$(TEST_TOOL_NET_FILES))
TEST_TOOL_NET_COMS = $(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%.com)
TEST_TOOL_NET_COMS = $(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%)
TEST_TOOL_NET_OBJS = \
$(TEST_TOOL_NET_SRCS:%.c=o/$(MODE)/%.o) \
o/$(MODE)/test/tool/net/redbean-tester.com.zip.o
o/$(MODE)/test/tool/net/redbean-tester.zip.o
TEST_TOOL_NET_BINS = \
$(TEST_TOOL_NET_COMS) \
$(TEST_TOOL_NET_COMS:%=%.dbg)
TEST_TOOL_NET_TESTS = \
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_TOOL_NET_CHECKS = \
$(TEST_TOOL_NET_HDRS:%=o/$(MODE)/%.ok) \
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.com.runs) \
$(TEST_TOOL_NET_SRCS_TEST:%.c=o/$(MODE)/%.runs) \
$(TEST_TOOL_NET_LUAS_TEST:%.lua=o/$(MODE)/%.lua.runs)
TEST_TOOL_NET_DIRECTDEPS = \
@ -60,7 +60,7 @@ $(TEST_TOOL_NET_A).pkg: \
$(TEST_TOOL_NET_OBJS) \
$(foreach x,$(TEST_TOOL_NET_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/tool/net/%.com.dbg: \
o/$(MODE)/test/tool/net/%.dbg: \
$(TEST_TOOL_NET_DEPS) \
$(TEST_TOOL_NET_A) \
o/$(MODE)/test/tool/net/%.o \
@ -70,7 +70,8 @@ o/$(MODE)/test/tool/net/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/tool/net/redbean-tester.com.dbg: \
.PRECIOUS: o/$(MODE)/test/tool/net/redbean-tester
o/$(MODE)/test/tool/net/redbean-tester.dbg: \
$(TOOL_NET_DEPS) \
o/$(MODE)/tool/net/redbean.o \
$(TOOL_NET_REDBEAN_LUA_MODULES) \
@ -80,20 +81,10 @@ o/$(MODE)/test/tool/net/redbean-tester.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/tool/net/redbean-tester.com: \
o/$(MODE)/test/tool/net/redbean-tester.com.dbg \
o/$(MODE)/third_party/zip/zip.com \
o/$(MODE)/tool/build/symtab.com \
$(TOOL_NET_REDBEAN_STANDARD_ASSETS)
@$(MAKE_OBJCOPY)
@$(MAKE_SYMTAB_CREATE)
@$(MAKE_SYMTAB_ZIP)
@$(TOOL_NET_REDBEAN_STANDARD_ASSETS_ZIP)
o/$(MODE)/test/tool/net/redbean_test.com.runs: \
o/$(MODE)/test/tool/net/redbean_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc inet
o/$(MODE)/test/tool/net/sqlite_test.com.runs: \
o/$(MODE)/test/tool/net/sqlite_test.runs: \
private .PLEDGE = stdio rpath wpath cpath fattr proc flock
.PHONY: o/$(MODE)/test/tool/net

View file

@ -42,7 +42,7 @@
#ifdef __x86_64__
__static_yoink("zipos");
__static_yoink("o/" MODE "/test/tool/net/redbean-tester.com");
__static_yoink("o/" MODE "/test/tool/net/redbean-tester");
int port;
@ -53,9 +53,9 @@ void SetUpOnce(void) {
if (IsWindows()) return;
testlib_enable_tmp_setup_teardown_once();
ASSERT_NE(-1, mkdir("bin", 0755));
ASSERT_NE(-1, (fdin = open("/zip/o/" MODE "/test/tool/net/redbean-tester.com",
ASSERT_NE(-1, (fdin = open("/zip/o/" MODE "/test/tool/net/redbean-tester",
O_RDONLY)));
ASSERT_NE(-1, (fdout = creat("bin/redbean-tester.com", 0755)));
ASSERT_NE(-1, (fdout = creat("bin/redbean-tester", 0755)));
for (;;) {
ASSERT_NE(-1, (n = read(fdin, buf, sizeof(buf))));
if (!n) break;
@ -118,8 +118,8 @@ TEST(redbean, testOptions) {
close(pipefds[0]);
dup2(pipefds[1], 1);
sigprocmask(SIG_SETMASK, &savemask, NULL);
execv("bin/redbean-tester.com",
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
execv("bin/redbean-tester",
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
__strace > 0 ? "--strace" : 0, 0});
_exit(127);
}
@ -157,8 +157,8 @@ TEST(redbean, testPipeline) {
close(pipefds[0]);
dup2(pipefds[1], 1);
sigprocmask(SIG_SETMASK, &savemask, NULL);
execv("bin/redbean-tester.com",
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
execv("bin/redbean-tester",
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
__strace > 0 ? "--strace" : 0, 0});
_exit(127);
}
@ -205,8 +205,8 @@ TEST(redbean, testContentRange) {
close(pipefds[0]);
dup2(pipefds[1], 1);
sigprocmask(SIG_SETMASK, &savemask, NULL);
execv("bin/redbean-tester.com",
(char *const[]){"bin/redbean-tester.com", "-vvszXp0", "-l127.0.0.1",
execv("bin/redbean-tester",
(char *const[]){"bin/redbean-tester", "-vvszXp0", "-l127.0.0.1",
__strace > 0 ? "--strace" : 0, 0});
_exit(127);
}

View file

@ -11,11 +11,11 @@ TEST_TOOL_PLINKO_FILES := $(wildcard test/tool/plinko/*)
TEST_TOOL_PLINKO_SRCS = $(filter %.c,$(TEST_TOOL_PLINKO_FILES))
TEST_TOOL_PLINKO_SRCS_TEST = $(filter %_test.c,$(TEST_TOOL_PLINKO_SRCS))
TEST_TOOL_PLINKO_HDRS = $(filter %.h,$(TEST_TOOL_PLINKO_FILES))
TEST_TOOL_PLINKO_COMS = $(TEST_TOOL_PLINKO_OBJS:%.o=%.com)
TEST_TOOL_PLINKO_COMS = $(TEST_TOOL_PLINKO_OBJS:%.o=%)
TEST_TOOL_PLINKO_OBJS = \
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.o) \
o/$(MODE)/tool/plinko/plinko.com.zip.o \
o/$(MODE)/tool/plinko/plinko.zip.o \
o/$(MODE)/tool/plinko/lib/library.lisp.zip.o \
o/$(MODE)/tool/plinko/lib/binarytrees.lisp.zip.o \
o/$(MODE)/tool/plinko/lib/algebra.lisp.zip.o \
@ -25,18 +25,18 @@ TEST_TOOL_PLINKO_OBJS = \
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o
TEST_TOOL_PLINKO_COMS = \
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_TOOL_PLINKO_SRCS:%.c=o/$(MODE)/%)
TEST_TOOL_PLINKO_BINS = \
$(TEST_TOOL_PLINKO_COMS) \
$(TEST_TOOL_PLINKO_COMS:%=%.dbg)
TEST_TOOL_PLINKO_TESTS = \
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_TOOL_PLINKO_CHECKS = \
$(TEST_TOOL_PLINKO_HDRS:%=o/$(MODE)/%.ok) \
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_TOOL_PLINKO_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_TOOL_PLINKO_DIRECTDEPS = \
LIBC_CALLS \
@ -67,7 +67,7 @@ $(TEST_TOOL_PLINKO_A).pkg: \
$(TEST_TOOL_PLINKO_OBJS) \
$(foreach x,$(TEST_TOOL_PLINKO_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/tool/plinko/%.com.dbg: \
o/$(MODE)/test/tool/plinko/%.dbg: \
$(TEST_TOOL_PLINKO_DEPS) \
$(TEST_TOOL_PLINKO_A) \
o/$(MODE)/test/tool/plinko/%.o \
@ -77,7 +77,7 @@ o/$(MODE)/test/tool/plinko/%.com.dbg: \
$(APE_NO_MODIFY_SELF)
@$(APELINK)
o/$(MODE)/test/tool/plinko/plinko_test.com.runs: private \
o/$(MODE)/test/tool/plinko/plinko_test.runs: private \
QUOTA = -M100g
o/$(MODE)/test/tool/plinko/algebra_test.lisp.zip.o: private ZIPOBJ_FLAGS += -B

View file

@ -30,7 +30,7 @@
#include "libc/testlib/testlib.h"
__static_yoink("zipos");
__static_yoink("plinko.com");
__static_yoink("plinko");
__static_yoink("library.lisp");
__static_yoink("library_test.lisp");
__static_yoink("binarytrees.lisp");
@ -54,8 +54,8 @@ void SetUpOnce(void) {
int fdin, fdout;
testlib_enable_tmp_setup_teardown_once();
ASSERT_NE(-1, mkdir("bin", 0755));
ASSERT_NE(-1, (fdin = open("/zip/plinko.com", O_RDONLY)));
ASSERT_NE(-1, (fdout = creat("bin/plinko.com", 0755)));
ASSERT_NE(-1, (fdin = open("/zip/plinko", O_RDONLY)));
ASSERT_NE(-1, (fdout = creat("bin/plinko", 0755)));
ASSERT_NE(-1, copyfd(fdin, fdout, -1));
EXPECT_EQ(0, close(fdout));
EXPECT_EQ(0, close(fdin));
@ -89,8 +89,7 @@ TEST(plinko, worksOrPrintsNiceError) {
sigaction(SIGQUIT, &savequit, 0);
sigaction(SIGPIPE, &savepipe, 0);
sigprocmask(SIG_SETMASK, &savemask, 0);
execve("bin/plinko.com", (char *const[]){"bin/plinko.com", 0},
(char *const[]){0});
execve("bin/plinko", (char *const[]){"bin/plinko", 0}, (char *const[]){0});
_exit(127);
}
close(pfds[0][0]);

View file

@ -10,17 +10,17 @@ TEST_TOOL_VIZ_LIB_OBJS = \
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%.o)
TEST_TOOL_VIZ_LIB_COMS = \
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%.com)
$(TEST_TOOL_VIZ_LIB_SRCS:%.c=o/$(MODE)/%)
TEST_TOOL_VIZ_LIB_BINS = \
$(TEST_TOOL_VIZ_LIB_COMS) \
$(TEST_TOOL_VIZ_LIB_COMS:%=%.dbg)
TEST_TOOL_VIZ_LIB_TESTS = \
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.ok)
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.ok)
TEST_TOOL_VIZ_LIB_CHECKS = \
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.com.runs)
$(TEST_TOOL_VIZ_LIB_SRCS_TEST:%.c=o/$(MODE)/%.runs)
TEST_TOOL_VIZ_LIB_DIRECTDEPS = \
DSP_MPEG \
@ -45,7 +45,7 @@ o/$(MODE)/test/tool/viz/lib/vizlib.pkg: \
$(TEST_TOOL_VIZ_LIB_OBJS) \
$(foreach x,$(TEST_TOOL_VIZ_LIB_DIRECTDEPS),$($(x)_A).pkg)
o/$(MODE)/test/tool/viz/lib/%.com.dbg: \
o/$(MODE)/test/tool/viz/lib/%.dbg: \
$(TEST_TOOL_VIZ_LIB_DEPS) \
o/$(MODE)/test/tool/viz/lib/%.o \
o/$(MODE)/test/tool/viz/lib/vizlib.pkg \