From b1b98a30d8ea64311d94f734e9c47a471da0b3d3 Mon Sep 17 00:00:00 2001 From: Edd Barrett Date: Thu, 1 Feb 2018 14:33:09 +0000 Subject: [PATCH] Fix tests. --- krun.py | 6 +++++- krun/tests/test_util.py | 6 ++++-- krun/util.py | 7 ------- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/krun.py b/krun.py index fe145ea..6339e94 100755 --- a/krun.py +++ b/krun.py @@ -286,7 +286,11 @@ def inner_main(mailer, on_first_invocation, config, args): # Create the instrumentation directory if required if on_first_invocation: - util.make_instr_dir(config) + # We only want make a dir if >=1 VM is in instrumentation mode. + for vm in config.VMS.itervalues(): + if vm['vm_def'].instrument: + util.make_instr_dir(config) + break debug("Checking platform preliminaries") platform.check_preliminaries() diff --git a/krun/tests/test_util.py b/krun/tests/test_util.py index 53e1190..c4624c1 100644 --- a/krun/tests/test_util.py +++ b/krun/tests/test_util.py @@ -39,7 +39,8 @@ check_and_parse_execution_results, run_shell_cmd, run_shell_cmd_bench, get_git_version, ExecutionFailed, get_session_info, run_shell_cmd_list, FatalKrunError, - stash_envlog, dump_instr_json, RerunExecution) + stash_envlog, dump_instr_json, RerunExecution, + make_instr_dir) from krun.tests.mocks import MockMailer from krun.tests import TEST_DIR from krun.config import Config @@ -428,8 +429,9 @@ def test_stash_envlog0001(mock_platform): def test_dump_instr_json0001(): path = os.path.join(TEST_DIR, "example.krun") config = Config(path) - instr_data = {k: ord(k) for k in "abcdef"} + + make_instr_dir(config) dump_instr_json("bench:vm:variant", 666, config, instr_data) dump_dir = os.path.join(TEST_DIR, "example_instr_data") diff --git a/krun/util.py b/krun/util.py index b1c4abd..dadc3e9 100644 --- a/krun/util.py +++ b/krun/util.py @@ -447,13 +447,6 @@ def get_instr_json_dir(config): def make_instr_dir(config): - # We only want make a dir if >=1 VM is in instrumentation mode. - for vm in config.VMS.itervalues(): - if vm['vm_def'].instrument: - break - else: - return # no VM is in instrumentation mode. - dir = get_instr_json_dir(config) debug("making instrumentation dir: %s" % dir) os.mkdir(dir)