aboutsummaryrefslogtreecommitdiff
path: root/build-aux/ci_build.sh
diff options
context:
space:
mode:
authorJia Tan <jiat0218@gmail.com>2023-02-01 21:36:22 +0800
committerJia Tan <jiat0218@gmail.com>2023-02-01 21:47:35 +0800
commit3a401b0e0c7a2658af7801dd0690256ef24149e0 (patch)
treeff5efc40fb1c267756ce1a9ad43c96561ec4bd97 /build-aux/ci_build.sh
parentxz: Use clock_gettime() even if CLOCK_MONOTONIC isn't available. (diff)
downloadxz-3a401b0e0c7a2658af7801dd0690256ef24149e0.tar.xz
CI: Upload test logs as artifacts if a test fails.
Diffstat (limited to 'build-aux/ci_build.sh')
-rwxr-xr-xbuild-aux/ci_build.sh31
1 files changed, 25 insertions, 6 deletions
diff --git a/build-aux/ci_build.sh b/build-aux/ci_build.sh
index 2d0f8643..85542c9b 100755
--- a/build-aux/ci_build.sh
+++ b/build-aux/ci_build.sh
@@ -20,10 +20,11 @@ USAGE="Usage: $0
-b [autotools|cmake]
-c [crc32|crc64|sha256]
-d [encoders|decoders|bcj|delta|threads|shared|nls]
+ -f [CFLAGS]
-l [destdir]
- -s [srcdir]
+ -n [ARTIFACTS_DIR_NAME]
-p [all|build|test]
- -f [CFLAGS]"
+ -s [srcdir]"
# Absolute path of script directory
ABS_DIR=$(cd -- "$(dirname -- "$0")" && pwd)
@@ -41,9 +42,10 @@ NATIVE_LANG_SUPPORT="y"
SRC_DIR="$ABS_DIR/../"
DEST_DIR="$SRC_DIR/../xz_build"
PHASE="all"
+ARTIFACTS_DIR_NAME="output"
# Parse arguments
-while getopts b:c:d:l:s:p:f:h opt; do
+while getopts b:c:d:l:n:s:p:f:h opt; do
# b option can have either value "autotools" OR "cmake"
case ${opt} in
h)
@@ -88,6 +90,8 @@ while getopts b:c:d:l:s:p:f:h opt; do
;;
l) DEST_DIR="$OPTARG"
;;
+ n) ARTIFACTS_DIR_NAME="$OPTARG"
+ ;;
s) SRC_DIR="$OPTARG"
;;
p) PHASE="$OPTARG"
@@ -177,11 +181,26 @@ if [ "$PHASE" = "all" ] || [ "$PHASE" = "test" ]; then
case $BUILD_SYSTEM in
autotools)
cd "$DEST_DIR"
- make check
+ # If the tests fail, copy the test logs into the artifacts folder
+ if make check
+ then
+ :
+ else
+ mkdir -p "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
+ cp ./tests/*.log "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
+ exit 1
+ fi
;;
cmake)
cd "$DEST_DIR"
- make "test"
+ if make test
+ then
+ :
+ else
+ mkdir -p "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
+ cp ./Testing/Temporary/*.log "$SRC_DIR/build-aux/artifacts/$ARTIFACTS_DIR_NAME"
+ exit 1
+ fi
;;
esac
-fi \ No newline at end of file
+fi