From d7ad0956bfc5465bbf201c183e6d66a9a9e4b5ca Mon Sep 17 00:00:00 2001 From: Arkadiusz Bokowy Date: Wed, 7 Aug 2024 07:11:53 +0200 Subject: [PATCH] [Tizen] Strip unit test executables to save CI storage (#34810) * Add support stripping all symbols from executables * Compile Tizen with -fPIC and -pie * Re-enable Tizen QEMU workflow --- .github/workflows/qemu.yaml | 9 ++------- build/config/compiler/BUILD.gn | 6 +++++- build/config/compiler/compiler.gni | 9 ++++++--- scripts/build/builders/tizen.py | 4 ++++ third_party/tizen/tizen_sdk.gni | 2 +- 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/.github/workflows/qemu.yaml b/.github/workflows/qemu.yaml index be2320f975beae..051af08a2893da 100644 --- a/.github/workflows/qemu.yaml +++ b/.github/workflows/qemu.yaml @@ -27,7 +27,7 @@ concurrency: env: CHIP_NO_LOG_TIMESTAMPS: true - + jobs: qemu-esp32: @@ -75,12 +75,7 @@ jobs: name: Tizen runs-on: ubuntu-latest - # NOTE: job temporarely disabled as it seems flaky. The flake does not result in usable - # logs so the current theory is that we run out of space. This is unusual as - # larger docker images succeed at bootstrap, however it needs more investigation - # to detect an exact/real root cause. - if: false - # if: github.actor != 'restyled-io[bot]' + if: github.actor != 'restyled-io[bot]' container: image: ghcr.io/project-chip/chip-build-tizen-qemu:54 diff --git a/build/config/compiler/BUILD.gn b/build/config/compiler/BUILD.gn index 3de1749b37d58a..fee0d745f6d136 100644 --- a/build/config/compiler/BUILD.gn +++ b/build/config/compiler/BUILD.gn @@ -334,7 +334,11 @@ config("warnings_third_party") { } config("symbols_default") { - cflags = [ "-g${symbol_level}" ] + if (strip_symbols) { + cflags = [ "-s" ] + } else { + cflags = [ "-g${symbol_level}" ] + } } config("std_default") { diff --git a/build/config/compiler/compiler.gni b/build/config/compiler/compiler.gni index 74dc224f3ecec7..63b1840bc884d2 100644 --- a/build/config/compiler/compiler.gni +++ b/build/config/compiler/compiler.gni @@ -30,11 +30,11 @@ declare_args() { symbol_level = 2 # Enable position independent code (-fPIC). - enable_pic = - current_os == "linux" || current_os == "mac" || current_os == "android" + enable_pic = current_os == "linux" || current_os == "mac" || + current_os == "android" || current_os == "tizen" # Enable position independent executables (-pie). - enable_pie = current_os == "linux" + enable_pie = current_os == "linux" || current_os == "tizen" # Remove unwind tables from the binary to save space. exclude_unwind_tables = current_os != "android" @@ -48,6 +48,9 @@ declare_args() { # enable libfuzzer is_libfuzzer = false + # Remove all symbol table and relocation information from the binary. + strip_symbols = false + # Generate code coverage analysis artifacts when enabled. use_coverage = false diff --git a/scripts/build/builders/tizen.py b/scripts/build/builders/tizen.py index 97124328c5dd1e..b9b9c59661cf74 100644 --- a/scripts/build/builders/tizen.py +++ b/scripts/build/builders/tizen.py @@ -117,6 +117,10 @@ def __init__(self, if app == TizenApp.TESTS: self.extra_gn_options.append('chip_build_tests=true') + # Tizen test driver creates ISO image with all unit test files. So, + # it uses twice as much space as regular build. Due to CI storage + # limitations, we need to strip debug symbols from executables. + self.extra_gn_options.append('strip_symbols=true') self.build_command = 'check' if not enable_ble: diff --git a/third_party/tizen/tizen_sdk.gni b/third_party/tizen/tizen_sdk.gni index ebbc8dadd077d0..7f711c693ea599 100644 --- a/third_party/tizen/tizen_sdk.gni +++ b/third_party/tizen/tizen_sdk.gni @@ -189,7 +189,7 @@ template("tizen_qemu_mkisofs") { "mkisofs", "-input-charset=default", "-VCHIP", # Volume ID = CHIP - "-JRU", # Joliet + Rock Ridge with untranslated filenames + "-JrU", # Joliet + Rock Ridge with untranslated filenames ] # Exclude files from the ISO image which might otherwise be included