From b3af14e545ab56c702fc23f75bd94dfb7a12749d Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Thu, 19 May 2022 16:44:16 -0400 Subject: Add tests for additional database versions --- suite/binaries | 2 +- suite/testcommon.py | 32 ++++++++++++++++++-------------- 2 files changed, 19 insertions(+), 15 deletions(-) diff --git a/suite/binaries b/suite/binaries index 5c5ebfc1..e0e9b5f9 160000 --- a/suite/binaries +++ b/suite/binaries @@ -1 +1 @@ -Subproject commit 5c5ebfc1f1ff82ff1d0358d08e744a1becaa04be +Subproject commit e0e9b5f96a5aba1c02f7c75fecb0b9fcf0f40f65 diff --git a/suite/testcommon.py b/suite/testcommon.py index 3c9fc28e..788e0f39 100644 --- a/suite/testcommon.py +++ b/suite/testcommon.py @@ -1931,22 +1931,26 @@ class VerifyBuilder(Builder): callback_should_run = False def test_load_old_database(self): - """Load a database produced by Binary Ninja v1.2.1921""" - file_name = self.unpackage_file("binja_v1.2.1921_bin_ls.bndb") - if not os.path.exists(file_name): - return False + """Load a database produced by older versions of Binary Ninja""" + for version in ["binja_v1.2.1921_bin_ls.bndb", "binja_v2.2.2487_bin_ls.bndb", "binja_v2.5.3112_bin_ls.bndb"]: + file_name = self.unpackage_file(version) + if not os.path.exists(file_name): + return False - binja.Settings().set_bool("analysis.database.suppressReanalysis", True) - ret = None - with BinaryViewType.get_view_of_file_with_options(file_name) as bv: - if bv is None: - ret = False - if bv.file.snapshot_data_applied_without_error: - ret = True + binja.Settings().set_bool("analysis.database.suppressReanalysis", True) + ret = None + with BinaryViewType.get_view_of_file_with_options(file_name) as bv: + if bv is None: + ret = False + if bv.file.snapshot_data_applied_without_error: + ret = True - binja.Settings().reset("analysis.database.suppressReanalysis") - self.delete_package("binja_v1.2.1921_bin_ls.bndb") - return ret + binja.Settings().reset("analysis.database.suppressReanalysis") + self.delete_package(version) + + if not ret: + return ret + return True def test_struct_type_leakage(self): """ -- cgit v1.3.1