]> xenbits.xensource.com Git - people/iwj/ring3-xl-test.git/commitdiff
Remove dynamic test loading
authorEuan Harris <euan.harris@citrix.com>
Thu, 18 Jun 2015 16:44:34 +0000 (16:44 +0000)
committerEuan Harris <euan.harris@citrix.com>
Thu, 18 Jun 2015 16:44:34 +0000 (16:44 +0000)
Unnecessary complexity

Signed-off-by: Euan Harris <euan.harris@citrix.com>
Makefile
async_test.c

index d5b87d8254413632a53c7fef179440312bda1701..0c5ada4a78773b32c8b406c02f2a341007a2088d 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,25 +1,20 @@
 SRCS = testcase_runner.c eventloop_runner.c testcase_utils.c async_test.c
 CFLAGS = -Wall -Wextra -Werror -pedantic -g
-LDFLAGS = -Wl,-export-dynamic
 LDLIBS = -pthread -lxenctrl -lxlutil -lxenlight -ldl
 TESTS = $(wildcard test_*.c)
 ALL_SRCS = $(SRCS) $(TESTS)
 
 .PHONY: all
-all: async_test $(TESTS:.c=.so)
-async_test: $(SRCS:.c=.o)
+all: $(TESTS:.c=)
 
-
-test_%.o: CFLAGS += -fPIC
-
-test_%.so: test_%.o
-       $(CC) -shared $< -o $@
+test_%: $(SRCS:.c=.o) test_%.o
+       $(CC) $(LDFLAGS) $(LDLIBS) $^ -o $@
 
 %.d: %.c
        $(CC) -M $< > $@
 
 .PHONY: clean
 clean:
-       rm -f $(ALL_SRCS:.c=.o) $(ALL_SRCS:.c=.d) $(TESTS:.c=.so) async_test
+       rm -f $(ALL_SRCS:.c=.o) $(ALL_SRCS:.c=.d) $(TESTS:.c=)
 
 -include $(ALL_SRCS:.c=.d)
index c717187565bfdafb9f9a297d63da51ef4549c777..564753681e7a879f6d7ad85276c84d83342ec117 100644 (file)
@@ -5,42 +5,13 @@
 #include "testcase_runner.h"
 #include "eventloop_runner.h"
 
-int main(int argc, char **argv)
+void *testcase(struct test *tc);
+
+int main(int argc __attribute__((unused)), 
+         char **argv __attribute__((unused)))
 {
     struct test t;
     xentoollog_logger *logger;
-    char *test_path;
-    void *test_plugin;
-    void *(*testcase) (struct test *);
-
-    if (argc != 2) {
-        fprintf(stderr, "Usage: %s <testcase>\n", argv[0]);
-        exit(EXIT_FAILURE);
-    }
-
-    /* dlopen only looks outside the standard library directories
-       if the path contains a slash.   Resolve the real path to
-       the test file, to ensure that this is the case. */
-    test_path = realpath(argv[1], NULL);
-    if (!test_path) {
-        perror(argv[1]);
-        exit(EXIT_FAILURE);
-    }
-
-    test_plugin = dlopen(test_path, RTLD_NOW);
-    free(test_path);
-    if (!test_plugin) {
-        fprintf(stderr, "%s\n", dlerror());
-        exit(EXIT_FAILURE);
-    }
-    dlerror();
-
-    *(void **)(&testcase) = dlsym(test_plugin, "testcase");
-    if (!testcase) {
-        fprintf(stderr, "%s\n", dlerror());
-        exit(EXIT_FAILURE);
-    }
-    dlerror();
 
     logger = (xentoollog_logger *)
         xtl_createlogger_stdiostream(stderr, XTL_PROGRESS, 0);
@@ -57,7 +28,6 @@ int main(int argc, char **argv)
     fprintf(stderr, "Test thread exited\n");
     test_destroy(&t);
     xtl_logger_destroy(logger);
-    dlclose(test_plugin);
 
     exit(EXIT_SUCCESS);
 }