Skip to content

Commit ee74137

Browse files
committed
Fix test for test_process_cache
1 parent 8d1569d commit ee74137

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

kernel_tuner/util.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1289,7 +1289,8 @@ def process_cache(cachefile, kernel_options, tuning_options, runner):
12891289

12901290
# if in simulation mode, use the device name from the cache file as the runner device name
12911291
if runner.simulation_mode:
1292-
runner.dev.name = cached_data["device_name"]
1292+
device_name = cached_data["device_name"]
1293+
runner.dev.name = device_name # Is this always safe?
12931294

12941295
# check if it is safe to continue tuning from this cache
12951296
if cached_data["device_name"] != device_name:

test/test_util_functions.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,6 +672,12 @@ def verify2(answer, result_host, atol):
672672
assert v(1, 2, atol=3)
673673

674674

675+
class MockRunner:
676+
simulation_mode = False
677+
678+
def get_device_info(self):
679+
return Options(name="test_device")
680+
675681
def test_process_cache():
676682
def assert_open_cachefile_is_correctly_parsed(cache):
677683
with open(cache, "r") as cachefile:
@@ -694,7 +700,7 @@ def assert_open_cachefile_is_correctly_parsed(cache):
694700
simulation_mode=False,
695701
objective="time",
696702
)
697-
runner = Options(dev=Options(name="test_device"), simulation_mode=False)
703+
runner = MockRunner()
698704

699705
try:
700706
# call process_cache without pre-existing cache

0 commit comments

Comments
 (0)