cue: implement EXTRA..EXTRA5 to set additional make args; add test

This commit is contained in:
Ralph Lange
2020-06-08 11:42:07 +02:00
parent 99619b5b90
commit 590e0e4d26
2 changed files with 20 additions and 2 deletions

View File

@@ -681,8 +681,6 @@ class TestSetupForBuild(unittest.TestCase):
sp.check_call(['choco', 'install', 'make'])
def setUp(self):
os.environ.pop('EPICS_HOST_ARCH', None)
cue.clear_lists()
if ci_service == 'appveyor':
os.environ['CONFIGURATION'] = 'default'
cue.detect_context()
@@ -810,6 +808,16 @@ class TestSetupForBuild(unittest.TestCase):
cue.setup_for_build(self.args)
self.assertTrue(cue.has_test_results, 'Target test-results not detected')
def test_ExtraMakeArgs(self):
os.environ['EXTRA'] = 'bla'
for ind in range(1,5):
os.environ['EXTRA{0}'.format(ind)] = 'bla {0}'.format(ind)
cue.setup_for_build(self.args)
self.assertTrue(cue.extra_makeargs[0] == 'bla', 'Extra make arg [0] not set')
for ind in range(1,5):
self.assertTrue(cue.extra_makeargs[ind] == 'bla {0}'.format(ind),
'Extra make arg [{0}] not set (expected "bla {0}", found "{1}")'
.format(ind, cue.extra_makeargs[ind]))
if __name__ == "__main__":
if 'VV' in os.environ and os.environ['VV'] == '1':

10
cue.py
View File

@@ -73,6 +73,7 @@ seen_setups = []
modules_to_compile = []
setup = {}
places = {}
extra_makeargs = []
is_base314 = False
is_make3 = False
@@ -85,6 +86,7 @@ def clear_lists():
global is_base314, has_test_results, silent_dep_builds, is_make3
del seen_setups[:]
del modules_to_compile[:]
del extra_makeargs[:]
setup.clear()
places.clear()
is_base314 = False
@@ -328,6 +330,7 @@ def call_make(args=[], **kws):
place = kws.get('cwd', os.getcwd())
parallel = kws.pop('parallel', 2)
silent = kws.pop('silent', False)
use_extra = kws.pop('use_extra', False)
# no parallel make for Base 3.14
if parallel <= 0 or is_base314:
makeargs = []
@@ -337,6 +340,8 @@ def call_make(args=[], **kws):
makeargs += ['-Otarget']
if silent:
makeargs += ['-s']
if use_extra:
makeargs += extra_makeargs
logger.debug("EXEC '%s' in %s", ' '.join(['make'] + makeargs + args), place)
sys.stdout.flush()
exitcode = sp.call(['make'] + makeargs + args, **kws)
@@ -606,6 +611,11 @@ def setup_for_build(args):
os.environ['PATH'] = os.pathsep.join([os.environ['PATH']] + addpaths)
# Add EXTRA make arguments
for tag in ['EXTRA', 'EXTRA1', 'EXTRA2', 'EXTRA3', 'EXTRA4', 'EXTRA5']:
if tag in os.environ:
extra_makeargs.append(os.environ[tag])
def prepare(args):
host_info()