From 5431af9cbeaf8ee75bc51da4168ed3d2f09e5326 Mon Sep 17 00:00:00 2001 From: Ibrahim Kuru Date: Wed, 18 Jan 2023 09:14:58 +0100 Subject: [PATCH] iox-##692 Split tests Signed-off-by: Ibrahim Kuru --- .github/workflows/build-test.yml | 39 ++++++++++++--- tools/ci/build-test-ubuntu-with-sanitizers.sh | 47 ++++++++++++++++--- 2 files changed, 74 insertions(+), 12 deletions(-) diff --git a/.github/workflows/build-test.yml b/.github/workflows/build-test.yml index 911c7b32a79..29776f715e2 100644 --- a/.github/workflows/build-test.yml +++ b/.github/workflows/build-test.yml @@ -109,18 +109,45 @@ jobs: - name: Run Address Sanitizer run: ./tools/ci/build-test-ubuntu-with-sanitizers.sh clang asan - build-test-ubuntu-with-thread-sanitizer-clang-latest: - # prevent stuck jobs consuming runners for 3 hours - timeout-minutes: 180 + build-ubuntu-with-thread-sanitizer-clang-latest: + timeout-minutes: 30 runs-on: ubuntu-latest - needs: pre-flight-check steps: - name: Checkout uses: actions/checkout@v3 - name: Install iceoryx dependencies and clang-tidy uses: ./.github/actions/install-iceoryx-deps-and-clang - - name: Run Thread Sanitizer - run: ./tools/ci/build-test-ubuntu-with-sanitizers.sh clang tsan + - name: Build with Thread Sanitizer + run: ./tools/ci/build-test-ubuntu-with-sanitizers.sh clang tsan skip-tests + - name: temp test + run : ls -al + - name: upload hoofs-test-binaries + uses: actions/upload-artifact@v3 + with: + name: hoofs-test-binaries + path: build/hoofs + - name: upload posh-test-binaries + uses: actions/upload-artifact@v3 + with: + name: posh-test-binaries + path: build/posh + + test-ubuntu-with-thread-sanitizer-hoofs-moduletest: + # prevent stuck jobs consuming runners for 1 hour + timeout-minutes: 60 + runs-on: ubuntu-latest + needs: build-ubuntu-with-thread-sanitizer-clang-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Install iceoryx dependencies and clang-tidy + uses: ./.github/actions/install-iceoryx-deps-and-clang + - name: download hoofs-test-binaries + uses: actions/download-artifact@v3 + with: + name: hoofs-test-binaries + - name: Execute the test + run: ls -al; build/hoofs/hoofs_moduletests --gtest_filter=-*.TimingTest_* --gtest_output=xml:hoofs_ModuleTestResults.xml build-test-macos-with-address-sanitizer: # prevent stuck jobs consuming runners for 1 hour diff --git a/tools/ci/build-test-ubuntu-with-sanitizers.sh b/tools/ci/build-test-ubuntu-with-sanitizers.sh index 68f4ee59ec9..465da9812c2 100755 --- a/tools/ci/build-test-ubuntu-with-sanitizers.sh +++ b/tools/ci/build-test-ubuntu-with-sanitizers.sh @@ -19,8 +19,41 @@ set -e -COMPILER=${1:-gcc} -SANITIZER=${2:-asan} +COMPILER=gcc +SANITIZER=asan +SKIP_TESTS=false + + +while (( "$#" )); do + case "$1" in + "gcc" | "clang") + COMPILER="$1" + shift 1 + ;; + "asan" | "tsan") + SANITIZER="$1" + shift 1 + ;; + "skip-tests") + SKIP_TESTS=true + shift 1 + ;; + "help") + echo "Usage: $0 [gcc|clang] [asan|tsan] [skip-tests]" + echo " gcc | clang : compiler to use (default: gcc)" + echo " asan | tsan : sanitizer to use (default: asan)" + echo " asan: address sanitizer" + echo " tsan: thread sanitizer" + echo " skip-tests: skip tests after the build" + + exit 0 + ;; + *) + echo "Invalid argument '$1'. Try 'help' for options." + exit 1 + ;; + esac +done msg() { printf "\033[1;32m%s: %s\033[0m\n" ${FUNCNAME[1]} "$1" @@ -29,16 +62,14 @@ msg() { WORKSPACE=$(git rev-parse --show-toplevel) cd "${WORKSPACE}" +msg "COMPILER: ${COMPILER}" +msg "SANITIZER: ${SANITIZER}" msg "installing build dependencies" sudo apt-get update && sudo apt-get install -y libacl1-dev libncurses5-dev msg "creating local test users and groups for testing access control" sudo ./tools/scripts/add_test_users.sh -if [ "$SANITIZER" != "asan" ] && [ "$SANITIZER" != "tsan" ]; then - msg "Invalid sanitizer." - exit 1 -fi msg "building sources" if [ "$COMPILER" == "gcc" ]; then @@ -49,6 +80,10 @@ if [ "$COMPILER" == "clang" ]; then ./tools/iceoryx_build_test.sh clean build-strict build-shared build-all clang debug $SANITIZER test-add-user out-of-tree fi +if [ "$SKIP_TESTS" == "true" ]; then + exit 0 +fi + msg "running all tests" cd ./build if [ "$SANITIZER" == "tsan" ]; then