def test_HostArchConfiguration(self): cue.ci['compiler'] = 'vs2017' for cue.ci['debug'] in [True, False]: for cue.ci['static'] in [True, False]: config_st = {True: 'static', False: 'shared'} config_db = {True: '-debug', False: '-optimized'} config = config_st[cue.ci['static']] + config_db[cue.ci['debug']] cue.setup_for_build(self.args) self.assertTrue('EPICS_HOST_ARCH' in os.environ, 'EPICS_HOST_ARCH is not set for Configuration={0}'.format(config)) if cue.ci['static']: self.assertTrue(re.search('-static$', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH is not -static for Configuration={0}'.format(config)) self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config)) elif cue.ci['debug']: self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is -static for Configuration={1}' .format(os.environ['EPICS_HOST_ARCH'], config)) self.assertTrue(re.search('-debug$', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is not -debug for Configuration={1}' .format(os.environ['EPICS_HOST_ARCH'], config)) else: self.assertFalse(re.search('static', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH is -static for Configuration={0}'.format(config)) self.assertFalse(re.search('debug', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH is -debug for Configuration={0}'.format(config))
def test_HostArchPlatform(self): if ci_service == 'travis': platforms = ['x64'] else: platforms = ['x86', 'x64'] for platform in platforms: for cc in ['vs2019', 'gcc']: cue.ci['platform'] = platform cue.ci['compiler'] = cc cue.setup_for_build(self.args) self.assertTrue( 'EPICS_HOST_ARCH' in os.environ, 'EPICS_HOST_ARCH is not set for {0} / {1}'.format( cc, cue.ci['platform'])) if platform == 'x86': self.assertTrue( re.search('^win32-x86', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is not win32-x86 for {1} / {2}' .format(os.environ['EPICS_HOST_ARCH'], cc, platform)) else: self.assertTrue( re.search('^windows-x64', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is not windows-x64 for {1} / {2}' .format(os.environ['EPICS_HOST_ARCH'], cc, platform)) if cc == 'gcc': self.assertTrue( re.search('-mingw$', os.environ['EPICS_HOST_ARCH']), 'EPICS_HOST_ARCH (found {0}) is not -mingw for {1} / {2}' .format(os.environ['EPICS_HOST_ARCH'], cc, platform)) pattern = {'x86': 'mingw32', 'x64': 'mingw64'} self.assertTrue( re.search(pattern[platform], os.environ['PATH']), 'Binary location for {0} not in PATH (found {1})'. format(pattern[platform], os.environ['PATH']))
def test_AddPathsOption(self): os.environ['FOOBAR'] = 'BAR' args = Namespace(paths=['/my/{FOOBAR}/dir', '/my/foobar']) cue.setup_for_build(args) self.assertTrue(re.search('/my/BAR/dir', os.environ['PATH']), 'Expanded path not in PATH') self.assertTrue(re.search('/foobar', os.environ['PATH']), 'Plain path not in PATH') os.environ.pop('FOOBAR', None)
def test_StrawberryInPathVS2019(self): if 'APPVEYOR' in os.environ: os.environ['CMP'] = 'vs2019' cue.setup_for_build(self.args) self.assertTrue( re.search('strawberry', os.environ['PATH'], flags=re.IGNORECASE), 'Strawberry Perl installed but location not in PATH (found {0})'. format(os.environ['PATH']))
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]))
def test_DetectionTestResultsTarget314No(self): self.setBase314('YES') self.setTestResultsTarget('nottherighttarget') cue.setup_for_build(self.args) self.assertFalse(cue.has_test_results, 'Falsely detected test-results target')
def test_DetectionBase314Yes(self): self.setBase314('YES') cue.setup_for_build(self.args) self.assertTrue(cue.is_base314, 'Base 3.14 = YES not detected')
def test_DetectionBase314No(self): self.setBase314('NO') cue.setup_for_build(self.args) self.assertFalse(cue.is_base314, 'Falsely detected Base 3.14')
def test_DetectionTestResultsTargetNot314Yes(self): self.setBase314('NO') self.setTestResultsTarget('test-results') cue.setup_for_build(self.args) self.assertTrue(cue.has_test_results, 'Target test-results not detected')
def test_DetectionTestResultsTarget314Yes(self): self.setBase314('YES') self.setTestResultsTarget('test-results') cue.setup_for_build(self.args) self.assertFalse(cue.has_test_results, 'Falsely found test-results on Base 3.14')
def test_StrawberryInPath(self): cue.setup_for_build(self.args) self.assertTrue(re.search('strawberry', os.environ['PATH'], flags=re.IGNORECASE), 'Strawberry Perl location not in PATH (found PATH = {0})' .format(os.environ['PATH']))