diff --git a/v2/test/configuration.py b/v2/test/configuration.py index 109af9cb9..d594da7c0 100755 --- a/v2/test/configuration.py +++ b/v2/test/configuration.py @@ -19,22 +19,6 @@ import os.path # ############################################################################### -#ttt - temporarily added this wrapper function to help with debugging failed -# test runs on different platforms (Jurko) -def test_user_configuration(): - try: - test_user_configuration_impl() - except: - import sys - BoostBuild.annotation("failure", "debugging unhandled exception - %s " - "- %s" % (sys.exc_value.__class__.__name__, str(sys.exc_value))) - # Any runaway exceptions other than SystemExit might be the cause for - # this test breaking the whole test run on some platforms so we report - # them and raise a SystemExit instead. - if sys.exc_value is not SystemExit: - sys.exit(-99) - raise - def test_user_configuration(): """ Test Boost Build user configuration handling. Both relative and absolute @@ -90,10 +74,9 @@ using %s ;""" % toolsetName) self.__tester.fail_test(1) def __call__(self, test_id, env, extra_args="", *args, **kwargs): - #ttt - temporarily commented out to make sure all the other tests pass (Jurko) - #if env == "" and not canSetEmptyEnvironmentVariable: - # self.__assertionFailure("Can not set empty environment " - # "variables on this platform.") + if env == "" and not canSetEmptyEnvironmentVariable: + self.__assertionFailure("Can not set empty environment " + "variables on this platform.") self.__registerTestId(str(test_id)) extra_args += " ---test-id---=%s" % test_id env_name = "BOOST_BUILD_USER_CONFIG" @@ -171,15 +154,14 @@ using %s ;""" % toolsetName) t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2]) - #ttt - temporarily commented out to make sure all the other tests pass (Jurko) - #if canSetEmptyEnvironmentVariable: - # test(8, "") - # t.expect_output_line(implicitConfigLoadMessage, False) - # t.expect_output_line(explicitConfigLoadMessage, False) - # t.expect_output_line(disabledConfigLoadMessage, True) - # t.expect_output_line(testMessage % configFileNames[0], False) - # t.expect_output_line(testMessage % configFileNames[1], False) - # t.expect_output_line(testMessage % configFileNames[2]) + if canSetEmptyEnvironmentVariable: + test(8, "") + t.expect_output_line(implicitConfigLoadMessage, False) + t.expect_output_line(explicitConfigLoadMessage, False) + t.expect_output_line(disabledConfigLoadMessage, True) + t.expect_output_line(testMessage % configFileNames[0], False) + t.expect_output_line(testMessage % configFileNames[1], False) + t.expect_output_line(testMessage % configFileNames[2]) test(9, '""') t.expect_output_line(implicitConfigLoadMessage, False) @@ -213,15 +195,14 @@ using %s ;""" % toolsetName) t.expect_output_line(testMessage % configFileNames[1], False) t.expect_output_line(testMessage % configFileNames[2], False) - #ttt - temporarily commented out to make sure all the other tests pass (Jurko) - #if canSetEmptyEnvironmentVariable: - # test(13, "", '--user-config="%s"' % configFileNames[0]) - # t.expect_output_line(implicitConfigLoadMessage, False) - # t.expect_output_line(explicitConfigLoadMessage) - # t.expect_output_line(disabledConfigLoadMessage, False) - # t.expect_output_line(testMessage % configFileNames[0]) - # t.expect_output_line(testMessage % configFileNames[1], False) - # t.expect_output_line(testMessage % configFileNames[2], False) + if canSetEmptyEnvironmentVariable: + test(13, "", '--user-config="%s"' % configFileNames[0]) + t.expect_output_line(implicitConfigLoadMessage, False) + t.expect_output_line(explicitConfigLoadMessage) + t.expect_output_line(disabledConfigLoadMessage, False) + t.expect_output_line(testMessage % configFileNames[0]) + t.expect_output_line(testMessage % configFileNames[1], False) + t.expect_output_line(testMessage % configFileNames[2], False) test(14, '""', '--user-config="%s"' % configFileNames[0]) t.expect_output_line(implicitConfigLoadMessage, False) @@ -242,25 +223,24 @@ using %s ;""" % toolsetName) t.cleanup() -#ttt - temporarily commented out to make sure all the other tests pass (Jurko) -#def _canSetEmptyEnvironmentVariable(): -# """ -# Unfortunately different OSs (and possibly Python implementations as well) -# have different interpretations of what it means to set an evironment -# variable to an empty string. Some (e.g. Windows) interpret it as unsetting -# the variable and some (e.g. AIX or Darwin) actually set it to an empty -# string. -# -# """ -# dummyName = "UGNABUNGA_FOO_BAR_BAZ_FEE_FAE_FOU_FAM" -# original = os.getenv(dummyName) -# os.putenv(dummyName, "") -# result = os.getenv(dummyName) == "" -# if original is None: -# os.unsetenv(dummyName) -# else: -# os.putenv(dummyName) -# return result +def _canSetEmptyEnvironmentVariable(): + """ + Unfortunately different OSs (and possibly Python implementations as well) + have different interpretations of what it means to set an evironment + variable to an empty string. Some (e.g. Windows) interpret it as unsetting + the variable and some (e.g. AIX or Darwin) actually set it to an empty + string. + + """ + dummyName = "UGNABUNGA_FOO_BAR_BAZ_FEE_FAE_FOU_FAM" + original = os.getenv(dummyName) + os.putenv(dummyName, "") + result = os.getenv(dummyName) == "" + if original is None: + os.unsetenv(dummyName) + else: + os.putenv(dummyName) + return result ################################################################################ @@ -270,7 +250,6 @@ using %s ;""" % toolsetName) # ################################################################################ -#ttt - temporarily commented out to make sure all the other tests pass (Jurko) -#canSetEmptyEnvironmentVariable = _canSetEmptyEnvironmentVariable() +canSetEmptyEnvironmentVariable = _canSetEmptyEnvironmentVariable() test_user_configuration()