Skip to content

Commit

Permalink
Added flag to ignore tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Vasu Bansal committed Sep 4, 2024
1 parent e617038 commit e338c90
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 4 deletions.
4 changes: 3 additions & 1 deletion .github/template/fwe-build/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ inputs:
required: true
dist-files:
required: true
ignore-tests:
required: false

runs:
using: "composite"
Expand Down Expand Up @@ -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
Expand Down
8 changes: 8 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ on:

env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
IGNORE_TESTS: CANDataSourceTest|ISOTPOverCANProtocolTest|IoTFleetWiseEngineTest|OBDOverCANModuleTest

jobs:
linting:
Expand All @@ -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:.

Expand All @@ -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:.

Expand All @@ -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:.

Expand All @@ -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:.

Expand All @@ -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:.

Expand All @@ -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:.

Expand All @@ -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
Expand Down
27 changes: 24 additions & 3 deletions tools/test-fwe.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 <tests seperated with comma> Ignore tests matching the given pattern"
exit 0
;;
esac
Expand All @@ -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

0 comments on commit e338c90

Please sign in to comment.