From e338c90836fa9d15af60ea75704cee5be0b3d5a7 Mon Sep 17 00:00:00 2001 From: Vasu Bansal Date: Wed, 4 Sep 2024 05:35:11 +0000 Subject: [PATCH] Added flag to ignore tests --- .github/template/fwe-build/action.yml | 4 +++- .github/workflows/ci.yml | 8 ++++++++ tools/test-fwe.sh | 27 ++++++++++++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/template/fwe-build/action.yml b/.github/template/fwe-build/action.yml index 2e408724..f563c1f4 100644 --- a/.github/template/fwe-build/action.yml +++ b/.github/template/fwe-build/action.yml @@ -16,6 +16,8 @@ inputs: required: true dist-files: required: true + ignore-tests: + required: false runs: using: "composite" @@ -62,7 +64,7 @@ runs: shell: bash if: inputs.build-arch == 'native' run: | - ./tools/test-fwe.sh ${{ inputs.extra-options }} + ./tools/test-fwe.sh ${{ inputs.extra-options }} ${{inputs.ignore-tests}} - name: upload-artifacts uses: actions/upload-artifact@v4 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f4be3bca..cc6e0800 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,6 +16,7 @@ on: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + IGNORE_TESTS: CANDataSourceTest|ISOTPOverCANProtocolTest|IoTFleetWiseEngineTest|OBDOverCANModuleTest jobs: linting: @@ -38,6 +39,7 @@ jobs: build-arch: "native" upload-arch: "amd64" dist-name: "aws-iot-fleetwise-edge" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/x86_64-linux-gnu dist-files: build/aws-iot-fleetwise-edge:. @@ -50,6 +52,7 @@ jobs: build-arch: "cross-arm64" upload-arch: "arm64" dist-name: "aws-iot-fleetwise-edge" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu dist-files: build/aws-iot-fleetwise-edge:. @@ -63,6 +66,7 @@ jobs: upload-arch: "armhf" extra-options: "--with-iwave-gps-support" dist-name: "aws-iot-fleetwise-edge" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu dist-files: build/aws-iot-fleetwise-edge:. @@ -76,6 +80,7 @@ jobs: upload-arch: "amd64" extra-options: "--with-ros2-support" dist-name: "aws-iot-fleetwise-edge-ros2" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/x86_64-linux-gnu:/opt/ros dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:. @@ -89,6 +94,7 @@ jobs: upload-arch: "arm64" extra-options: "--with-ros2-support" dist-name: "aws-iot-fleetwise-edge-ros2" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/aarch64-linux-gnu:/usr/local/x86_64-linux-gnu:/opt/ros dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:. @@ -102,6 +108,7 @@ jobs: upload-arch: "armhf" extra-options: "--with-ros2-support" dist-name: "aws-iot-fleetwise-edge-ros2" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/arm-linux-gnueabihf:/usr/local/x86_64-linux-gnu:/opt/ros dist-files: build/iotfleetwise/aws-iot-fleetwise-edge:. @@ -114,6 +121,7 @@ jobs: build-arch: "cross-android" upload-arch: "android" dist-name: "aws-iot-fleetwise-edge" + ignore-tests: "--ignore-tests ${{env.IGNORE_TESTS}}" cache-paths: /usr/local/x86_64-linux-android:/usr/local/aarch64-linux-android:/usr/local/armv7a-linux-androideabi:/usr/local/x86_64-linux-gnu dist-files: build/x86_64/libaws-iot-fleetwise-edge.so:x86_64 diff --git a/tools/test-fwe.sh b/tools/test-fwe.sh index ec6726c2..cfc99560 100755 --- a/tools/test-fwe.sh +++ b/tools/test-fwe.sh @@ -5,16 +5,23 @@ set -eo pipefail WITH_ROS2_SUPPORT="false" +IGNORE_TESTS="" parse_args() { while [ "$#" -gt 0 ]; do case $1 in --with-ros2-support) WITH_ROS2_SUPPORT="true" + shift + ;; + --ignore-tests) + IGNORE_TESTS="$2" + shift ;; --help) echo "Usage: $0 [OPTION]" echo " --with-ros2-support Test with ROS2 support" + echo " --ignore-tests Ignore tests matching the given pattern" exit 0 ;; esac @@ -27,9 +34,23 @@ parse_args "$@" if ${WITH_ROS2_SUPPORT}; then source /opt/ros/galactic/setup.bash # colcon hides the test output, so use tail in the background. - tail -F log/latest_test/iotfleetwise/stdout_stderr.log & - colcon test --return-code-on-test-failure + # tail -F log/latest_test/iotfleetwise/stdout_stderr.log & + if [ -n "${IGNORE_TESTS}" ]; then + # Split the comma-separated list of test names into an array + # IFS=',' read -ra ignored_tests <<< "${IGNORE_TESTS}" + # Construct the ctest command with the --exclude-regex option + ctest -V --exclude-regex "${IGNORE_TESTS}" + else + ctest -V + fi else cd build - ctest -V + if [ -n "${IGNORE_TESTS}" ]; then + # Split the comma-separated list of test names into an array + # IFS=',' read -ra ignored_tests <<< "${IGNORE_TESTS}" + # Construct the ctest command with the --exclude-regex option + ctest -V --exclude-regex "${IGNORE_TESTS}" + else + ctest -V + fi fi