mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-02-07 06:53:33 +00:00
Perform code cleanup on test pledges
This commit is contained in:
parent
3d2cf95af1
commit
3443039f34
54 changed files with 112 additions and 83 deletions
|
@ -30,6 +30,7 @@ i32 sys_chroot(const char *) hidden;
|
|||
i32 sys_close(i32) hidden;
|
||||
i32 sys_close_range(u32, u32, u32) hidden;
|
||||
i32 sys_closefrom(i32) hidden;
|
||||
i32 sys_creat(const char *, u32) hidden;
|
||||
i32 sys_dup(i32) hidden;
|
||||
i32 sys_dup2(i32, i32) hidden;
|
||||
i32 sys_dup3(i32, i32, i32) hidden;
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -21,8 +21,8 @@
|
|||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/limits.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
@ -24,6 +25,11 @@
|
|||
#define ROR(w, k) (CheckUnsigned(w) >> (k) | (w) << (sizeof(w) * 8 - (k)))
|
||||
#define ROL(w, k) ((w) << (k) | CheckUnsigned(w) >> (sizeof(w) * 8 - (k)))
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(TwosComplementBane, LiteralsThatAreLiterallyTheSameNumber) {
|
||||
EXPECT_EQ(4, sizeof(INT_MIN));
|
||||
EXPECT_EQ(8, sizeof(-2147483648));
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -17,10 +17,16 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/popcnt.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(popcnt, test) {
|
||||
EXPECT_EQ(32, popcnt(0x5555555555555555));
|
||||
EXPECT_EQ(32, popcnt(VEIL("r", 0x5555555555555555)));
|
||||
|
|
|
@ -17,12 +17,15 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/log/check.h"
|
||||
#include "libc/macros.internal.h"
|
||||
#include "libc/math.h"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(rounddown2pow, test) {
|
||||
EXPECT_EQ(0, rounddown2pow(0));
|
||||
EXPECT_EQ(1, rounddown2pow(1));
|
||||
|
|
|
@ -17,8 +17,15 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/bits/bits.h"
|
||||
#include "libc/calls/calls.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(roundup2log, test) {
|
||||
EXPECT_EQ(0, roundup2log(0));
|
||||
EXPECT_EQ(1, roundup2log(1));
|
||||
|
|
|
@ -17,12 +17,19 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#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"
|
||||
#include "libc/nexgen32e/bsr.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(roundup2pow, test) {
|
||||
EXPECT_EQ(0, roundup2pow(0));
|
||||
EXPECT_EQ(1, roundup2pow(1));
|
||||
|
|
|
@ -24,6 +24,7 @@ TEST_LIBC_BITS_CHECKS = \
|
|||
|
||||
TEST_LIBC_BITS_DIRECTDEPS = \
|
||||
LIBC_BITS \
|
||||
LIBC_CALLS \
|
||||
LIBC_FMT \
|
||||
LIBC_INTRIN \
|
||||
LIBC_MEM \
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -39,7 +39,7 @@ char tmp[PATH_MAX];
|
|||
char pathbuf[PATH_MAX];
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr proc exec", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -29,28 +29,23 @@
|
|||
|
||||
int64_t fd;
|
||||
struct stat st;
|
||||
const char *path;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(ftruncate, test) {
|
||||
mkdir("o", 0755);
|
||||
mkdir("o/tmp", 0755);
|
||||
path = gc(xasprintf("o/tmp/%s.%d",
|
||||
firstnonnull(program_invocation_short_name, "unknown"),
|
||||
getpid()));
|
||||
ASSERT_NE(-1, (fd = creat(path, 0755)));
|
||||
ASSERT_NE(-1, (fd = creat("foo", 0755)));
|
||||
ASSERT_EQ(5, write(fd, "hello", 5));
|
||||
errno = 31337;
|
||||
ASSERT_NE(-1, ftruncate(fd, 31337));
|
||||
EXPECT_EQ(31337, errno);
|
||||
ASSERT_EQ(5, write(fd, "world", 5));
|
||||
ASSERT_NE(-1, close(fd));
|
||||
ASSERT_NE(-1, stat(path, &st));
|
||||
ASSERT_NE(-1, stat("foo", &st));
|
||||
ASSERT_EQ(31337, st.st_size);
|
||||
ASSERT_BINEQ(u"helloworld", gc(xslurp(path, 0)));
|
||||
unlink(path);
|
||||
ASSERT_BINEQ(u"helloworld", gc(xslurp("foo", 0)));
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ int fd;
|
|||
char buf[8];
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/x/x.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath tty proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ char buf[8];
|
|||
struct stat st;
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -33,8 +33,8 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "tool/net/sandbox.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath proc", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -30,8 +30,8 @@
|
|||
|
||||
bool gotsig;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@
|
|||
struct sigaction oldsa;
|
||||
volatile bool gotsigint;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -28,8 +28,8 @@ testonly void OnUsr1(int sig) {
|
|||
_exit(0);
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath proc", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -28,8 +28,8 @@
|
|||
|
||||
volatile int n;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath proc", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -36,7 +36,7 @@ STATIC_YOINK("zip_uri_support");
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -30,7 +30,7 @@ char testlib_enable_tmp_setup_teardown;
|
|||
char p[2][PATH_MAX];
|
||||
struct stat st;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@
|
|||
#include "libc/calls/landlock.h"
|
||||
#include "libc/calls/struct/dirent.h"
|
||||
#include "libc/calls/struct/stat.h"
|
||||
#include "libc/calls/syscall-sysv.internal.h"
|
||||
#include "libc/dce.h"
|
||||
#include "libc/errno.h"
|
||||
#include "libc/intrin/kprintf.h"
|
||||
|
@ -70,7 +71,7 @@ static bool SupportsLandlock(void) {
|
|||
return r;
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
if (!(IsLinux() && SupportsLandlock()) && !IsOpenbsd()) exit(0);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath fattr", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "libc/str/str.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -45,7 +45,7 @@ void SetUp(void) {
|
|||
if (IsWindows()) exit(0);
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -32,11 +32,6 @@ STATIC_YOINK("apetest2.com");
|
|||
|
||||
char testlib_enable_tmp_setup_teardown_once;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath wpath cpath tty proc exec", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
void Extract(const char *from, const char *to, int mode) {
|
||||
ASSERT_SYS(0, 3, open(from, O_RDONLY));
|
||||
ASSERT_SYS(0, 4, creat(to, mode));
|
||||
|
@ -46,6 +41,8 @@ void Extract(const char *from, const char *to, int mode) {
|
|||
}
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath tty proc exec", 0);
|
||||
errno = 0;
|
||||
|
||||
// nothing to do if we're using elf
|
||||
if (~SUPPORT_VECTOR & (WINDOWS | XNU)) {
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "libc/nexgen32e/threaded.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
__tls_enabled = false;
|
||||
pledge("stdio rpath", 0);
|
||||
errno = 0;
|
||||
|
|
|
@ -49,8 +49,8 @@
|
|||
int x, me, tid;
|
||||
_Atomic(int) thechilde;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath thread", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio thread", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,8 +29,8 @@
|
|||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath proc", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@
|
|||
#define I(x, y) \
|
||||
{ x, y, 0, (y - x) * FRAMESIZE + FRAMESIZE }
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath wpath cpath proc", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
|
@ -37,8 +37,8 @@
|
|||
#include "tool/decode/lib/flagger.h"
|
||||
#include "tool/decode/lib/pollnames.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath proc inet", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio proc inet", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath cpath proc inet", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
TEST(sendfile, test) {
|
||||
int ws;
|
||||
char *buf;
|
||||
|
|
|
@ -27,8 +27,8 @@
|
|||
#include "libc/sysv/consts/sol.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath inet", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio inet", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -25,8 +25,8 @@
|
|||
#include "libc/sysv/consts/sock.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath tty", 0);
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio tty", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -31,13 +31,13 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
#include "libc/time/time.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath cpath proc unix", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
char testlib_enable_tmp_setup_teardown;
|
||||
|
||||
void DatagramServer(void) {
|
||||
char buf[256] = {0};
|
||||
uint32_t len = sizeof(struct sockaddr_un);
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
#include "libc/testlib/hyperion.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
void SetUpOnce(void) {
|
||||
GetSymbolTable();
|
||||
pledge("stdio", 0);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
_Atomic(int) itworked;
|
||||
_Thread_local int var;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
pledge("stdio rpath thread", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
||||
int Worker(void *arg, int tid) {
|
||||
int i = (long)arg;
|
||||
ASSERT_EQ(0, var++);
|
||||
|
@ -50,8 +55,3 @@ TEST(_spawn, test) {
|
|||
for (i = 0; i < n; ++i) EXPECT_SYS(0, 0, _join(t + i));
|
||||
EXPECT_EQ(n, itworked);
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void init(void) {
|
||||
pledge("stdio rpath thread", 0);
|
||||
errno = 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue