blob: e4d0ac310ee89189b3b60f21777bde377b96abbc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
|
From a5d2b7cf73540f723f4ec30fd18803fbb258a5ff Mon Sep 17 00:00:00 2001
From: Jonathon Reinhart <Jonathon.Reinhart@gmail.com>
Date: Sat, 17 Oct 2015 08:53:49 -0400
Subject: [PATCH] tests: create libunicorn.so.0 symlink
This hack allows the unit tests to link against libunicorn, after
the SONAME was added in 4860fdb3.
Becuase libunicorn.so has an SONAME of libunicorn.so.0, the linker uses
the SONAME for the DT_NEEDED entry of the tests. But because a library
with that name does not exist, they would fail to run. This symlink
works around that issue, without touching the toplevel Makefile.
---
tests/unit/.gitignore | 2 ++
tests/unit/Makefile | 5 ++++-
2 files changed, 6 insertions(+), 1 deletion(-)
diff --git a/tests/unit/.gitignore b/tests/unit/.gitignore
index 39d66b1..7a2c8b3 100644
--- a/tests/unit/.gitignore
+++ b/tests/unit/.gitignore
@@ -1,3 +1,5 @@
test_x86
test_mem_map
test_sanity
+*.so
+*.so.*
diff --git a/tests/unit/Makefile b/tests/unit/Makefile
index ae66d08..fe0e58f 100644
--- a/tests/unit/Makefile
+++ b/tests/unit/Makefile
@@ -14,7 +14,7 @@ clean:
rm -rf ${ALL_TESTS}
.PHONY: test
-test: export LD_LIBRARY_PATH=../../
+test: export LD_LIBRARY_PATH=.
test: ${ALL_TESTS}
./test_sanity
./test_x86
@@ -23,9 +23,12 @@ test: ${ALL_TESTS}
test_sanity: test_sanity.c
test_x86: test_x86.c
test_mem_map: test_mem_map.c
+${ALL_TESTS}: libunicorn.so.0
${ALL_TESTS}:
gcc ${CFLAGS} -o $@ $^
+libunicorn.so.0:
+ ln -s ../../libunicorn.so $@
|