Do not run 'make test-results' on Base 3.14

- also add tests for this
This commit is contained in:
Ralph Lange
2020-05-13 11:11:58 +02:00
parent 53e23e3684
commit 11e2f1852b
3 changed files with 37 additions and 25 deletions

View File

@@ -382,37 +382,45 @@ 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):
def setBase314(self, yesno):
cfg_base_version = os.path.join('configure', 'CONFIG_BASE_VERSION')
fout = open(cfg_base_version, 'w')
print('BASE_3_14=NO', file=fout)
print('# test file for base version detection', file=fout)
print('BASE_3_14={0}'.format(yesno), file=fout)
fout.close()
def setTestResultsTarget(self, target):
rules_build = os.path.join('configure', 'RULES_BUILD')
fout = open(rules_build, 'w')
print('# test file for target detection', file=fout)
print('{0}: something'.format(target), file=fout)
fout.close()
def test_DetectionBase314No(self):
self.setBase314('NO')
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()
self.setBase314('YES')
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()
def test_DetectionTestResultsTarget314No(self):
self.setBase314('YES')
self.setTestResultsTarget('nottherighttarget')
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()
def test_DetectionTestResultsTarget314Yes(self):
self.setBase314('YES')
self.setTestResultsTarget('test-results')
do.setup_for_build(self.args)
self.assertFalse(do.has_test_results, 'Falsely found test-results on Base 3.14')
def test_DetectionTestResultsTargetNot314Yes(self):
self.setBase314('NO')
self.setTestResultsTarget('test-results')
do.setup_for_build(self.args)
self.assertTrue(do.has_test_results, 'Target test-results not detected')

View File

@@ -419,12 +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
if not isbase314:
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):

View File

@@ -37,7 +37,10 @@ if [ "$TEST" != "NO" ]
then
make -j2 tapfiles || ret=$?
grep -q "^test-results:" $EPICS_BASE/configure/RULES_BUILD && make -sk test-results
if grep -q "BASE_3_14=NO" $EPICS_BASE/configure/CONFIG_BASE_VERSION
then
grep -q "^test-results:" $EPICS_BASE/configure/RULES_BUILD && make -sk test-results
fi
fi
exit $ret