Skip running test-results target if not defined
This commit is contained in:
@@ -308,9 +308,11 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
platform = os.environ['PLATFORM']
|
||||
cc = os.environ['CMP']
|
||||
args = Namespace(paths=[])
|
||||
do.building_base = True
|
||||
|
||||
def setUp(self):
|
||||
os.environ.pop('EPICS_HOST_ARCH', None)
|
||||
do.clear_lists()
|
||||
|
||||
def tearDown(self):
|
||||
os.environ['CONFIGURATION'] = self.configuration
|
||||
@@ -380,6 +382,39 @@ class TestSetupForBuild(unittest.TestCase):
|
||||
self.assertTrue(re.search('strawberry', os.environ['PATH'], flags=re.IGNORECASE),
|
||||
'Strawberry Perl location not in PATH for vs2019')
|
||||
|
||||
def test_DetectionBase314No(self):
|
||||
cfg_base_version = os.path.join('configure', 'CONFIG_BASE_VERSION')
|
||||
fout = open(cfg_base_version, 'w')
|
||||
print('BASE_3_14=NO', file=fout)
|
||||
fout.close()
|
||||
do.setup_for_build(self.args)
|
||||
self.assertFalse(do.isbase314, 'Falsely detected Base 3.14')
|
||||
|
||||
def test_DetectionBase314Yes(self):
|
||||
cfg_base_version = os.path.join('configure', 'CONFIG_BASE_VERSION')
|
||||
fout = open(cfg_base_version, 'w')
|
||||
print('BASE_3_14=YES', file=fout)
|
||||
fout.close()
|
||||
do.setup_for_build(self.args)
|
||||
self.assertTrue(do.isbase314, 'Base 3.14 = YES not detected')
|
||||
|
||||
def test_DetectionTestResultsTargetNo(self):
|
||||
rules_build = os.path.join('configure', 'RULES_BUILD')
|
||||
fout = open(rules_build, 'w')
|
||||
print('# test file for target detection', file=fout)
|
||||
print('nottherighttarget:', file=fout)
|
||||
fout.close()
|
||||
do.setup_for_build(self.args)
|
||||
self.assertFalse(do.has_test_results, 'Falsely detected test-results target')
|
||||
|
||||
def test_DetectionTestResultsTargetYes(self):
|
||||
rules_build = os.path.join('configure', 'RULES_BUILD')
|
||||
fout = open(rules_build, 'w')
|
||||
print('# test file for target detection', file=fout)
|
||||
print('test-results:', file=fout)
|
||||
fout.close()
|
||||
do.setup_for_build(self.args)
|
||||
self.assertTrue(do.has_test_results, 'Target test-results not detected')
|
||||
|
||||
if __name__ == "__main__":
|
||||
if 'VV' in os.environ and os.environ['VV'] == '1':
|
||||
|
||||
@@ -78,6 +78,7 @@ def modlist():
|
||||
zip7 = r'C:\Program Files\7-Zip\7z'
|
||||
make = ''
|
||||
isbase314 = False
|
||||
has_test_results = False
|
||||
silent_dep_builds = True
|
||||
|
||||
def host_info():
|
||||
@@ -99,10 +100,13 @@ def host_info():
|
||||
|
||||
# Used from unittests
|
||||
def clear_lists():
|
||||
global isbase314, has_test_results
|
||||
del seen_setups[:]
|
||||
del modules_to_compile[:]
|
||||
setup.clear()
|
||||
places.clear()
|
||||
isbase314 = False
|
||||
has_test_results = False
|
||||
|
||||
# Error-handler to make shutil.rmtree delete read-only files on Windows
|
||||
def remove_readonly(func, path, excinfo):
|
||||
@@ -357,7 +361,7 @@ def add_dependency(dep):
|
||||
update_release_local(setup[dep+"_VARNAME"], place)
|
||||
|
||||
def setup_for_build(args):
|
||||
global make, isbase314
|
||||
global make, isbase314, has_test_results
|
||||
dllpaths = []
|
||||
|
||||
# there is no combined static and debug EPICS_HOST_ARCH target,
|
||||
@@ -415,6 +419,13 @@ def setup_for_build(args):
|
||||
if 'BASE_3_14=YES' in myfile.read():
|
||||
isbase314 = True
|
||||
|
||||
rules_build = os.path.join(base_place, 'configure', 'RULES_BUILD')
|
||||
if os.path.exists(rules_build):
|
||||
with open(rules_build) as myfile:
|
||||
for line in myfile:
|
||||
if re.match('^test-results:', line):
|
||||
has_test_results = True
|
||||
|
||||
bindir = os.path.join(os.getcwd(), 'bin', os.environ['EPICS_HOST_ARCH'])
|
||||
if os.path.isdir(bindir):
|
||||
dllpaths.append(bindir)
|
||||
@@ -541,7 +552,8 @@ def test(args):
|
||||
setup_for_build(args)
|
||||
print('{0}Running the main module tests{1}'.format(ANSI_YELLOW, ANSI_RESET))
|
||||
call_make(['tapfiles'])
|
||||
call_make(['test-results'], parallel=0, silent=True)
|
||||
if has_test_results:
|
||||
call_make(['test-results'], parallel=0, silent=True)
|
||||
|
||||
def doExec(args):
|
||||
'exec user command with vcvars'
|
||||
|
||||
@@ -37,7 +37,7 @@ if [ "$TEST" != "NO" ]
|
||||
then
|
||||
make -j2 tapfiles || ret=$?
|
||||
|
||||
make -sk test-results
|
||||
grep -q "^test-results:" $EPICS_BASE/configure/RULES_BUILD && make -sk test-results
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
|
||||
Reference in New Issue
Block a user