From 9193811bfc659105b5247ef4a934bd8f534b728a Mon Sep 17 00:00:00 2001 From: Michal Sojka Date: Sun, 22 Dec 2024 22:38:39 +0100 Subject: [PATCH] Add autoware test --- test/common.bash | 18 ++++++++++++++++++ test/long_tests.bats | 17 +++++++++++++++++ test/test.bats | 19 +------------------ 3 files changed, 36 insertions(+), 18 deletions(-) create mode 100644 test/common.bash create mode 100644 test/long_tests.bats diff --git a/test/common.bash b/test/common.bash new file mode 100644 index 0000000..663933d --- /dev/null +++ b/test/common.bash @@ -0,0 +1,18 @@ +bats_load_library bats-support +bats_load_library bats-assert +bats_load_library bats-file + +setup_file() { + # get the containing directory of this file + # use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0, + # as those will point to the bats executable's location or the preprocessed file respectively + DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" + export DIR + # make executables in this directory visible to PATH + PATH="$DIR:$PATH" +} + +setup() { + cd "$BATS_TEST_TMPDIR" + cp -a "$DIR/ws" . +} diff --git a/test/long_tests.bats b/test/long_tests.bats new file mode 100644 index 0000000..92d456d --- /dev/null +++ b/test/long_tests.bats @@ -0,0 +1,17 @@ +# -*- bats-mode -*- + +# shellcheck disable=SC2046 + +bats_require_minimum_version 1.5.0 +load common.bash + +@test "autoware" { + rm -rf ws # we don't use out simple workspace + git clone https://github.com/autowarefoundation/autoware.git + cd autoware + mkdir src + vcs import src < autoware.repos + cd .. + + ros2nix --output-as-nix-pkg-name --fetch $(find -name package.xml|grep -v ament_cmake) +} diff --git a/test/test.bats b/test/test.bats index ac0d5bc..88bdbff 100644 --- a/test/test.bats +++ b/test/test.bats @@ -3,24 +3,7 @@ # shellcheck disable=SC2046 bats_require_minimum_version 1.5.0 -bats_load_library bats-support -bats_load_library bats-assert -bats_load_library bats-file - -setup_file() { - # get the containing directory of this file - # use $BATS_TEST_FILENAME instead of ${BASH_SOURCE[0]} or $0, - # as those will point to the bats executable's location or the preprocessed file respectively - DIR="$( cd "$( dirname "$BATS_TEST_FILENAME" )" >/dev/null 2>&1 && pwd )" - export DIR - # make executables in this directory visible to PATH - PATH="$DIR:$PATH" -} - -setup() { - cd "$BATS_TEST_TMPDIR" - cp -a "$DIR/ws" . -} +load common.bash @test "ros2nix --help" { ros2nix --help