diff options
author | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-04-18 11:37:52 +0200 |
---|---|---|
committer | Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> | 2023-05-30 16:05:06 +0200 |
commit | 5ad6600364f644b70cdb13d1596ec25831ac2449 (patch) | |
tree | 085f540dabdcdd5eb90e1540ba2a40c5525985f1 /src/test | |
parent | shared/loop-util: add comment (diff) | |
download | systemd-5ad6600364f644b70cdb13d1596ec25831ac2449.tar.xz systemd-5ad6600364f644b70cdb13d1596ec25831ac2449.zip |
test-dlopen: allow loading of multiple libraries
This is useful for debugging, for example if we want to test multiple different
dlls being loaded in the same namespace.
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/test-dlopen.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/test/test-dlopen.c b/src/test/test-dlopen.c index 35981ebc3b..9c315373b4 100644 --- a/src/test/test-dlopen.c +++ b/src/test/test-dlopen.c @@ -6,10 +6,14 @@ #include "macro.h" int main(int argc, char **argv) { - void *handle; + void *handles[argc - 1]; + int i; - assert_se(handle = dlopen(argv[1], RTLD_NOW)); - assert_se(dlclose(handle) == 0); + for (i = 0; i < argc - 1; i++) + assert_se(handles[i] = dlopen(argv[i + 1], RTLD_NOW)); + + for (i--; i >= 0; i--) + assert_se(dlclose(handles[i]) == 0); return EXIT_SUCCESS; } |