mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-23 05:42:29 +00:00
Get Redbean fork() working on the New Technology
Now that we have understandable system call tracing on Windows, this change rewrites many of the polyfill internals for that platform, to help things get closer to tip top shape. Support for complex forking scenarios had been in a regressed state for quite some time. Now, it works! Subsequent changes should be able to address the performance.
This commit is contained in:
parent
efedef6e65
commit
0cb6b6ff4b
84 changed files with 1340 additions and 338 deletions
|
@ -76,11 +76,17 @@ TEST(mkntcmdline, fix) {
|
|||
char *argv1[] = {
|
||||
"C:/WINDOWS/system32/cmd.exe",
|
||||
"/C",
|
||||
"more < \"C:\\Users\\jtunn\\AppData\\Local\\Temp\\tmplquaa_d6\"",
|
||||
"more < \"C:\\Users\\jart\\AppData\\Local\\Temp\\tmplquaa_d6\"",
|
||||
NULL,
|
||||
};
|
||||
EXPECT_NE(-1, mkntcmdline(cmdline, argv1[0], argv1));
|
||||
EXPECT_STREQ(u"C:\\WINDOWS\\system32\\cmd.exe /C \"more < "
|
||||
u"\\\"C:\\Users\\jtunn\\AppData\\Local\\Temp\\tmplquaa_d6\\\"\"",
|
||||
u"\\\"C:\\Users\\jart\\AppData\\Local\\Temp\\tmplquaa_d6\\\"\"",
|
||||
cmdline);
|
||||
}
|
||||
|
||||
TEST(mkntcmdline, testWut) {
|
||||
char *argv[] = {"redbean.com", "--strace", NULL};
|
||||
EXPECT_NE(-1, mkntcmdline(cmdline, "C:\\Users\\jart\\redbean.com", argv));
|
||||
EXPECT_STREQ(u"C:\\Users\\jart\\redbean.com --strace", cmdline);
|
||||
}
|
||||
|
|
40
test/libc/intrin/describeflags_test.c
Normal file
40
test/libc/intrin/describeflags_test.c
Normal file
|
@ -0,0 +1,40 @@
|
|||
/*-*- mode:c;indent-tabs-mode:nil;c-basic-offset:2;tab-width:8;coding:utf-8 -*-│
|
||||
│vi: set net ft=c ts=2 sts=2 sw=2 fenc=utf-8 :vi│
|
||||
╞══════════════════════════════════════════════════════════════════════════════╡
|
||||
│ Copyright 2022 Justine Alexandra Roberts Tunney │
|
||||
│ │
|
||||
│ Permission to use, copy, modify, and/or distribute this software for │
|
||||
│ any purpose with or without fee is hereby granted, provided that the │
|
||||
│ above copyright notice and this permission notice appear in all copies. │
|
||||
│ │
|
||||
│ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL │
|
||||
│ WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED │
|
||||
│ WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE │
|
||||
│ AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL │
|
||||
│ DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR │
|
||||
│ PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER │
|
||||
│ TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR │
|
||||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/intrin/describeflags.internal.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
static const struct DescribeFlags kFlags[] = {
|
||||
{1, "hi"}, //
|
||||
{2, "there"}, //
|
||||
};
|
||||
|
||||
const char *DescribeIt(uint32_t x) {
|
||||
static char s[64];
|
||||
return DescribeFlags(s, ARRAYLEN(s), kFlags, ARRAYLEN(kFlags), "x", x);
|
||||
}
|
||||
|
||||
TEST(describeflags, test) {
|
||||
EXPECT_STREQ("0", DescribeIt(0));
|
||||
EXPECT_STREQ("xhi", DescribeIt(1));
|
||||
EXPECT_STREQ("xthere", DescribeIt(2));
|
||||
EXPECT_STREQ("xhi|xthere", DescribeIt(3));
|
||||
EXPECT_STREQ("xhi|xthere|0x14", DescribeIt(0x17));
|
||||
}
|
|
@ -155,6 +155,9 @@ static const struct {
|
|||
{"\"\\001\"", "%#s", S("\1")}, //
|
||||
{"", "%.*s", 0}, //
|
||||
{"☺☻♥♦♣♠!", "%hhs", S("\1\2\3\4\5\6!")}, //
|
||||
{"☺☻", "%.*hhs", 2, S("\1\2\3\4\5\6!")}, //
|
||||
{"u\"☺☻\"", "%#.*hhs", 2, S("\1\2\3\4\5\6!")}, //
|
||||
{"u\" ☻\"", "%#.*hhs", 2, S("\0\2\3\4\5\6!")}, //
|
||||
{"", "% s", S("")}, //
|
||||
{" a", "% s", S("a")}, //
|
||||
{"", "% .*s", 0, S("a")}, //
|
||||
|
|
|
@ -65,7 +65,7 @@ static void RunTrackMemoryIntervalTest(const struct MemoryIntervals t[2], int x,
|
|||
struct MemoryIntervals *mm;
|
||||
mm = memcpy(malloc(sizeof(*t)), t, sizeof(*t));
|
||||
CheckMemoryIntervalsAreOk(mm);
|
||||
CHECK_NE(-1, TrackMemoryInterval(mm, x, y, h, 0, 0));
|
||||
CHECK_NE(-1, TrackMemoryInterval(mm, x, y, h, 0, 0, 0, 0));
|
||||
CheckMemoryIntervalsAreOk(mm);
|
||||
CheckMemoryIntervalsEqual(mm, t + 1);
|
||||
free(mm);
|
||||
|
@ -102,10 +102,10 @@ TEST(TrackMemoryInterval, TestFull) {
|
|||
mm = calloc(1, sizeof(struct MemoryIntervals));
|
||||
for (i = 0; i < mm->n; ++i) {
|
||||
CheckMemoryIntervalsAreOk(mm);
|
||||
CHECK_NE(-1, TrackMemoryInterval(mm, i, i, i, 0, 0));
|
||||
CHECK_NE(-1, TrackMemoryInterval(mm, i, i, i, 0, 0, 0, 0));
|
||||
CheckMemoryIntervalsAreOk(mm);
|
||||
}
|
||||
CHECK_EQ(-1, TrackMemoryInterval(mm, i, i, i, 0, 0));
|
||||
CHECK_EQ(-1, TrackMemoryInterval(mm, i, i, i, 0, 0, 0, 0));
|
||||
CHECK_EQ(ENOMEM, errno);
|
||||
CheckMemoryIntervalsAreOk(mm);
|
||||
free(mm);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue