diff --git a/appveyor-test.py b/appveyor-test.py index befc8c1..8cfbf94 100644 --- a/appveyor-test.py +++ b/appveyor-test.py @@ -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') diff --git a/appveyor/do.py b/appveyor/do.py index f9bc7ca..7ddc479 100644 --- a/appveyor/do.py +++ b/appveyor/do.py @@ -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): diff --git a/travis/build.sh b/travis/build.sh index 395f0fa..a222ae2 100755 --- a/travis/build.sh +++ b/travis/build.sh @@ -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