mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-10 03:40:29 +00:00
Skip argv[0] tests with old/no loader
This commit is contained in:
parent
580982ea60
commit
c8395bf2f3
1 changed files with 11 additions and 5 deletions
|
@ -29,19 +29,25 @@
|
||||||
|
|
||||||
static char *self;
|
static char *self;
|
||||||
|
|
||||||
void SetUp(void) {
|
|
||||||
self = GetProgramExecutableName();
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetUpOnce(void) {
|
void SetUpOnce(void) {
|
||||||
|
self = GetProgramExecutableName();
|
||||||
testlib_enable_tmp_setup_teardown();
|
testlib_enable_tmp_setup_teardown();
|
||||||
}
|
}
|
||||||
|
|
||||||
__attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
__attribute__((__constructor__)) static void Child(int argc, char *argv[]) {
|
||||||
|
static bool skiparg0tests;
|
||||||
|
if (!__program_executable_name && !IsFreebsd() && !IsNetbsd()) {
|
||||||
|
skiparg0tests = true;
|
||||||
|
if (argc < 2) {
|
||||||
|
fprintf(stderr, "warning: old/no loader; skipping argv[0] tests\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
if (argc >= 2 && !strcmp(argv[1], "Child")) {
|
if (argc >= 2 && !strcmp(argv[1], "Child")) {
|
||||||
ASSERT_EQ(argc, 4);
|
ASSERT_EQ(argc, 4);
|
||||||
EXPECT_STREQ(argv[2], GetProgramExecutableName());
|
EXPECT_STREQ(argv[2], GetProgramExecutableName());
|
||||||
EXPECT_STREQ(argv[3], argv[0]);
|
if (!skiparg0tests) {
|
||||||
|
EXPECT_STREQ(argv[3], argv[0]);
|
||||||
|
}
|
||||||
exit(g_testlib_failed);
|
exit(g_testlib_failed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue