From 70e328acf74159027e9a5255a240298e809d917d Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 30 Dec 2024 16:17:09 -0800 Subject: [PATCH 1/7] add xcodebuild env var name --- builder/actions/setup_cross_ci_crt_environment.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index 5d6277698..96f95eff8 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -21,6 +21,8 @@ class SetupCrossCICrtEnvironment(Action): def _setenv(self, env, env_name, env_data, is_secret=False): + if self.is_xcodebuild: + env_name = "TEST_RUNNER_"+env_name # Kinda silly to have a function for this, but makes the API calls consistent and looks better # beside the other functions... env.shell.setenv(env_name, str(env_data), is_secret=is_secret) @@ -433,7 +435,7 @@ def _common_setup(self, env): pass - def run(self, env): + def run(self, is_xcodebuild=False, env): # A special environment variable indicating that we want to dump test environment variables to a specified file. env_dump_file = env.shell.getenv("AWS_SETUP_CRT_TEST_ENVIRONMENT_DUMP_FILE") @@ -461,6 +463,8 @@ def run(self, env): self.is_arm = False # Will be True if on Codebuild self.is_codebuild = False + # Will be True if is using xcodebuild + self.is_xcodebuild = is_xcodebuild # Any easier way to use in docker without having to always modify the builder action if (env.shell.getenv("SETUP_CROSSS_CRT_TEST_ENVIRONMENT_LOCAL", "0") == "1"): From 5f63f9bbd4594807992a228bcb32ed3bee057160 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 30 Dec 2024 16:20:48 -0800 Subject: [PATCH 2/7] would this work?? --- builder/actions/setup_cross_ci_crt_environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index 96f95eff8..e42dc38db 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -435,7 +435,7 @@ def _common_setup(self, env): pass - def run(self, is_xcodebuild=False, env): + def run(self, env, is_xcodebuild=False): # A special environment variable indicating that we want to dump test environment variables to a specified file. env_dump_file = env.shell.getenv("AWS_SETUP_CRT_TEST_ENVIRONMENT_DUMP_FILE") From e540508106189397c86b2c3888e6a8e7f1945afe Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Mon, 30 Dec 2024 16:28:39 -0800 Subject: [PATCH 3/7] update SetupCrossCICrtEnvironment with use_xcodebuld --- builder/actions/setup_cross_ci_crt_environment.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index e42dc38db..57894902e 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -19,9 +19,12 @@ class SetupCrossCICrtEnvironment(Action): + def __init__(self, use_xcodebuild=False): + # set to true if using Apple XCodebuild + self.use_xcodebuild = use_xcodebuild def _setenv(self, env, env_name, env_data, is_secret=False): - if self.is_xcodebuild: + if self.use_xcodebuild: env_name = "TEST_RUNNER_"+env_name # Kinda silly to have a function for this, but makes the API calls consistent and looks better # beside the other functions... @@ -463,8 +466,6 @@ def run(self, env, is_xcodebuild=False): self.is_arm = False # Will be True if on Codebuild self.is_codebuild = False - # Will be True if is using xcodebuild - self.is_xcodebuild = is_xcodebuild # Any easier way to use in docker without having to always modify the builder action if (env.shell.getenv("SETUP_CROSSS_CRT_TEST_ENVIRONMENT_LOCAL", "0") == "1"): From c3274b8599c53ab8764cdff0c37ffaf81ba9e829 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Tue, 18 Mar 2025 09:40:00 -0700 Subject: [PATCH 4/7] remove unused var --- builder/actions/setup_cross_ci_crt_environment.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index 57894902e..89256bbd9 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -438,7 +438,7 @@ def _common_setup(self, env): pass - def run(self, env, is_xcodebuild=False): + def run(self, env): # A special environment variable indicating that we want to dump test environment variables to a specified file. env_dump_file = env.shell.getenv("AWS_SETUP_CRT_TEST_ENVIRONMENT_DUMP_FILE") From 960668426c6859c1633a5a167865ab8a2b50e4cc Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Tue, 18 Mar 2025 10:04:49 -0700 Subject: [PATCH 5/7] add comments --- builder/actions/setup_cross_ci_crt_environment.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index 89256bbd9..e110de4a8 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -19,6 +19,8 @@ class SetupCrossCICrtEnvironment(Action): + """ Setup Environment Variables for CI Unit Tests """ + def __init__(self, use_xcodebuild=False): # set to true if using Apple XCodebuild self.use_xcodebuild = use_xcodebuild From fb6f6a5d14e3896721bbe8fc6bea27bb407d0855 Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Tue, 18 Mar 2025 10:15:21 -0700 Subject: [PATCH 6/7] more comments explain why use TEST_RUNNER --- builder/actions/setup_cross_ci_crt_environment.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index e110de4a8..28e300eec 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -26,10 +26,14 @@ def __init__(self, use_xcodebuild=False): self.use_xcodebuild = use_xcodebuild def _setenv(self, env, env_name, env_data, is_secret=False): - if self.use_xcodebuild: - env_name = "TEST_RUNNER_"+env_name # Kinda silly to have a function for this, but makes the API calls consistent and looks better # beside the other functions... + + # XCodebuild will passing env var with "TEST_RUNNER_" prefix into tests. Setup the builder to add + # "TEST_RUNNER_" to environment variables when use xcodebuild. + # (https://developer.apple.com/documentation/xcode/environment-variable-reference) + if self.use_xcodebuild: + env_name = "TEST_RUNNER_"+env_name env.shell.setenv(env_name, str(env_data), is_secret=is_secret) # Set it in the test environment as well, for C++ env.project.config['test_env'][env_name] = env_data From 641be25fd0b7dab56f8861bfe7bce35e1b2acafc Mon Sep 17 00:00:00 2001 From: Vera Xia Date: Tue, 18 Mar 2025 13:24:45 -0700 Subject: [PATCH 7/7] test xcodebuild flag --- builder/actions/setup_cross_ci_crt_environment.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/builder/actions/setup_cross_ci_crt_environment.py b/builder/actions/setup_cross_ci_crt_environment.py index 28e300eec..0f2c5b32f 100644 --- a/builder/actions/setup_cross_ci_crt_environment.py +++ b/builder/actions/setup_cross_ci_crt_environment.py @@ -22,8 +22,8 @@ class SetupCrossCICrtEnvironment(Action): """ Setup Environment Variables for CI Unit Tests """ def __init__(self, use_xcodebuild=False): - # set to true if using Apple XCodebuild - self.use_xcodebuild = use_xcodebuild + # is_xcodebuild set to true if using Apple XCodebuild + self.is_xcodebuild = use_xcodebuild def _setenv(self, env, env_name, env_data, is_secret=False): # Kinda silly to have a function for this, but makes the API calls consistent and looks better @@ -32,7 +32,7 @@ def _setenv(self, env, env_name, env_data, is_secret=False): # XCodebuild will passing env var with "TEST_RUNNER_" prefix into tests. Setup the builder to add # "TEST_RUNNER_" to environment variables when use xcodebuild. # (https://developer.apple.com/documentation/xcode/environment-variable-reference) - if self.use_xcodebuild: + if self.is_xcodebuild: env_name = "TEST_RUNNER_"+env_name env.shell.setenv(env_name, str(env_data), is_secret=is_secret) # Set it in the test environment as well, for C++