Skip to content

Commit

Permalink
test/unit/test_analysis_var: Use types DB from the build dir.
Browse files Browse the repository at this point in the history
  • Loading branch information
arrowd authored and XVilka committed Aug 3, 2023
1 parent fe8ed0b commit 30ba928
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
1 change: 1 addition & 0 deletions test/integration/meson.build
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
if get_option('enable_tests')
test_conf_data = configuration_data()
test_conf_data.set_quoted('RIZIN_BUILD_PATH', rizin_exe.full_path())
test_conf_data.set_quoted('TEST_BUILD_TYPES_DIR', fs.as_posix(types_build_dir))
test_config_h = configure_file(
input: 'test_config.h.in',
output: 'test_config.h',
Expand Down
1 change: 1 addition & 0 deletions test/integration/test_config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,6 @@
#define _TEST_CONFIG_H_

#define RIZIN_BUILD_PATH @RIZIN_BUILD_PATH@
#define TEST_BUILD_TYPES_DIR @TEST_BUILD_TYPES_DIR@

#endif /* _TEST_CONFIG_H_ */
5 changes: 2 additions & 3 deletions test/integration/test_dwarf_integration.c
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <rz_bin.h>
#include <rz_type.h>
#include <rz_util/rz_path.h>
#include "test_config.h"
#include "test_types.h"
#include "../unit/minunit.h"

Expand Down Expand Up @@ -144,9 +145,7 @@ static bool test_dwarf_function_parsing_cpp(void) {
// TODO fix, how to correctly promote binary info to the RzAnalysis in unit tests?
rz_analysis_set_cpu(analysis, "x86");
rz_analysis_set_bits(analysis, 64);
char *types_dir = rz_path_system(RZ_SDB_TYPES);
rz_type_db_init(analysis->typedb, types_dir, "x86", 64, "linux");
free(types_dir);
rz_type_db_init(analysis->typedb, TEST_BUILD_TYPES_DIR, "x86", 64, "linux");

RzBinOptions opt = { 0 };
rz_bin_options_init(&opt, 0, 0, 0, false);
Expand Down
2 changes: 2 additions & 0 deletions test/unit/test_analysis_var.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

#include <rz_analysis.h>
#include <rz_core.h>
#include "test_config.h"
#include "minunit.h"

static bool sanitize_instr_acc(void *user, const ut64 k, const void *v) {
Expand Down Expand Up @@ -290,6 +291,7 @@ bool test_rz_analysis_function_var_expr_for_reg_access_at() {
RzAnalysis *analysis = rz_analysis_new();
rz_analysis_use(analysis, "x86");
rz_analysis_set_bits(analysis, 64);
rz_type_db_init(analysis->typedb, TEST_BUILD_TYPES_DIR, NULL, 64, NULL);

RzAnalysisFunction *fcn = rz_analysis_create_function(analysis, "fcn", 0x100, RZ_ANALYSIS_FCN_TYPE_FCN);
fcn->bp_off = 8;
Expand Down

0 comments on commit 30ba928

Please sign in to comment.