mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-07 02:10:27 +00:00
Move most init back into SetUpOnce
This commit is contained in:
parent
5ea567697d
commit
2869605486
1 changed files with 32 additions and 33 deletions
|
@ -35,16 +35,10 @@
|
|||
#include "libc/testlib/testlib.h"
|
||||
|
||||
static char *self;
|
||||
static bool skiptests, skiparg0;
|
||||
static bool loaded, skiptests, skiparg0;
|
||||
|
||||
void SetUpOnce(void) {
|
||||
testlib_enable_tmp_setup_teardown();
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
||||
if (argc < 2 || strcmp(argv[1], "Child")) {
|
||||
bool loaded = !!__program_executable_name;
|
||||
self = GetProgramExecutableName();
|
||||
if (IsMetal()) {
|
||||
skiptests = true;
|
||||
} else if (IsWindows()) {
|
||||
|
@ -72,7 +66,12 @@ __attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
|||
} else if (skiparg0) {
|
||||
fprintf(stderr, "skipping argv[0] tests\n");
|
||||
}
|
||||
} else {
|
||||
}
|
||||
|
||||
__attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
||||
loaded = !!__program_executable_name;
|
||||
self = GetProgramExecutableName();
|
||||
if (argc >= 2 && !strcmp(argv[1], "Child")) {
|
||||
int rc;
|
||||
if (!IsWindows()) {
|
||||
rc = sys_chdir("/");
|
||||
|
@ -82,7 +81,7 @@ __attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
|||
if (rc) {
|
||||
exit(122);
|
||||
}
|
||||
if (strcmp(argv[2], GetProgramExecutableName())) {
|
||||
if (strcmp(argv[2], self)) {
|
||||
exit(123);
|
||||
}
|
||||
if (argc >= 4) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue