2 $description = "Test the shared object load API.";
4 $details = "Verify the different aspects of the shared object API.";
6 # Don't do anything if this system doesn't support "load"
7 exists $FEATURES{load} or return -1;
9 my $sobuild = '$(CC) '.($srcdir? "-I$srcdir":'').' -g -shared -fPIC -o $@ $<';
11 # First build a shared object
12 # Provide both a default and non-default load symbol
14 unlink(qw(testapi.c testapi.so));
16 open(my $F, '> testapi.c') or die "open: testapi.c: $!\n";
23 int plugin_is_GPL_compatible;
26 test_eval (const char *buf)
33 test_expand (const char *val)
35 return gmk_expand (val);
39 test_noexpand (const char *val)
41 char *str = gmk_alloc (strlen (val));
47 func_test (const char *funcname, unsigned int argc, char **argv)
51 if (strcmp (funcname, "test-expand") == 0)
52 return test_expand (argv[0]);
54 if (strcmp (funcname, "test-eval") == 0)
55 return test_eval (argv[0]);
57 if (strcmp (funcname, "test-noexpand") == 0)
58 return test_noexpand (argv[0]);
60 mem = gmk_alloc (sizeof ("unknown"));
61 strcpy (mem, "unknown");
68 gmk_add_function ("test-expand", func_test, 1, 1, GMK_FUNC_DEFAULT);
69 gmk_add_function ("test-noexpand", func_test, 1, 1, GMK_FUNC_NOEXPAND);
70 gmk_add_function ("test-eval", func_test, 1, 1, GMK_FUNC_DEFAULT);
71 gmk_add_function ("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.", func_test, 0, 0, 0);
75 close($F) or die "close: testapi.c: $!\n";
77 run_make_test('testapi.so: testapi.c ; @'.$sobuild, '', '');
80 # Check the gmk_expand() function
83 all: ; @echo $(test-expand $$(EXPAND))
89 # Check the eval operation. Prove that the argument is expanded only once
93 ASSIGN = VAR = $(TEST) $(shell echo there)
94 $(test-eval $(value ASSIGN))
101 # Check the no-expand capability
105 all:;@echo '$(test-noexpand $(TEST))'
109 unlink(qw(testapi.c testapi.so)) unless $keep;
111 # This tells the test driver that the perl test script executed properly.