diff options
author | Mauro Sardara <msardara@cisco.com> | 2022-09-14 16:17:22 +0200 |
---|---|---|
committer | Mauro Sardara <msardara@cisco.com> | 2022-09-14 16:26:27 +0200 |
commit | 34e32b751d8060f93646d3fa542ddea73de901c4 (patch) | |
tree | 7ebb988de951fcddc7312c3a5b337c874350219b /scripts/build-packages.sh | |
parent | 6c9f120f028bcca93fd087afa648f653b208eb35 (diff) |
ci: correctly generate tests reports
Do not use make test to run the tests after the build,
as it overwrites the report file for each single unit tests.
Signed-off-by: Mauro Sardara <msardara@cisco.com>
Change-Id: Icdc55b31c1e36b213f977b76f8518ac16c393afc
Diffstat (limited to 'scripts/build-packages.sh')
-rw-r--r-- | scripts/build-packages.sh | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/scripts/build-packages.sh b/scripts/build-packages.sh index 598b3f626..dddc98deb 100644 --- a/scripts/build-packages.sh +++ b/scripts/build-packages.sh @@ -17,6 +17,20 @@ set -euxo pipefail SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE}")" ; pwd -P ) source ${SCRIPT_PATH}/functions.sh +BUILD_PATH="${SCRIPT_PATH}/../packages" +TEST_REPORT_DIR="${BUILD_PATH}/reports" +BUILD_ROOT_DIR="${BUILD_PATH}/build-root/bin" +MAKE_FOLDER="${SCRIPT_PATH}/.." + +function execute_tests() { + mkdir -p "${TEST_REPORT_DIR}" + pushd "${BUILD_ROOT_DIR}" + for component in "${TEST_COMPONENTS[@]}"; do + GTEST_OUTPUT="xml:${TEST_REPORT_DIR}/${component}-report.xml" "./${component}_tests" + done + popd +} + # Parameters: # $1 = Package name # @@ -28,18 +42,11 @@ function build_package() { echo "*******************************************************************" # Run unit tests and make the package - export GTEST_OUTPUT="xml:report.xml" - make -C "${SCRIPT_PATH}/.." BUILD_PATH="${SCRIPT_PATH}/../packages" INSTALL_PREFIX=/usr test package-release - - pushd ${SCRIPT_PATH}/../packages - # Find and collect reports - mkdir -p reports - REPORTS=($(find . -iname 'report.xml')) - echo "${REPORTS[@]}" - for report in "${REPORTS[@]}"; do - mv "${report}" "reports/$(echo ${report} | awk -F/ '{print $(2)"-"$(NF)}')" - done + make -C "${MAKE_FOLDER}" BUILD_PATH="${BUILD_PATH}" INSTALL_PREFIX=/usr package-release + + execute_tests + pushd "${BUILD_PATH}" find . -not -name '*.deb' \ -not -name '*.rpm' \ -not -name 'reports' \ |