From 5a4c1e25025adbbe29394ab61052b57a608d43a0 Mon Sep 17 00:00:00 2001 From: Antonio Ospite Date: Wed, 2 Jul 2025 10:55:25 +0200 Subject: [PATCH] ci: fix using _section_switch and _uncollapsed_section_switch Allow users to call `_section_switch` and `_uncollapsed_section_switch` without previous section commands. This can happen because `*-runner.sh` script can be composed in several ways. For example if `android-cts-runner.sh` is called without first calling `cuttlefish-runner.sh`, where a `section_start` is issued, the `uncollapsed_section_switch` command in `android-cts-runner.sh` will fail with an error like: 2025-07-02T08:42:33 /install/setup-test-env.sh: line 102: CURRENT_SECTION: unbound variable Setting default empty values for `CURRENT_SECTION` makes it possible to use the "section_switch" commands to also start a section for the first time. Part-of: --- .gitlab-ci/setup-test-env.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) mode change 100644 => 100755 .gitlab-ci/setup-test-env.sh diff --git a/.gitlab-ci/setup-test-env.sh b/.gitlab-ci/setup-test-env.sh old mode 100644 new mode 100755 index ee9b6d6f3a0..1ee8690b4bd --- a/.gitlab-ci/setup-test-env.sh +++ b/.gitlab-ci/setup-test-env.sh @@ -88,7 +88,7 @@ function _section_end { alias section_end="x_off; _section_end" function _section_switch { - if [ -n "$CURRENT_SECTION" ] + if [ -n "${CURRENT_SECTION:-}" ] then build_section_end $CURRENT_SECTION x_off @@ -99,7 +99,7 @@ function _section_switch { alias section_switch="x_off; _section_switch" function _uncollapsed_section_switch { - if [ -n "$CURRENT_SECTION" ] + if [ -n "${CURRENT_SECTION:-}" ] then build_section_end $CURRENT_SECTION x_off