Skip to content

Commit

Permalink
Merge pull request easybuilders#4704 from smoors/fix_dry-run
Browse files Browse the repository at this point in the history
change semantics of `--dry-run`, so it doesn't imply `--robot`
  • Loading branch information
Micket authored Nov 22, 2024
2 parents 6db0a64 + d2e62d4 commit 34466de
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion easybuild/tools/robot.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ def dry_run(easyconfigs, modtool, short=False):
:param short: use short format for overview: use a variable for common prefixes
"""
lines = []
if build_option('robot_path') is None:
if build_option('robot') is None:
lines.append("Dry run: printing build status of easyconfigs")
all_specs = easyconfigs
else:
Expand Down
1 change: 1 addition & 0 deletions test/framework/easyconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -3747,6 +3747,7 @@ def test_hidden_toolchain(self):
args = [
ec_file,
'--dry-run',
'--robot',
]
outtxt = self.eb_main(args, raise_error=True)
self.assertTrue(re.search(r'module: GCC/\.4\.9\.2', outtxt))
Expand Down
30 changes: 29 additions & 1 deletion test/framework/options.py
Original file line number Diff line number Diff line change
Expand Up @@ -1564,12 +1564,15 @@ def test_copy_ec_from_commit(self):

def test_dry_run(self):
"""Test dry run (long format)."""

# first test with --robot
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
os.close(fd)

args = [
'gzip-1.4-GCC-4.6.3.eb',
'--dry-run', # implies enabling dependency resolution
'--dry-run',
'--robot', # implies enabling dependency resolution
'--unittest-file=%s' % self.logfile,
]
with self.mocked_stdout_stderr():
Expand All @@ -1586,6 +1589,24 @@ def test_dry_run(self):
regex = re.compile(r" \* \[%s\] \S+%s \(module: %s\)" % (mark, ec, mod), re.M)
self.assertTrue(regex.search(logtxt), "Found match for pattern %s in '%s'" % (regex.pattern, logtxt))

# next test without --robot
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
os.close(fd)

args = [
'gzip-1.4-GCC-4.6.3.eb',
'--dry-run',
'--unittest-file=%s' % self.logfile,
]
self.eb_main(args, logfile=dummylogfn)
logtxt = read_file(self.logfile)

info_msg = r"Dry run: printing build status of easyconfigs"
self.assertTrue(re.search(info_msg, logtxt, re.M), "Info message dry running in '%s'" % logtxt)
ec, mod, mark = ("gzip-1.4-GCC-4.6.3.eb", "gzip/1.4-GCC-4.6.3", ' ')
regex = re.compile(r" \* \[%s\] \S+%s \(module: %s\)" % (mark, ec, mod), re.M)
self.assertTrue(regex.search(logtxt), "Found match for pattern %s in '%s'" % (regex.pattern, logtxt))

def test_missing(self):
"""Test use of --missing/-M."""

Expand Down Expand Up @@ -1740,6 +1761,7 @@ def test_try_toolchain_mapping(self):
gzip_ec,
'--try-toolchain=iccifort,2016.1.150-GCC-4.9.3-2.25',
'--dry-run',
'--robot',
]

# by default, toolchain mapping is enabled
Expand Down Expand Up @@ -1796,6 +1818,7 @@ def test_try_update_deps(self):
'--try-toolchain-version=6.4.0-2.28',
'--try-update-deps',
'-D',
'--robot',
]

with self.mocked_stdout_stderr():
Expand Down Expand Up @@ -1880,6 +1903,7 @@ def test_dry_run_hierarchical(self):
'gzip-1.5-foss-2018a.eb',
'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb',
'--dry-run',
'--robot',
'--unittest-file=%s' % self.logfile,
'--module-naming-scheme=HierarchicalMNS',
'--ignore-osdeps',
Expand Down Expand Up @@ -1921,6 +1945,7 @@ def test_dry_run_categorized(self):
'gzip-1.5-foss-2018a.eb',
'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb',
'--dry-run',
'--robot',
'--unittest-file=%s' % self.logfile,
'--module-naming-scheme=CategorizedHMNS',
'--ignore-osdeps',
Expand Down Expand Up @@ -2232,6 +2257,7 @@ def test_from_commit(self):
args = [
'--from-commit=%s' % test_commit,
'--dry-run',
'--robot',
'--tmpdir=%s' % tmpdir,
'--include-easyblocks=' + os.path.join(self.test_prefix, 'easyblocks', '*.py'),
]
Expand Down Expand Up @@ -3098,6 +3124,7 @@ def test_hide_toolchains(self):
args = [
ec_file,
'--dry-run',
'--robot',
'--hide-toolchains=GCC',
]
with self.mocked_stdout_stderr():
Expand Down Expand Up @@ -4362,6 +4389,7 @@ def test_minimal_toolchains(self):
'--minimal-toolchains',
'--module-naming-scheme=HierarchicalMNS',
'--dry-run',
'--robot',
]
self.mock_stdout(True)
self.eb_main(args, do_build=True, raise_error=True, testing=False)
Expand Down

0 comments on commit 34466de

Please sign in to comment.