Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
pwojcikdev committed Feb 11, 2024
1 parent d318c07 commit 78f31dd
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 33 deletions.
32 changes: 0 additions & 32 deletions ci/tests/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,3 @@ get_exec_extension() {
esac
}

enable_core_dumps() {
COREDUMP_DIR="/cores"

case "$(uname -s)" in
Linux*)
# Ensure directory exists and is writable for core dumps
sudo mkdir -p "${COREDUMP_DIR}"
sudo chmod a+w "${COREDUMP_DIR}"

# Enable core dumps
ulimit -c unlimited
echo "${COREDUMP_DIR}/core-%e.%p" | sudo tee /proc/sys/kernel/core_pattern

export COREDUMP_DIR=${COREDUMP_DIR}
echo "COREDUMP_DIR=${COREDUMP_DIR}" >> $GITHUB_ENV
;;
Darwin*)
ulimit -c unlimited

# By default, macOS writes core dumps to /cores
export COREDUMP_DIR=${COREDUMP_DIR}
echo "COREDUMP_DIR=${COREDUMP_DIR}" >> $GITHUB_ENV
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
# TODO: Support core dumps on Windows
;;
*)
echo "Unknown OS"
exit 1
;;
esac
}
38 changes: 37 additions & 1 deletion ci/tests/run-tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,48 @@ set -uo pipefail

source "$(dirname "$BASH_SOURCE")/common.sh"

enable_core_dumps() {
COREDUMP_DIR="/cores"

case "$(uname -s)" in
Linux*)
# Ensure directory exists and is writable for core dumps
sudo mkdir -p "${COREDUMP_DIR}"
sudo chmod a+w "${COREDUMP_DIR}"

# Enable core dumps
ulimit -c unlimited
echo "${COREDUMP_DIR}/core-%e.%p" | sudo tee /proc/sys/kernel/core_pattern

export COREDUMP_DIR=${COREDUMP_DIR}

echo "Core dumps enabled (Linux)"
;;
Darwin*)
ulimit -c unlimited

# By default, macOS writes core dumps to /cores
export COREDUMP_DIR=${COREDUMP_DIR}

echo "Core dumps enabled (macOS)"
;;
CYGWIN*|MINGW32*|MSYS*|MINGW*)
# TODO: Support core dumps on Windows
echo "Core dumps not supported on Windows"
;;
*)
echo "Unknown OS"
exit 1
;;
esac
}

enable_core_dumps

TARGET=$1
echo "Running tests for target: ${TARGET}"

executable=${BUILD_DIR}/${TARGET}$(get_exec_extension)
executable=./${TARGET}$(get_exec_extension)
"${executable}"
status=$?

Expand Down

0 comments on commit 78f31dd

Please sign in to comment.