Commit 024a61b7 authored by Ivan Mazhukin's avatar Ivan Mazhukin Committed by Vitaly Lipatov

github ci: merge core/tests/tests-smoke into a single 'smoke' test (eterbug #18828)

add smoke test script update node version add ci selfcheck on default github container (ubuntu 24:04) don't check core on debian yet
parent 6e135d66
#!/bin/sh
set -u
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
REPO_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
TESTS_DIR="$REPO_ROOT/tests"
EPM="$REPO_ROOT/bin/epm"
FAILURE_MARKERS='FATAL|FAILED|not equal|NOT EQUAL'
failed=0
total=0
summary=""
record() {
summary="${summary}${1} ${2}
"
[ "$1" = "pass" ] || failed=$((failed + 1))
}
[ -d "$TESTS_DIR" ] || { echo "[ci-smoke] tests/ not found: $TESTS_DIR" >&2; exit 2; }
for t in test_versions.sh test_glob.sh test_distr_info.sh test_startwith.sh test_sections.sh ; do
total=$((total + 1))
if [ ! -f "$TESTS_DIR/$t" ] ; then
echo "[ci-smoke] MISS unit $t"
record MISS "unit $t"
continue
fi
echo "[ci-smoke] --- unit $t ---"
out="$(cd "$TESTS_DIR" && sh "$t" 2>&1)"
rc=$?
printf '%s\n' "$out"
if [ "$rc" -ne 0 ] ; then
echo "[ci-smoke] unit $t exited $rc"
record FAIL "unit $t (exit $rc)"
continue
fi
if printf '%s' "$out" | grep -Eq "$FAILURE_MARKERS" ; then
echo "[ci-smoke] unit $t produced failure markers"
record FAIL "unit $t (markers)"
continue
fi
record pass "unit $t"
done
run_epm_cmd() {
total=$((total + 1))
label="epm $*"
echo "[ci-smoke] --- cmd $label ---"
out="$("$EPM" "$@" 2>&1)"
rc=$?
printf '%s\n' "$out" | head -n 15
nlines="$(printf '%s\n' "$out" | wc -l)"
[ "$nlines" -gt 15 ] && echo "[ci-smoke] (output truncated, $nlines lines total)"
if [ "$rc" -ne 0 ] ; then
echo "[ci-smoke] cmd '$label' exited $rc"
record FAIL "cmd $label (exit $rc)"
return
fi
record pass "cmd $label"
}
run_epm_cmd update
run_epm_cmd search bash
run_epm_cmd cl bash
run_epm_cmd info bash
run_epm_cmd provides /bin/bash
#Install lifecycle: install mc, inspect mc, remove mc
run_epm_cmd --auto install mc
run_epm_cmd qf /usr/bin/mc
run_epm_cmd ql mc
run_epm_cmd --auto remove mc
echo
echo "[ci-smoke] === summary ($((total - failed))/$total passed) ==="
printf '%s' "$summary"
[ "$failed" -eq 0 ] || exit 1
exit 0
# component | changed paths (comma-separated) | systems (comma-separated)
play | play.d/, pack.d/, repack.d/ | debian:bookworm, alt:p11, fedora:43
core | bin/, etc/ | debian:bookworm, alt:p11
tests | tests/ | alt:p11
tests-smoke | bin/, tests/ | alt:p11
ci | .github/ci/, .github/workflows/pr-test.yml | debian:bookworm
play | play.d/, pack.d/, repack.d/ | debian:bookworm, alt:p11, fedora:43
smoke | bin/, etc/, tests/ | alt:p11
ci | .github/ci/, .github/workflows/pr-test.yml | ubuntu:24.04
......@@ -26,54 +26,53 @@ run_play() {
./.github/ci/run-tests.sh
}
run_core() {
echo "Core checks"
run_smoke() {
echo "Smoke: shell syntax"
while IFS= read -r f; do
[[ "$f" == bin/* || "$f" == etc/* ]] || continue
check_shell_syntax "$f"
case "$f" in
bin/*|etc/*) check_shell_syntax "$f" ;;
tests/*.sh) check_shell_syntax "$f" ;;
esac
done <<< "$CHANGED_FILES_TEXT"
echo "Smoke: epm entrypoint"
bin/epm --version
bin/epm --help >/dev/null
bin/epm play --help >/dev/null
}
run_tests_component() {
echo "Tests checks"
while IFS= read -r f; do
[[ "$f" == tests/* ]] || continue
[[ "$f" == *.sh ]] || continue
check_shell_syntax "$f"
done <<< "$CHANGED_FILES_TEXT"
echo "Smoke: unit tests and popular epm commands"
sh .github/ci/ci-smoke-test.sh
}
run_test_script_with_markers() {
local script="$1"
local out
out="$(mktemp)"
(cd tests && sh "$script") >"$out" 2>&1 || {
cat "$out"
rm -f "$out"
return 1
}
cat "$out"
if grep -Eq 'FATAL|FAILED|not equal' "$out"; then
echo "Detected failure markers in tests/$script output."
rm -f "$out"
return 1
fi
validate_components_map() {
local map=".github/ci/components.map"
local lineno=0 comp paths systems line rc=0
rm -f "$out"
return 0
}
[[ -r "$map" ]] || { echo "components.map is not readable: $map"; return 1; }
while IFS= read -r line || [[ -n "$line" ]]; do
lineno=$((lineno + 1))
[[ -z "${line// }" ]] && continue
[[ "${line#"${line%%[![:space:]]*}"}" == \#* ]] && continue
run_tests_smoke() {
echo "Tests smoke"
run_test_script_with_markers test_glob.sh
run_test_script_with_markers test_versions.sh
local pipes="${line//[^|]}"
if (( ${#pipes} != 2 )); then
echo "components.map:$lineno: expected 2 '|' separators, got ${#pipes}: $line"
rc=1; continue
fi
IFS='|' read -r comp paths systems <<< "$line"
comp="${comp## }"; comp="${comp%% }"
paths="${paths## }"; paths="${paths%% }"
systems="${systems## }"; systems="${systems%% }"
if [[ -z "$comp" || -z "$paths" || -z "$systems" ]]; then
echo "components.map:$lineno: empty field(s): comp='$comp' paths='$paths' systems='$systems'"
rc=1
fi
done < "$map"
return "$rc"
}
run_ci() {
......@@ -82,21 +81,19 @@ run_ci() {
check_shell_syntax .github/ci/detect-components.sh
check_shell_syntax .github/ci/run-tests.sh
check_shell_syntax .github/ci/run-component-tests.sh
check_shell_syntax .github/ci/ci-smoke-test.sh
check_shell_syntax ci/run_one_ci.sh
echo "components.map format"
validate_components_map
}
case "$COMPONENT" in
play)
run_play
;;
core)
run_core
;;
tests)
run_tests_component
;;
tests-smoke)
run_tests_smoke
smoke)
run_smoke
;;
ci)
run_ci
......
......@@ -24,7 +24,7 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
......@@ -78,7 +78,7 @@ jobs:
esac
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-depth: 0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment