Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ Execute the remainder of the line using the default command shell.
## Extra arguments to `make`

You can add additional arguments to the make runs that the `cue.py` script
starts. Put your additional arguments into environment variables named
starts for building and testing your main module (`build` and `test`
actions). Put your additional arguments into environment variables named
`EXTRA`, `EXTRA1`, ... `EXTRA5`.

The variables may contain multiple arguments, separated by whitespace.
Expand Down
25 changes: 25 additions & 0 deletions cue-test.py
Original file line number Diff line number Diff line change
Expand Up @@ -977,6 +977,31 @@ def test_ExtraMakeArgs(self):
'Extra make arg [{0}] not set (expected "bla {0}", found "{1}")'
.format(ind, cue.extra_makeargs[ind]))

def test_ExtraMakeArgsUsedForTest(self):
for tag in ['EXTRA', 'EXTRA1', 'EXTRA2', 'EXTRA3', 'EXTRA4', 'EXTRA5']:
os.environ.pop(tag, None)
os.environ['EXTRA'] = 'bla'
os.environ['EXTRA1'] = '"bla 1"'
make_calls = []
orig_call_make = cue.call_make
cue.call_make = lambda args=None, **kws: make_calls.append((args, kws))
try:
for has_test_results in [False, True]:
self.setTestResultsTarget('test-results' if has_test_results else 'not-test-results')
del make_calls[:]
del cue.extra_makeargs[:]
cue.test(self.args)
self.assertEqual(len(make_calls), 1, 'Expected one make call, found {0}'.format(len(make_calls)))
args, kws = make_calls[0]
self.assertTrue(kws.get('use_extra', False),
'Extra make args not used for make {0}'.format(args))
self.assertEqual(cue.extra_makeargs, ['bla', 'bla 1'],
'Extra make args not set (found {0})'.format(cue.extra_makeargs))
finally:
cue.call_make = orig_call_make
os.environ.pop('EXTRA', None)
os.environ.pop('EXTRA1', None)


class TestHooks(unittest.TestCase):
location = os.path.join(cue.ci['cachedir'], 'hook_test')
Expand Down
4 changes: 2 additions & 2 deletions cue.py
Original file line number Diff line number Diff line change
Expand Up @@ -1515,9 +1515,9 @@ def test(args):
setup_for_build(args)
fold_start('test.module', 'Run the main module tests')
if has_test_results:
call_make(['tapfiles'])
call_make(['tapfiles'], use_extra=True)
else:
call_make(['runtests'])
call_make(['runtests'], use_extra=True)
fold_end('test.module', 'Run the main module tests')
else:
print("{0}Action 'test' skipped as per configuration{1}"
Expand Down