From d569d0bb3cf54620ddbd56485ebb700be8ffcf94 Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 30 Mar 2021 10:27:54 -0700 Subject: [PATCH] tests: Add a test for the _FOR_BUILD env vars --- run_unittests.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/run_unittests.py b/run_unittests.py index 6e2b805ed..1ab4b3758 100755 --- a/run_unittests.py +++ b/run_unittests.py @@ -9348,6 +9348,26 @@ class CrossFileTests(BasePlatformTests): break self.assertEqual(found, expected, 'Did not find all sections.') + def test_for_build_env_vars(self) -> None: + testcase = os.path.join(self.common_test_dir, '2 cpp') + config = self.helper_create_cross_file({'built-in options': {}}) + cross = self.helper_create_cross_file({'built-in options': {}}) + + self.init(testcase, extra_args=['--native-file', config, '--cross-file', cross], + override_envvars={'PKG_CONFIG_PATH': '/bar', 'PKG_CONFIG_PATH_FOR_BUILD': '/dir'}) + configuration = self.introspect('--buildoptions') + found = 0 + for each in configuration: + if each['name'] == 'pkg_config_path': + self.assertEqual(each['value'], ['/bar']) + found += 1 + elif each['name'] == 'build.pkg_config_path': + self.assertEqual(each['value'], ['/dir']) + found += 1 + if found == 2: + break + self.assertEqual(found, 2, 'Did not find all sections.') + class TAPParserTests(unittest.TestCase): def assert_test(self, events, **kwargs):