chore(linux): preserve log files when running tests under Docker

This change copies the log files that get created during a test run to
the `build/docker-linux/tmp` directory. Also fixes a bug when not
running in docker. Also create log file for test server.
This commit is contained in:
Eberhard Beilharz 2025-01-30 20:27:13 +01:00
parent 60b00e8645
commit 00a00f6dda
No known key found for this signature in database
GPG key ID: E9140597606020D3
2 changed files with 16 additions and 3 deletions

View file

@ -65,7 +65,11 @@ function run_tests() {
setup "$DISPLAY_SERVER" "$ENV_FILE" "$CLEANUP_FILE" "$PID_FILE" --standalone
echo "# NOTE: When the tests fail check /tmp/ibus-engine-keyman.log and /tmp/ibus-daemon.log!"
if [[ "${DOCKER_RUNNING:-false}" == "true" ]]; then
echo "# NOTE: When the tests fail check ibus-engine-keyman.log, ibus-daemon.log and km-test-server.log in build/docker-linux/tmp/!"
else
echo "# NOTE: When the tests fail check /tmp/ibus-engine-keyman.log, /tmp/ibus-daemon.log and /tmp/km-test-server.log!"
fi
echo ""
if [ $# -gt 0 ]; then

View file

@ -140,7 +140,7 @@ function _setup_test_dbus_server() {
CLEANUP_FILE=$2
# Start test dbus server. This will create `/tmp/km-test-server.env`.
"${TOP_BINDIR}/tests/km-dbus-test-server" &> /dev/null &
"${TOP_BINDIR}/tests/km-dbus-test-server" &> /tmp/km-test-server.log &
sleep 1
cat /tmp/km-test-server.env >> "$ENV_FILE"
@ -251,7 +251,7 @@ function _setup_ibus() {
#shellcheck disable=SC2086
ibus-daemon ${ARG_VERBOSE-} --daemonize --panel=disable --address=unix:abstract="${TEMP_DATA_DIR}/test-ibus" ${IBUS_CONFIG-} &> /tmp/ibus-daemon.log
PID=$(pgrep -f "${TEMP_DATA_DIR}/test-ibus")
if [[ "${STANDALONE}" == "--standalone" ]] && [[ ! "${DOCKER_RUNNING:-false}" ]]; then
if [[ "${STANDALONE}" == "--standalone" ]] && [[ "${DOCKER_RUNNING:-false}" != "true" ]]; then
# manual test run
echo "if kill -9 ${PID}; then ibus restart || ibus start; fi # ibus-daemon" >> "${CLEANUP_FILE}"
else
@ -321,6 +321,15 @@ function cleanup() {
rm "$CLEANUP_FILE"
echo "# Finished shutdown of processes."
fi
if [[ "${DOCKER_RUNNING:-false}" == "true" ]]; then
# Note: build/tmp is build/docker-linux/tmp on the host!
BUILD_TMP="$(dirname "$0")/../../../build/tmp"
mkdir -p "${BUILD_TMP}"
[[ -f /tmp/ibus-engine-keyman.log ]] && mv /tmp/ibus-engine-keyman.log "${BUILD_TMP}/ibus-engine-keyman.log"
[[ -f /tmp/ibus-daemon.log ]] && mv /tmp/ibus-daemon.log "${BUILD_TMP}/ibus-daemon.log"
[[ -f /tmp/km-test-server.log ]] && mv /tmp/km-test-server.log "${BUILD_TMP}/km-test-server.log"
fi
}
function exit_on_package_build() {