test/unit/test_analysis_var: Use types DB from the build dir.

This commit is contained in:
Gleb Popov 2023-07-03 18:54:30 +03:00 committed by Anton Kochkov
parent fe8ed0bfbe
commit 30ba928f54
4 changed files with 6 additions and 3 deletions

View file

@ -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',

View file

@ -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_ */

View file

@ -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"
@ -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);

View file

@ -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) {
@ -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;