Skip to content

Commit

Permalink
Fix for Issue #388 which broke executable reproducibility (#389)
Browse files Browse the repository at this point in the history
* Fixed #388. Bug was due to a break rather than continue in Manifest
setup. Links for other mainfests weren't created if scaninputs=True.
* Modified existing test to trigger error. Test now passes.
  • Loading branch information
aidanheerdegen committed Nov 30, 2023
1 parent 9523ae3 commit 0623008
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
2 changes: 1 addition & 1 deletion payu/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ def setup(self):
if self.have_manifest[mf]:
# Don't make links for inputs when scaninputs is True
if mf == 'input' and self.scaninputs:
break
continue
print('Making {} links'.format(mf))
self.manifests[mf].make_links()
else:
Expand Down
13 changes: 11 additions & 2 deletions test/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,14 +154,21 @@ def test_exe_reproduce():

# Set reproduce exe to True
config['manifest']['reproduce']['exe'] = True
# Also set scaninputs to True to catch bug #388
config['manifest']['scaninputs'] = True
write_config(config)
manifests = get_manifests(ctrldir/'manifests')

# Run setup with unchanged exe but reproduce exe set to True.
# Should run without error
payu_setup(lab_path=str(labdir))

local_exe_path = list(manifests['exe.yaml'].keys())[0]

assert(manifests == get_manifests(ctrldir/'manifests'))
assert((ctrldir / local_exe_path).exists())
assert(Path(manifests['exe.yaml'][local_exe_path]['fullpath']) ==
(ctrldir / local_exe_path).resolve())

bindir = labdir / 'bin'
exe = config['exe']
Expand Down Expand Up @@ -222,6 +229,8 @@ def test_input_reproduce():
# Set reproduce input to True
config['manifest']['reproduce']['exe'] = False
config['manifest']['reproduce']['input'] = True
# Set back to false
config['manifest']['scaninputs'] = False
config['exe'] = config_orig['exe']
write_config(config)
manifests = get_manifests(ctrldir/'manifests')
Expand Down Expand Up @@ -266,8 +275,8 @@ def test_input_reproduce():
with pytest.raises(SystemExit) as pytest_wrapped_e:
payu_setup(lab_path=str(labdir))

assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1
assert pytest_wrapped_e.type == SystemExit
assert pytest_wrapped_e.value.code == 1

# Change reproduce input back to False
config['manifest']['reproduce']['input'] = False
Expand Down

0 comments on commit 0623008

Please sign in to comment.