Skip to content

Commit 8b4007a

Browse files
committed
ci: prefer staticssl open.mp asset and improve unit-test runtime diagnostics
1 parent 7b9a411 commit 8b4007a

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

scripts/ci/run-openmp-unit-tests.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,15 @@ if [[ -n "${OPENMP_SERVER_DIR}" ]]; then
5252
RUN_DIR="${OPENMP_SERVER_DIR}"
5353
else
5454
OPENMP_API_URL="${OPENMP_API_URL:-https://api.github.com/repos/openmultiplayer/open.mp/releases/latest}"
55+
OPENMP_PREFERRED_ASSET_REGEX="${OPENMP_PREFERRED_ASSET_REGEX:-linux-x86.*staticssl.*\\.(tar\\.gz|tgz|zip)$}"
5556
OPENMP_ASSET_REGEX="${OPENMP_ASSET_REGEX:-linux-x86.*\\.(tar\\.gz|tgz|zip)$}"
5657

5758
echo "Resolving latest open.mp Linux x86 server package..."
5859
OMP_JSON="$(curl -fsSL "${OPENMP_API_URL}")"
59-
OMP_URL="$(printf '%s' "${OMP_JSON}" | jq -r --arg re "${OPENMP_ASSET_REGEX}" '.assets[] | select(.name | test($re)) | .browser_download_url' | head -n 1)"
60+
OMP_URL="$(printf '%s' "${OMP_JSON}" | jq -r --arg re "${OPENMP_PREFERRED_ASSET_REGEX}" '.assets[] | select(.name | test($re)) | .browser_download_url' | head -n 1)"
61+
if [[ -z "${OMP_URL}" || "${OMP_URL}" == "null" ]]; then
62+
OMP_URL="$(printf '%s' "${OMP_JSON}" | jq -r --arg re "${OPENMP_ASSET_REGEX}" '.assets[] | select(.name | test($re)) | .browser_download_url' | head -n 1)"
63+
fi
6064

6165
if [[ -z "${OMP_URL}" || "${OMP_URL}" == "null" ]]; then
6266
echo "ERROR: no open.mp Linux x86 package found via ${OPENMP_API_URL}" >&2
@@ -94,6 +98,13 @@ if [[ ! -x "${RUN_DIR}/omp-server" ]]; then
9498
exit 1
9599
fi
96100

101+
if command -v ldd >/dev/null 2>&1; then
102+
MISSING_OMP_LIBS="$(ldd "${RUN_DIR}/omp-server" 2>/dev/null | awk '/not found/{print $1}' | xargs || true)"
103+
if [[ -n "${MISSING_OMP_LIBS}" ]]; then
104+
echo "WARNING: omp-server has missing runtime libs: ${MISSING_OMP_LIBS}" >&2
105+
fi
106+
fi
107+
97108
PAWNCC_BIN="$(find "${RUN_DIR}" -maxdepth 3 -type f -name pawncc | head -n 1)"
98109
if [[ -z "${PAWNCC_BIN}" ]]; then
99110
echo "ERROR: could not locate pawncc in ${RUN_DIR}" >&2
@@ -240,6 +251,8 @@ OMP_EXIT=0
240251

241252
if [[ ${OMP_EXIT} -eq 124 ]]; then
242253
echo "ERROR: open.mp unit tests timed out after ${UNIT_TEST_TIMEOUT}." >&2
254+
elif [[ ${OMP_EXIT} -ne 0 ]]; then
255+
echo "ERROR: omp-server exited with status ${OMP_EXIT}." >&2
243256
fi
244257

245258
if grep -q "All tests passed!" "${LOG_PATH}"; then
@@ -251,6 +264,8 @@ echo "Unit tests failed. Summary:" >&2
251264
grep -nE "All tests passed|tests failed|ASSERT FAILED|executing test|passed!|failed\\.|component.mysql|Error|ERROR" "${LOG_PATH}" | tail -n 300 >&2 || true
252265
echo "Full runtime log: ${LOG_PATH}" >&2
253266
echo "Compile log: ${COMPILE_LOG_PATH}" >&2
267+
echo "Runtime log tail:" >&2
268+
tail -n 200 "${LOG_PATH}" >&2 || true
254269
if [[ -f "${COMPILE_LOG_PATH}" ]]; then
255270
echo "Compile log tail:" >&2
256271
tail -n 120 "${COMPILE_LOG_PATH}" >&2 || true

0 commit comments

Comments
 (0)