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

@ -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) {