Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
vext01 committed Feb 1, 2018
1 parent a598417 commit b1b98a3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
6 changes: 5 additions & 1 deletion krun.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
6 changes: 4 additions & 2 deletions krun/tests/test_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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")
Expand Down
7 changes: 0 additions & 7 deletions krun/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b1b98a3

Please sign in to comment.