Revert "Unbloat build config"

This reverts commit ae5d06dc53.
This commit is contained in:
Justine Tunney 2022-08-10 12:44:56 -07:00
parent 95f54eeb40
commit c1d99676c4
1421 changed files with 5556 additions and 2198 deletions

View file

@ -22,7 +22,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
unsigned P[] = {

View file

@ -22,7 +22,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(bitreverse, test) {

View file

@ -21,13 +21,13 @@
#include "libc/calls/calls.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(_countbits, testLow) {

View file

@ -26,7 +26,8 @@
#define ROL(w, k) ((w) << (k) | CheckUnsigned(w) >> (sizeof(w) * 8 - (k)))
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(TwosComplementBane, LiteralsThatAreLiterallyTheSameNumber) {

View file

@ -18,14 +18,14 @@
*/
#include "libc/bits/morton.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/nexgen32e/kcpuids.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio rpath", 0);
errno = 0;
}
TEST(morton, test) {

View file

@ -23,7 +23,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(popcnt, test) {

View file

@ -18,10 +18,12 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(rounddown2pow, test) {

View file

@ -18,10 +18,12 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(roundup2log, test) {

View file

@ -18,6 +18,7 @@
*/
#include "libc/bits/bits.h"
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
@ -25,7 +26,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
TEST(roundup2pow, test) {

View file

@ -59,20 +59,6 @@ TEST(_timespec_frommicros, test) {
_timespec_eq((struct timespec){0, 2000}, _timespec_frommicros(2)));
EXPECT_TRUE(
_timespec_eq((struct timespec){1}, _timespec_frommicros(1000000)));
EXPECT_TRUE(_timespec_eq((struct timespec){2, 123000},
_timespec_frommicros(2000123)));
}
TEST(_timespec_tomillis, test) {
EXPECT_EQ(2123, _timespec_tomillis((struct timespec){2, 123000000}));
}
TEST(_timespec_tomicros, test) {
EXPECT_EQ(2000123, _timespec_tomicros((struct timespec){2, 123000}));
}
TEST(_timespec_tonanos, test) {
EXPECT_EQ(2000123000, _timespec_tonanos((struct timespec){2, 123000}));
}
static long mod(long x, long y) {

View file

@ -30,7 +30,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(access, efault) {

View file

@ -25,7 +25,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(chdir, efault) {

View file

@ -22,7 +22,6 @@
#include "libc/calls/struct/timeval.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/nexgen32e/rdtsc.h"
#include "libc/runtime/runtime.h"
#include "libc/sysv/consts/auxv.h"

View file

@ -40,7 +40,8 @@ char pathbuf[PATH_MAX];
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
void SetUp(void) {

View file

@ -32,6 +32,11 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
pledge("stdio rpath wpath cpath fattr proc exec", 0);
errno = 0;
}
static textstartup void TestInit(int argc, char **argv) {
int fd;
if (argc == 2 && !strcmp(argv[1], "boop")) {

View file

@ -31,7 +31,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(fcntl_getfl, testRemembersAccessMode) {

View file

@ -24,7 +24,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(fileexists, test) {

View file

@ -33,7 +33,8 @@ struct stat st;
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath", 0));
pledge("stdio rpath wpath cpath", 0);
errno = 0;
}
TEST(ftruncate, test) {

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/fmt/conv.h"
#include "libc/fmt/fmt.h"
#include "libc/log/check.h"
@ -28,7 +29,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath cpath fattr", 0));
pledge("stdio rpath cpath fattr", 0);
errno = 0;
}
TEST(getcwd, test) {

View file

@ -28,7 +28,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr proc", 0));
pledge("stdio rpath wpath cpath fattr proc", 0);
errno = 0;
}
TEST(lseek, wat) {

View file

@ -24,7 +24,6 @@
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -32,7 +31,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
void SetUp(void) {

View file

@ -20,7 +20,6 @@
#include "libc/calls/struct/itimerval.h"
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/timespec.h"
#include "libc/errno.h"
#include "libc/intrin/describeflags.internal.h"
#include "libc/intrin/kprintf.h"
#include "libc/sysv/consts/itimer.h"

View file

@ -19,10 +19,8 @@
#include "libc/calls/internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/macros.internal.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"
@ -30,7 +28,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(open, efault) {
@ -52,7 +51,7 @@ TEST(open, enotdir) {
TEST(open, eexist) {
ASSERT_SYS(0, 0, touch("exists", 0644));
ASSERT_SYS(EEXIST, -1, open("exists", O_WRONLY | O_CREAT | O_EXCL, 0644));
ASSERT_SYS(EEXIST, -1, open("exists", O_WRONLY | O_CREAT | O_EXCL));
}
TEST(open, doubleSlash_worksAndGetsNormalizedOnWindows) {

View file

@ -1,61 +0,0 @@
/*-*- 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/calls/calls.h"
#include "libc/sysv/consts/o.h"
#include "libc/testlib/testlib.h"
#define SPAWN(METHOD) \
{ \
int ws, pid; \
ASSERT_NE(-1, (pid = METHOD())); \
if (!pid) {
#define EXITS(rc) \
_Exit(0); \
} \
ASSERT_NE(-1, wait(&ws)); \
ASSERT_TRUE(WIFEXITED(ws)); \
ASSERT_EQ(rc, WEXITSTATUS(ws)); \
}
#define TERMS(sig) \
_Exit(0); \
} \
ASSERT_NE(-1, wait(&ws)); \
ASSERT_TRUE(WIFSIGNALED(ws)); \
ASSERT_EQ(sig, WTERMSIG(ws)); \
}
char testlib_enable_tmp_setup_teardown;
TEST(pledge, promisedSyscallsCanBeCalled_ieEnosysIsIgnored) {
SPAWN(fork);
EXPECT_SYS(0, 0, pledge("stdio", 0));
EXPECT_SYS(0, 0, read(0, 0, 0));
EXITS(0);
}
TEST(unveil, pathBecomeVisible_ieEnosysIsIgnored) {
SPAWN(fork);
EXPECT_SYS(0, 0, touch("foo", 0644));
EXPECT_SYS(0, 0, unveil("foo", "r"));
EXPECT_SYS(0, 0, unveil(0, 0));
EXPECT_SYS(0, 3, open("foo", O_RDONLY));
EXITS(0);
}

View file

@ -21,7 +21,6 @@
#include "libc/calls/struct/seccomp.h"
#include "libc/calls/syscall_support-sysv.internal.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/intrin/promises.internal.h"
#include "libc/runtime/runtime.h"
@ -99,7 +98,7 @@ TEST(pledge, testLogMessage_inSoftyMode) {
read(fds[0], msg, sizeof(msg));
close(fds[0]);
if (IsLinux()) {
ASSERT_STARTSWITH("error: pledge inet for socket", msg);
ASSERT_STARTSWITH("error: maybe pledge inet", msg);
}
}
@ -117,7 +116,7 @@ TEST(pledge, testLogMessage_onKillProcess) {
read(fds[0], msg, sizeof(msg));
close(fds[0]);
if (IsLinux()) {
ASSERT_STARTSWITH("error: pledge inet for socket", msg);
ASSERT_STARTSWITH("error: maybe pledge inet", msg);
}
}

View file

@ -82,7 +82,6 @@ int extract(const char *from, const char *to, int mode) {
}
void SetUp(void) {
__enable_threads();
if (!__is_linux_2_6_23() && !IsOpenbsd()) exit(0);
ASSERT_SYS(0, 0, extract("/zip/life.elf", "life.elf", 0755));
ASSERT_SYS(0, 0, extract("/zip/sock.elf", "sock.elf", 0755));

View file

@ -25,7 +25,8 @@ char buf[8];
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(pread, testReadPastEof_returnsZero) {

View file

@ -23,7 +23,8 @@
#include "libc/x/x.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath tty proc", 0));
pledge("stdio rpath tty proc", 0);
errno = 0;
}
/**

View file

@ -26,7 +26,8 @@ struct stat st;
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(pwrite, testWritePastEof_extendsFile) {

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/runtime/runtime.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"
#include "libc/x/x.h"

View file

@ -18,6 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/errno.h"
#include "libc/log/log.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/gc.internal.h"
@ -32,7 +33,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(readlink, enoent) {

View file

@ -25,7 +25,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(rename, enoent) {

View file

@ -29,9 +29,7 @@
#include "libc/macros.internal.h"
#include "libc/nexgen32e/threaded.h"
#include "libc/rand/rand.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/itimer.h"
#include "libc/sysv/consts/map.h"
@ -50,11 +48,6 @@ STATIC_YOINK("libc/testlib/hyperion.txt");
#define THREADS 8
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
void PullSomeZipFilesIntoLinkage(void) {
gmtime(0);
}

View file

@ -34,7 +34,8 @@
#include "tool/net/sandbox.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
pledge("stdio proc", 0);
errno = 0;
}
// It's been reported that Chromebooks return EINVAL here.

View file

@ -31,7 +31,8 @@
bool gotsig;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
void OnSigAlrm(int sig, siginfo_t *si, ucontext_t *ctx) {

View file

@ -34,7 +34,8 @@ struct sigaction oldsa;
volatile bool gotsigint;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath proc", 0));
pledge("stdio rpath proc", 0);
errno = 0;
}
void OnSigInt(int sig) {

View file

@ -31,7 +31,8 @@ testonly void OnUsr1(int sig) {
}
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
pledge("stdio proc", 0);
errno = 0;
}
TEST(signal, test) {

View file

@ -29,7 +29,8 @@
volatile int n;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
pledge("stdio proc", 0);
errno = 0;
}
void OnSig(int sig, siginfo_t *si, ucontext_t *ctx) {

View file

@ -37,7 +37,8 @@ STATIC_YOINK("zip_uri_support");
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(stat_010, testEmptyFile_sizeIsZero) {

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/stat.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/rand/rand.h"
@ -32,7 +31,8 @@ char p[2][PATH_MAX];
struct stat st;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(symlink, enoent) {

View file

@ -73,13 +73,13 @@ o/$(MODE)/test/libc/calls/%.com.dbg: \
@$(APELINK)
o/$(MODE)/test/libc/calls/tiny64.elf.zip.o: test/libc/calls/tiny64.elf
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-nomod.com.zip.o: o/$(MODE)/test/libc/calls/life-nomod.com
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-classic.com.zip.o: o/$(MODE)/test/libc/calls/life-classic.com
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/calls/life-classic.com.dbg: \
$(LIBC_RUNTIME) \

View file

@ -18,14 +18,14 @@
*/
#include "libc/calls/calls.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/sysv/consts/at.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(unlink, efault) {

View file

@ -26,7 +26,6 @@
#include "libc/intrin/kprintf.h"
#include "libc/mem/io.h"
#include "libc/runtime/gc.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/stdio/stdio.h"
@ -73,7 +72,6 @@ static bool SupportsLandlock(void) {
}
void SetUpOnce(void) {
__enable_threads();
if (!(IsLinux() && SupportsLandlock()) && !IsOpenbsd()) exit(0);
}

View file

@ -30,7 +30,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(utimensat, test) {

View file

@ -32,7 +32,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath fattr", 0));
pledge("stdio rpath wpath cpath fattr", 0);
errno = 0;
}
TEST(writev, test) {

View file

@ -23,7 +23,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio rpath", 0);
errno = 0;
}
TEST(CompareDnsNames, testEmpty) {

View file

@ -30,7 +30,6 @@
#include "libc/dns/ent.h"
#include "libc/dns/prototxt.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;

View file

@ -17,8 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/dns/hoststxt.h"
#include "libc/mem/mem.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/testlib/testlib.h"

View file

@ -25,11 +25,11 @@
OTHER DEALINGS IN THE SOFTWARE.
*/
#include "libc/dns/servicestxt.h"
#include "libc/calls/calls.h"
#include "libc/dns/dns.h"
#include "libc/dns/ent.h"
#include "libc/dns/servicestxt.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;

View file

@ -18,7 +18,6 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -18,7 +18,6 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
char buf[25];

View file

@ -18,7 +18,6 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/fmt/itoa.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -18,7 +18,6 @@
*/
#include "libc/fmt/itoa.h"
#include "libc/limits.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -143,9 +143,9 @@ TEST(sscanf, testDiscard_notIncludedInCount) {
}
TEST(sscanf, testFixedWidthFormat_Integer) {
int r, g, b;
ASSERT_EQ(3, sscanf("#321030", "#%2x%2b%2d", &r, &g, &b));
ASSERT_EQ(0x32, r);
ASSERT_EQ(2, g);
ASSERT_EQ(30, b);
int r, g, b;
ASSERT_EQ(3, sscanf("#321030", "#%2x%2b%2d", &r, &g, &b));
ASSERT_EQ(0x32, r);
ASSERT_EQ(2, g);
ASSERT_EQ(30, b);
}

View file

@ -54,11 +54,6 @@ _Alignas(64) char slock;
pthread_mutex_t mylock;
struct spawn th[THREADS];
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
}
TEST(pthread_mutex_lock, normal) {
pthread_mutex_t lock;
pthread_mutexattr_t attr;

View file

@ -19,7 +19,6 @@
#include "libc/fmt/conv.h"
#include "libc/limits.h"
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/runtime/symbols.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"

View file

@ -78,11 +78,11 @@ o/$(MODE)/test/libc/log/backtrace.com.dbg: \
o/$(MODE)/test/libc/log/backtrace.com.zip.o: \
o/$(MODE)/test/libc/log/backtrace.com
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
o/$(MODE)/test/libc/log/backtrace.com.dbg.zip.o: \
o/$(MODE)/test/libc/log/backtrace.com.dbg
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
.PHONY: o/$(MODE)/test/libc/log
o/$(MODE)/test/libc/log: \

View file

@ -46,7 +46,8 @@ void SetUp(void) {
}
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio rpath", 0);
errno = 0;
}
TEST(malloc, zeroMeansOne) {

View file

@ -89,17 +89,17 @@ o/$(MODE)/test/libc/mem/prog/life.com.dbg: \
o/$(MODE)/test/libc/mem/prog/life.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/life.com
@$(COMPILE) -wACP -T$@ \
@$(COMPILE) -ACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/life.com \
o/$(MODE)/test/libc/mem/prog/life.elf
@$(COMPILE) -wAASSIMILATE -T$@ \
@$(COMPILE) -AASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/life.elf
o/$(MODE)/test/libc/mem/prog/life.elf.zip.o: \
o/$(MODE)/test/libc/mem/prog/life.elf
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
################################################################################
@ -114,17 +114,17 @@ o/$(MODE)/test/libc/mem/prog/sock.com.dbg: \
o/$(MODE)/test/libc/mem/prog/sock.elf: \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/sock.com
@$(COMPILE) -wACP -T$@ \
@$(COMPILE) -ACP -T$@ \
build/bootstrap/cp.com \
o/$(MODE)/test/libc/mem/prog/sock.com \
o/$(MODE)/test/libc/mem/prog/sock.elf
@$(COMPILE) -wAASSIMILATE -T$@ \
@$(COMPILE) -AASSIMILATE -T$@ \
o/$(MODE)/tool/build/assimilate.com \
o/$(MODE)/test/libc/mem/prog/sock.elf
o/$(MODE)/test/libc/mem/prog/sock.elf.zip.o: \
o/$(MODE)/test/libc/mem/prog/sock.elf
@$(COMPILE) -wAZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
@$(COMPILE) -AZIPOBJ $(ZIPOBJ) $(ZIPOBJ_FLAGS) -B $(OUTPUT_OPTION) $<
################################################################################

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/log/log.h"
#include "libc/mem/mem.h"
#include "libc/nexgen32e/gc.internal.h"
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/runtime/gc.internal.h"

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
TEST(kBase36, test) {

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/nexgen32e/nexgen32e.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -65,7 +65,7 @@ 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
@$(COMPILE) -ATEST -wtT$@ $^ $(filter-out openbsd,$(HOSTS))
@$(COMPILE) -ATEST -tT$@ $^ $(filter-out openbsd,$(HOSTS))
$(TEST_LIBC_NEXGEN32E_OBJS): \
DEFAULT_CCFLAGS += \

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/bits/bits.h"
#include "libc/errno.h"
#include "libc/log/check.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"

View file

@ -29,7 +29,6 @@
#include "libc/mem/mem.h"
#include "libc/nexgen32e/threaded.h"
#include "libc/rand/rand.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
@ -48,11 +47,6 @@
int ready;
volatile uint64_t A[THREADS * ENTRIES];
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
void OnChld(int sig) {
// do nothing
}

View file

@ -9,7 +9,7 @@ o/$(MODE)/test/libc/release/cosmopolitan.zip: \
o/$(MODE)/ape/ape-no-modify-self.o \
o/$(MODE)/cosmopolitan.a \
o/$(MODE)/third_party/zip/zip.com
@$(COMPILE) -wAZIP -T$@ \
@$(COMPILE) -AZIP -T$@ \
o/$(MODE)/third_party/zip/zip.com \
-qj $@ \
o/cosmopolitan.h \
@ -88,7 +88,7 @@ o/$(MODE)/test/libc/release/smoke-chibicc.o: \
test/libc/release/smoke.c \
o/cosmopolitan.h \
o/$(MODE)/third_party/chibicc/chibicc.com
@$(COMPILE) -wACHIBICC \
@$(COMPILE) -ACHIBICC \
o/$(MODE)/third_party/chibicc/chibicc.com \
$(CHIBICC_FLAGS) \
-o $@ \

View file

@ -24,7 +24,8 @@
void SetUpOnce(void) {
__tls_enabled = false;
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio rpath", 0);
errno = 0;
}
TEST(arch_prctl, fs) {

View file

@ -50,8 +50,8 @@ int x, me, tid;
_Atomic(int) thechilde;
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio thread", 0);
errno = 0;
}
void *__initialize_tls(char tib[64]) {

View file

@ -30,7 +30,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio proc", 0));
pledge("stdio proc", 0);
errno = 0;
}
TEST(fork, testPipes) {

View file

@ -17,6 +17,7 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/limits.h"
#include "libc/log/check.h"
@ -31,7 +32,8 @@
{ x, y, 0, (y - x) * FRAMESIZE + FRAMESIZE }
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio rpath", 0);
errno = 0;
}
static bool AreMemoryIntervalsEqual(const struct MemoryIntervals *mm1,

View file

@ -23,6 +23,7 @@
#include "libc/calls/calls.h"
#include "libc/calls/ucontext.h"
#include "libc/dce.h"
#include "libc/errno.h"
#include "libc/fmt/fmt.h"
#include "libc/intrin/kprintf.h"
#include "libc/linux/mmap.h"
@ -49,7 +50,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath proc", 0));
pledge("stdio rpath wpath cpath proc", 0);
errno = 0;
}
TEST(mmap, zeroSize) {

View file

@ -27,7 +27,6 @@
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/prot.h"

View file

@ -21,7 +21,6 @@
#include "libc/calls/struct/sigaction.h"
#include "libc/calls/struct/siginfo.h"
#include "libc/calls/ucontext.h"
#include "libc/errno.h"
#include "libc/intrin/kprintf.h"
#include "libc/runtime/memtrack.internal.h"
#include "libc/runtime/runtime.h"

View file

@ -40,7 +40,8 @@
#include "tool/decode/lib/pollnames.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio proc inet", 0));
pledge("stdio proc inet", 0);
errno = 0;
}
dontdiscard char *FormatPollFd(struct pollfd p[2]) {

View file

@ -24,7 +24,8 @@
#include "libc/time/time.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio", 0);
errno = 0;
}
// TEST(select, allZero) {

View file

@ -33,7 +33,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath wpath cpath proc inet", 0));
pledge("stdio rpath wpath cpath proc inet", 0);
errno = 0;
}
TEST(sendfile, test) {

View file

@ -22,7 +22,6 @@
#include "libc/runtime/gc.internal.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/msghdr.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/o.h"
#include "libc/sysv/consts/sock.h"

View file

@ -18,7 +18,6 @@
*/
#include "libc/calls/calls.h"
#include "libc/calls/struct/timeval.h"
#include "libc/errno.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/sysv/consts/af.h"
@ -29,7 +28,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio inet", 0));
pledge("stdio inet", 0);
errno = 0;
}
TEST(setsockopt, SO_RCVTIMEO) {

View file

@ -26,7 +26,8 @@
#include "libc/testlib/testlib.h"
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio tty", 0));
pledge("stdio tty", 0);
errno = 0;
}
TEST(socketpair, testAfUnixStream) {

View file

@ -25,7 +25,6 @@
#include "libc/runtime/runtime.h"
#include "libc/sock/sock.h"
#include "libc/sock/struct/sockaddr.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/af.h"
#include "libc/sysv/consts/so.h"
#include "libc/sysv/consts/sock.h"
@ -36,7 +35,8 @@
char testlib_enable_tmp_setup_teardown;
void SetUpOnce(void) {
ASSERT_SYS(0, 0, pledge("stdio rpath cpath proc unix", 0));
pledge("stdio rpath cpath proc unix", 0);
errno = 0;
}
void DatagramServer(void) {

View file

@ -23,14 +23,12 @@
#include "libc/intrin/kprintf.h"
#include "libc/intrin/spinlock.h"
#include "libc/intrin/wait0.internal.h"
#include "libc/macros.internal.h"
#include "libc/math.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/runtime/stack.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/clone.h"
#include "libc/sysv/consts/map.h"
#include "libc/sysv/consts/prot.h"
@ -53,11 +51,6 @@ union Dub {
double x;
};
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
int Worker(void *p, int tid) {
int i;
char str[64];

View file

@ -18,9 +18,7 @@
*/
#include "libc/calls/calls.h"
#include "libc/runtime/internal.h"
#include "libc/stdio/lock.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -19,7 +19,6 @@
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"

View file

@ -25,7 +25,6 @@
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/sysv/consts/sig.h"
#include "libc/testlib/testlib.h"
#include "libc/time/time.h"

View file

@ -20,7 +20,6 @@
#include "libc/runtime/gc.internal.h"
#include "libc/stdio/iconv.h"
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/testlib.h"
TEST(iconv, test) {

View file

@ -19,7 +19,6 @@
#include "libc/calls/calls.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/stdio/stdio.h"
#include "libc/testlib/testlib.h"
#include "libc/thread/spawn.h"
@ -40,11 +39,6 @@ int Worker(void *arg, int tid) {
return 0;
}
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
}
TEST(memory, test) {
int i, n = 32;
struct spawn *t = gc(malloc(sizeof(struct spawn) * n));

View file

@ -90,13 +90,13 @@ const char kTinyLinuxExit[128] = {
0x6a, 0x2a, 0x5f, 0x6a, 0x3c, 0x58, 0x0f, 0x05, // j*_j<X☼♣
};
/* BENCH(spawn, bench) { */
/* int fd; */
/* if (IsLinux()) { */
/* fd = open("/tmp/tiny64", O_CREAT | O_TRUNC | O_WRONLY, 0755); */
/* write(fd, kTinyLinuxExit, 128); */
/* close(fd); */
/* EZBENCH2("spawn", donothing, BenchmarkProcessLifecycle()); */
/* unlink("/tmp/tiny64"); */
/* } */
/* } */
BENCH(spawn, bench) {
int fd;
if (IsLinux()) {
fd = open("/tmp/tiny64", O_CREAT | O_TRUNC | O_WRONLY, 0755);
write(fd, kTinyLinuxExit, 128);
close(fd);
EZBENCH2("spawn", donothing, BenchmarkProcessLifecycle());
unlink("/tmp/tiny64");
}
}

View file

@ -16,15 +16,25 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/calls/calls.h"
#include "libc/errno.h"
#include "libc/runtime/runtime.h"
#include "libc/stdio/stdio.h"
#include "libc/stdio/temp.h"
#include "libc/testlib/testlib.h"
char testlib_enable_tmp_setup_teardown;
TEST(tmpfile, test) {
FILE *f = tmpfile();
FILE *f;
mkdir("doge", 0755);
setenv("TMPDIR", "doge", true);
ASSERT_NE(NULL, (f = tmpfile()));
EXPECT_NE(-1, fputc('t', f));
EXPECT_NE(-1, fflush(f));
rewind(f);
EXPECT_EQ('t', fgetc(f));
EXPECT_NE(-1, fclose(f));
EXPECT_EQ(-1, rmdir("doge"));
EXPECT_EQ(ENOTEMPTY, errno);
}

View file

@ -17,7 +17,6 @@
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/stdio/stdio.h"
#include "libc/str/str.h"
#include "libc/testlib/hyperion.h"
#include "libc/testlib/testlib.h"

View file

@ -18,9 +18,7 @@
*/
#include "libc/bits/bits.h"
#include "libc/intrin/kprintf.h"
#include "libc/mem/mem.h"
#include "libc/stdio/append.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"

View file

@ -28,7 +28,7 @@
void SetUpOnce(void) {
GetSymbolTable();
ASSERT_SYS(0, 0, pledge("stdio rpath", 0));
pledge("stdio", 0);
}
TEST(isutf8, good) {

View file

@ -24,7 +24,6 @@
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/runtime/internal.h"
#include "libc/testlib/testlib.h"
#include "libc/thread/spawn.h"
#include "libc/thread/thread.h"
@ -33,8 +32,8 @@ _Atomic(int) itworked;
_Thread_local int var;
void SetUpOnce(void) {
__enable_threads();
ASSERT_SYS(0, 0, pledge("stdio", 0));
pledge("stdio rpath thread", 0);
errno = 0;
}
int Worker(void *arg, int tid) {

View file

@ -18,7 +18,6 @@
*/
#include "libc/fmt/fmt.h"
#include "libc/macros.internal.h"
#include "libc/mem/mem.h"
#include "libc/runtime/fenv.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"

View file

@ -16,7 +16,6 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/hyperion.h"

View file

@ -16,9 +16,7 @@
TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
*/
#include "libc/mem/mem.h"
#include "libc/runtime/gc.internal.h"
#include "libc/str/str.h"
#include "libc/testlib/ezbench.h"
#include "libc/testlib/testlib.h"
#include "libc/x/x.h"