Skip to content

Commit 541f29d

Browse files
committed
test: remove environment sync tests from musl loader
Remove environment variable synchronization tests that were not implemented. The test loader now only tests argc/argv safety and dlopen functionality.
1 parent 220f130 commit 541f29d

File tree

1 file changed

+8
-25
lines changed

1 file changed

+8
-25
lines changed

src/runtime/testdata/musl_loader.c

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@ int main(int argc, char **argv) {
1616
return 1;
1717
}
1818

19-
// Set an environment variable before loading the library
20-
setenv("MUSL_TEST_VAR", "from_c", 1);
21-
2219
// Try to load the shared library
2320
void *handle = dlopen(argv[1], RTLD_NOW);
2421
if (!handle) {
@@ -35,31 +32,17 @@ int main(int argc, char **argv) {
3532
}
3633
test_init();
3734

38-
// Test 2: Check environment variable synchronization
39-
char* (*test_env)(void) = dlsym(handle, "TestEnvSync");
40-
if (!test_env) {
41-
fprintf(stderr, "dlsym TestEnvSync failed: %s\n", dlerror());
42-
dlclose(handle);
43-
return 1;
44-
}
45-
char* env_val = test_env();
46-
if (env_val && strcmp(env_val, "from_c") == 0) {
47-
printf("ENV_SYNC_SUCCESS\n");
48-
} else {
49-
printf("ENV_SYNC_FAIL: got '%s', expected 'from_c'\n", env_val ? env_val : "(null)");
50-
}
51-
52-
// Test 3: Check if argc is accessible
53-
int (*test_argc)(void) = dlsym(handle, "TestArgc");
54-
if (test_argc) {
55-
int go_argc = test_argc();
35+
// Test 2: Check if argc is accessible
36+
int (*get_arg_count)(void) = dlsym(handle, "GetArgCount");
37+
if (get_arg_count) {
38+
int go_argc = get_arg_count();
5639
printf("ARGC_TEST: C=%d Go=%d\n", argc, go_argc);
5740
}
5841

59-
// Test 4: Check if argv is accessible
60-
char* (*test_argv)(int) = dlsym(handle, "TestArgv");
61-
if (test_argv) {
62-
char* arg0 = test_argv(0);
42+
// Test 3: Check if argv is accessible
43+
char* (*get_arg)(int) = dlsym(handle, "GetArg");
44+
if (get_arg) {
45+
char* arg0 = get_arg(0);
6346
if (arg0 && *arg0) {
6447
printf("ARGV_TEST_SUCCESS: argv[0]=%s\n", arg0);
6548
} else {

0 commit comments

Comments
 (0)