From fdcbd705b3765379acdd46fb778b205165670ba2 Mon Sep 17 00:00:00 2001 From: William Deegan Date: Thu, 6 Dec 2018 22:28:15 -0500 Subject: Skip APPLELINK* testing if not on mac --- test/LINK/applelink.py | 78 +++++++++++++++++++++++++------------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/test/LINK/applelink.py b/test/LINK/applelink.py index b548390..6672234 100644 --- a/test/LINK/applelink.py +++ b/test/LINK/applelink.py @@ -24,7 +24,7 @@ __revision__ = "__FILE__ __REVISION__ __DATE__ __DEVELOPER__" -import os +import sys import TestSCons @@ -32,7 +32,7 @@ _python_ = TestSCons._python_ _exe = TestSCons._exe test = TestSCons.TestSCons() -test.verbose_set(1) +# test.verbose_set(1) # Test issue # 2580 test.dir_fixture('applelink_image') @@ -40,47 +40,47 @@ test.run(arguments='-f SConstruct_gh2580 -Q -n', stdout='gcc -o foo.o -c -Fframe # Now test combinations of SHLIBVERSION, APPLELINK_CURRENT_VERSION, APPLELINK_COMPATIBILITY_VERSION +if sys.platform == 'darwin': + for SHLIBVERSION, APPLELINK_CURRENT_VERSION, APPLELINK_COMPATIBILITY_VERSION, should_error in [ + ('1.2.3', '', '', False), + ('1.2.3', '9.9.9', '9.9.0', False), + ('99999.2.3', '', '', 'AppleLinkInvalidCurrentVersionException'), + ('1.2.3', '9.9.999', '9.9.0', 'AppleLinkInvalidCurrentVersionException'), + ('1.2.3', '9.9.9', '9.999.0', 'AppleLinkInvalidCompatibilityVersionException'), + ('1.2.3', '9.9.9', '99999.99.0', 'AppleLinkInvalidCompatibilityVersionException'), + ]: + if not APPLELINK_CURRENT_VERSION: + APPLELINK_CURRENT_VERSION = SHLIBVERSION + if not APPLELINK_COMPATIBILITY_VERSION: + APPLELINK_COMPATIBILITY_VERSION = '.'.join(APPLELINK_CURRENT_VERSION.split('.', 2)[:2] + ['0']) -for SHLIBVERSION, APPLELINK_CURRENT_VERSION, APPLELINK_COMPATIBILITY_VERSION, should_error in [ - ('1.2.3', '', '', False), - ('1.2.3', '9.9.9', '9.9.0', False), - ('99999.2.3', '', '', 'AppleLinkInvalidCurrentVersionException'), - ('1.2.3', '9.9.999', '9.9.0', 'AppleLinkInvalidCurrentVersionException'), - ('1.2.3', '9.9.9', '9.999.0', 'AppleLinkInvalidCompatibilityVersionException'), - ('1.2.3', '9.9.9', '99999.99.0', 'AppleLinkInvalidCompatibilityVersionException'), -]: - if not APPLELINK_CURRENT_VERSION: - APPLELINK_CURRENT_VERSION = SHLIBVERSION - if not APPLELINK_COMPATIBILITY_VERSION: - APPLELINK_COMPATIBILITY_VERSION = '.'.join(APPLELINK_CURRENT_VERSION.split('.', 2)[:2] + ['0']) + if not should_error: + expected_stdout = r"^.+ -dynamiclib -Wl,-current_version,{APPLELINK_CURRENT_VERSION} -Wl,-compatibility_version,{APPLELINK_COMPATIBILITY_VERSION}.+".format( + **locals()) + expected_stderr = None + expected_status = 0 + else: + expected_stdout = None + expected_stderr = r"^.+{should_error}.+".format(**locals()) + expected_status = 2 - if not should_error: - expected_stdout = r"^.+ -dynamiclib -Wl,-current_version,{APPLELINK_CURRENT_VERSION} -Wl,-compatibility_version,{APPLELINK_COMPATIBILITY_VERSION}.+".format( - **locals()) - expected_stderr = None - expected_status = 0 - else: - expected_stdout = None - expected_stderr = r"^.+{should_error}.+".format(**locals()) - expected_status = 2 + test.run( + arguments='-f SConstruct_CurVers_CompatVers SHLIBVERSION={SHLIBVERSION} APPLELINK_CURRENT_VERSION={APPLELINK_CURRENT_VERSION} APPLELINK_COMPATIBILITY_VERSION={APPLELINK_COMPATIBILITY_VERSION}'.format(**locals()), + stdout=expected_stdout, + stderr=expected_stderr, + match=TestSCons.match_re_dotall, + status=expected_status) - test.run( - arguments='-f SConstruct_CurVers_CompatVers SHLIBVERSION={SHLIBVERSION} APPLELINK_CURRENT_VERSION={APPLELINK_CURRENT_VERSION} APPLELINK_COMPATIBILITY_VERSION={APPLELINK_COMPATIBILITY_VERSION}'.format(**locals()), - stdout=expected_stdout, - stderr=expected_stderr, - match=TestSCons.match_re_dotall, - status=expected_status) + if not should_error: + # Now run otool -L to get the compat and current version info and verify it's correct in the library. + # We expect output such as this + # libfoo.1.2.3.dylib: + # > libfoo.1.2.3.dylib (compatibility version 1.1.99, current version 9.9.9) + # > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) + otool_output = "libfoo.{SHLIBVERSION}.dylib:\n\tlibfoo.{SHLIBVERSION}.dylib (compatibility version {APPLELINK_COMPATIBILITY_VERSION}, current version {APPLELINK_CURRENT_VERSION})\n\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)\n".format( + **locals()) - if not should_error: - # Now run otool -L to get the compat and current version info and verify it's correct in the library. - # We expect output such as this - # libfoo.1.2.3.dylib: - # > libfoo.1.2.3.dylib (compatibility version 1.1.99, current version 9.9.9) - # > /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4) - otool_output = "libfoo.{SHLIBVERSION}.dylib:\n\tlibfoo.{SHLIBVERSION}.dylib (compatibility version {APPLELINK_COMPATIBILITY_VERSION}, current version {APPLELINK_CURRENT_VERSION})\n\t/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1252.50.4)\n".format( - **locals()) - - test.run(program='/usr/bin/otool', arguments='-L libfoo.%s.dylib' % SHLIBVERSION, stdout=otool_output) + test.run(program='/usr/bin/otool', arguments='-L libfoo.%s.dylib' % SHLIBVERSION, stdout=otool_output) test.pass_test() -- cgit v0.12