Skip to content

Commit d2e62d4

Browse files
author
Samuel Moors
committed
fix --dry-run without --robot
1 parent 6fcfe97 commit d2e62d4

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

easybuild/tools/robot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ def dry_run(easyconfigs, modtool, short=False):
242242
:param short: use short format for overview: use a variable for common prefixes
243243
"""
244244
lines = []
245-
if build_option('robot_path') is None:
245+
if build_option('robot') is None:
246246
lines.append("Dry run: printing build status of easyconfigs")
247247
all_specs = easyconfigs
248248
else:

test/framework/easyconfig.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3747,6 +3747,7 @@ def test_hidden_toolchain(self):
37473747
args = [
37483748
ec_file,
37493749
'--dry-run',
3750+
'--robot',
37503751
]
37513752
outtxt = self.eb_main(args, raise_error=True)
37523753
self.assertTrue(re.search(r'module: GCC/\.4\.9\.2', outtxt))

test/framework/options.py

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1564,12 +1564,15 @@ def test_copy_ec_from_commit(self):
15641564

15651565
def test_dry_run(self):
15661566
"""Test dry run (long format)."""
1567+
1568+
# first test with --robot
15671569
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
15681570
os.close(fd)
15691571

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

1592+
# next test without --robot
1593+
fd, dummylogfn = tempfile.mkstemp(prefix='easybuild-dummy', suffix='.log')
1594+
os.close(fd)
1595+
1596+
args = [
1597+
'gzip-1.4-GCC-4.6.3.eb',
1598+
'--dry-run',
1599+
'--unittest-file=%s' % self.logfile,
1600+
]
1601+
self.eb_main(args, logfile=dummylogfn)
1602+
logtxt = read_file(self.logfile)
1603+
1604+
info_msg = r"Dry run: printing build status of easyconfigs"
1605+
self.assertTrue(re.search(info_msg, logtxt, re.M), "Info message dry running in '%s'" % logtxt)
1606+
ec, mod, mark = ("gzip-1.4-GCC-4.6.3.eb", "gzip/1.4-GCC-4.6.3", ' ')
1607+
regex = re.compile(r" \* \[%s\] \S+%s \(module: %s\)" % (mark, ec, mod), re.M)
1608+
self.assertTrue(regex.search(logtxt), "Found match for pattern %s in '%s'" % (regex.pattern, logtxt))
1609+
15891610
def test_missing(self):
15901611
"""Test use of --missing/-M."""
15911612

@@ -1740,6 +1761,7 @@ def test_try_toolchain_mapping(self):
17401761
gzip_ec,
17411762
'--try-toolchain=iccifort,2016.1.150-GCC-4.9.3-2.25',
17421763
'--dry-run',
1764+
'--robot',
17431765
]
17441766

17451767
# by default, toolchain mapping is enabled
@@ -1796,6 +1818,7 @@ def test_try_update_deps(self):
17961818
'--try-toolchain-version=6.4.0-2.28',
17971819
'--try-update-deps',
17981820
'-D',
1821+
'--robot',
17991822
]
18001823

18011824
with self.mocked_stdout_stderr():
@@ -1880,6 +1903,7 @@ def test_dry_run_hierarchical(self):
18801903
'gzip-1.5-foss-2018a.eb',
18811904
'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb',
18821905
'--dry-run',
1906+
'--robot',
18831907
'--unittest-file=%s' % self.logfile,
18841908
'--module-naming-scheme=HierarchicalMNS',
18851909
'--ignore-osdeps',
@@ -1921,6 +1945,7 @@ def test_dry_run_categorized(self):
19211945
'gzip-1.5-foss-2018a.eb',
19221946
'OpenMPI-2.1.2-GCC-6.4.0-2.28.eb',
19231947
'--dry-run',
1948+
'--robot',
19241949
'--unittest-file=%s' % self.logfile,
19251950
'--module-naming-scheme=CategorizedHMNS',
19261951
'--ignore-osdeps',
@@ -2232,6 +2257,7 @@ def test_from_commit(self):
22322257
args = [
22332258
'--from-commit=%s' % test_commit,
22342259
'--dry-run',
2260+
'--robot',
22352261
'--tmpdir=%s' % tmpdir,
22362262
'--include-easyblocks=' + os.path.join(self.test_prefix, 'easyblocks', '*.py'),
22372263
]
@@ -3098,6 +3124,7 @@ def test_hide_toolchains(self):
30983124
args = [
30993125
ec_file,
31003126
'--dry-run',
3127+
'--robot',
31013128
'--hide-toolchains=GCC',
31023129
]
31033130
with self.mocked_stdout_stderr():
@@ -4362,6 +4389,7 @@ def test_minimal_toolchains(self):
43624389
'--minimal-toolchains',
43634390
'--module-naming-scheme=HierarchicalMNS',
43644391
'--dry-run',
4392+
'--robot',
43654393
]
43664394
self.mock_stdout(True)
43674395
self.eb_main(args, do_build=True, raise_error=True, testing=False)

0 commit comments

Comments
 (0)