@@ -16,9 +16,6 @@ int main(int argc, char **argv) {
16
16
return 1 ;
17
17
}
18
18
19
- // Set an environment variable before loading the library
20
- setenv ("MUSL_TEST_VAR" , "from_c" , 1 );
21
-
22
19
// Try to load the shared library
23
20
void * handle = dlopen (argv [1 ], RTLD_NOW );
24
21
if (!handle ) {
@@ -35,31 +32,17 @@ int main(int argc, char **argv) {
35
32
}
36
33
test_init ();
37
34
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 ();
56
39
printf ("ARGC_TEST: C=%d Go=%d\n" , argc , go_argc );
57
40
}
58
41
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 );
63
46
if (arg0 && * arg0 ) {
64
47
printf ("ARGV_TEST_SUCCESS: argv[0]=%s\n" , arg0 );
65
48
} else {
0 commit comments