summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChinmay <chinmay1dd@gmail.com>2020-09-10 09:25:20 -0700
committerChinmay <chinmay1dd@gmail.com>2020-09-10 10:12:31 -0700
commit6b036f75273ff4b8ac1130d7524b320be096c15b (patch)
tree26b1ea33029973b6229b011316323e1330f8d89d
parent167ced17956bbb79aee3a6e6ef88079d822427cb (diff)
Fix Windows file deletion issue in tests
-rw-r--r--python/function.py4
-rw-r--r--suite/testcommon.py23
2 files changed, 18 insertions, 9 deletions
diff --git a/python/function.py b/python/function.py
index bf5afb87..ffec3452 100644
--- a/python/function.py
+++ b/python/function.py
@@ -450,12 +450,12 @@ class PossibleValueSet(object):
result.table.append(LookupTableEntry(from_list, result.table[i].toValue))
result.count = self.count
elif (self.type == RegisterValueType.InSetOfValues) or (self.type == RegisterValueType.NotInSetOfValues):
- values = (ctypes.c_long * self.count)()
+ values = (ctypes.c_longlong * self.count)()
i = 0
for value in self.values:
values[i] = value
i += 1
- result.valueSet = ctypes.cast(values, ctypes.POINTER(ctypes.c_long))
+ result.valueSet = ctypes.cast(values, ctypes.POINTER(ctypes.c_longlong))
result.count = self.count
return result
diff --git a/suite/testcommon.py b/suite/testcommon.py
index 14a991a5..036dc8ac 100644
--- a/suite/testcommon.py
+++ b/suite/testcommon.py
@@ -1323,7 +1323,6 @@ class VerifyBuilder(Builder):
# test bndb round trip
temp_name = next(tempfile._get_candidate_names()) + ".bndb"
bv.create_database(temp_name)
- bv.file.close()
with binja.open_view(temp_name) as bv:
func = bv.get_function_at(0x00008440)
@@ -1356,10 +1355,14 @@ class VerifyBuilder(Builder):
found = True
assert(found)
- bv.file.close()
-
- os.unlink(temp_name)
- # Check retrieval of user variable values
+ for i in range(5):
+ try:
+ time.sleep(1)
+ os.unlink(temp_name)
+ break
+ except OSError:
+ print("Failed to remove file {}".format(temp_name))
+ continue
return True
finally:
self.delete_package("helloworld")
@@ -1401,9 +1404,15 @@ class VerifyBuilder(Builder):
assert(def_ins.get_possible_reg_values_after('r3') == value)
- os.unlink(temp_name)
+ for i in range(5):
+ try:
+ time.sleep(1)
+ os.unlink(temp_name)
+ break
+ except OSError:
+ print("Failed to remove file {}".format(temp_name))
+ continue
return True
-
finally:
self.delete_package("helloworld")