mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-05-28 08:12:28 +00:00
Make improvements
- Add GetCpuCount() API to redbean - Add unix.gmtime() API to redbean - Add unix.readlink() API to redbean - Add unix.localtime() API to redbean - Perfect the new redbean UNIX module APIs - Integrate with Linux clock_gettime() vDSO - Run Lua garbage collector when malloc() fails - Fix another regression quirk with linenoise repl - Fix GetProgramExecutableName() for systemwide installs - Fix a build flake with test/libc/mem/test.mk SRCS list
This commit is contained in:
parent
860ea18a87
commit
d57b81aac7
51 changed files with 3096 additions and 1395 deletions
|
@ -72,5 +72,5 @@ TEST(access, testRequestWriteOnReadOnly_returnsEaccess) {
|
|||
}
|
||||
|
||||
TEST(access, runThisExecutable) {
|
||||
ASSERT_SYS(0, 0, access(program_executable_name, R_OK | X_OK));
|
||||
ASSERT_SYS(0, 0, access(GetProgramExecutableName(), R_OK | X_OK));
|
||||
}
|
||||
|
|
29
test/libc/calls/clock_gettime_test.c
Normal file
29
test/libc/calls/clock_gettime_test.c
Normal file
|
@ -0,0 +1,29 @@
|
|||
/*-*- 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/calls/struct/timespec.h"
|
||||
#include "libc/sysv/consts/clock.h"
|
||||
#include "libc/testlib/ezbench.h"
|
||||
#include "libc/testlib/testlib.h"
|
||||
|
||||
BENCH(clock_gettime, bench) {
|
||||
struct timespec ts;
|
||||
EZBENCH2("nowl", donothing, nowl());
|
||||
EZBENCH2("clock_gettime", donothing, clock_gettime(CLOCK_REALTIME, &ts));
|
||||
}
|
|
@ -51,8 +51,8 @@ TEST(dup, clearsCloexecFlag) {
|
|||
ASSERT_NE(-1, (ws = xspawn(0)));
|
||||
if (ws == -2) {
|
||||
dup2(3, 0);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "boop", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "boop", 0});
|
||||
_exit(127);
|
||||
}
|
||||
ASSERT_EQ(72, WEXITSTATUS(ws));
|
||||
|
|
|
@ -177,8 +177,8 @@ TEST(ShowCrashReports, testMemoryLeakCrash) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "6", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "6", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -255,8 +255,8 @@ TEST(ShowCrashReports, testStackOverrunCrash) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "5", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "5", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -364,8 +364,8 @@ TEST(ShowCrashReports, testDivideByZero) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "1", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "1", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -486,8 +486,8 @@ TEST(ShowCrashReports, testBssOverrunCrash) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "2", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "2", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -565,8 +565,8 @@ TEST(ShowCrashReports, testNpeCrash) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "7", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "7", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -625,8 +625,8 @@ TEST(ShowCrashReports, testDataOverrunCrash) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "4", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "4", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
@ -680,8 +680,8 @@ TEST(ShowCrashReports, testNpeCrashAfterFinalize) {
|
|||
if (!pid) {
|
||||
dup2(fds[1], 1);
|
||||
dup2(fds[1], 2);
|
||||
execv(program_executable_name,
|
||||
(char *const[]){program_executable_name, "8", 0});
|
||||
execv(GetProgramExecutableName(),
|
||||
(char *const[]){GetProgramExecutableName(), "8", 0});
|
||||
_exit(127);
|
||||
}
|
||||
close(fds[1]);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
PKGS += TEST_LIBC_MEM
|
||||
|
||||
TEST_LIBC_MEM_FILES := $(wildcard test/libc/mem/*)
|
||||
TEST_LIBC_MEM_SRCS = $(TEST_LIBC_MEM_SRCS_C) $(TEST_LIBC_MEM_SRCS_CC)
|
||||
TEST_LIBC_MEM_SRCS_C = $(filter %_test.c,$(TEST_LIBC_MEM_FILES))
|
||||
TEST_LIBC_MEM_SRCS_CC = $(filter %_test.cc,$(TEST_LIBC_MEM_FILES))
|
||||
|
||||
|
@ -12,7 +13,7 @@ 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_C:%.c=o/$(MODE)/%.com) \
|
||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com)
|
||||
|
||||
TEST_LIBC_MEM_BINS = \
|
||||
|
@ -20,7 +21,7 @@ TEST_LIBC_MEM_BINS = \
|
|||
$(TEST_LIBC_MEM_COMS:%=%.dbg)
|
||||
|
||||
TEST_LIBC_MEM_TESTS = \
|
||||
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.ok) \
|
||||
$(TEST_LIBC_MEM_SRCS_C:%.c=o/$(MODE)/%.com.ok) \
|
||||
$(TEST_LIBC_MEM_SRCS_CC:%.cc=o/$(MODE)/%.com.ok)
|
||||
|
||||
TEST_LIBC_MEM_CHECKS = \
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue