summaryrefslogtreecommitdiff
path: root/dev-util/rizin/files/rizin-0.3.0-typedb-prefix.patch
blob: dfb86447df714e5b1d47d278fafbe8eed189431f (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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
https://github.com/rizinorg/rizin/issues/1789

Signed-off-by: Florian Märkl <info@florianmaerkl.de>

diff --git a/test/unit/test_serialize_analysis.c b/test/unit/test_serialize_analysis.c
index 51092c067..0d714ba90 100644
--- a/test/unit/test_serialize_analysis.c
+++ b/test/unit/test_serialize_analysis.c
@@ -546,7 +546,10 @@ Sdb *vars_ref_db() {
 }
 
 bool test_analysis_var_save() {
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	RzAnalysis *analysis = rz_analysis_new();
 	rz_analysis_use(analysis, "x86");
 	rz_analysis_set_bits(analysis, 64);
diff --git a/test/unit/test_type.c b/test/unit/test_type.c
index d8a3d9c5f..3956a800b 100644
--- a/test/unit/test_type.c
+++ b/test/unit/test_type.c
@@ -379,7 +379,10 @@ static bool test_enum_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -417,7 +420,10 @@ static bool test_const_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -469,7 +475,10 @@ static bool test_type_as_string(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -516,7 +525,10 @@ static bool test_array_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -569,7 +581,10 @@ static bool test_struct_func_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -659,7 +674,10 @@ static bool test_struct_array_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -707,7 +725,10 @@ static bool test_struct_identifier_without_specifier(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -735,7 +756,10 @@ static bool test_union_identifier_without_specifier(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;
@@ -767,7 +791,10 @@ static bool test_edit_types(void) {
 	RzTypeDB *typedb = rz_type_db_new();
 	mu_assert_notnull(typedb, "Couldn't create new RzTypeDB");
 	mu_assert_notnull(typedb->types, "Couldn't create new types hashtable");
-	const char *dir_prefix = rz_sys_prefix(NULL);
+	const char *dir_prefix = getenv("RZ_PREFIX");
+	if (!dir_prefix) {
+		dir_prefix = rz_sys_prefix(NULL);
+	}
 	rz_type_db_init(typedb, dir_prefix, "x86", 64, "linux");
 
 	char *error_msg = NULL;