1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-27 19:17:43 +00:00

gnu: merge the root tests results into the main one

This commit is contained in:
Sylvestre Ledru 2022-09-16 09:14:13 +02:00
parent acef46b629
commit cfa7ba2ce2
3 changed files with 82 additions and 6 deletions

View file

@ -0,0 +1,75 @@
#!/bin/sh
# spell-checker:ignore xpass XPASS testsuite
set -e
# As we do two builds (with and without root), we need to do some trivial maths
# to present the merge results
# this script will export the values in the term
if test $# -ne 2; then
echo "syntax:"
echo "$0 testsuite.log root-testsuite.log"
fi
SUITE_LOG_FILE=$1
ROOT_SUITE_LOG_FILE=$2
if test ! -f "${SUITE_LOG_FILE}"; then
echo "${SUITE_LOG_FILE} has not been found"
exit 1
fi
if test ! -f "${ROOT_SUITE_LOG_FILE}"; then
echo "${ROOT_SUITE_LOG_FILE} has not been found"
exit 1
fi
function get_total {
# Total of tests executed
# They are the normal number of tests as they are skipped in the normal run
NON_ROOT=$(sed -n "s/.*# TOTAL: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $NON_ROOT
}
function get_pass {
# This is the sum of the two test suites.
# In the normal run, they are SKIP
NON_ROOT=$(sed -n "s/.*# PASS: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
AS_ROOT=$(sed -n "s/.*# PASS: \(.*\)/\1/p" "${ROOT_SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $((NON_ROOT + AS_ROOT))
}
function get_skip {
# As some of the tests executed as root as still SKIP (ex: selinux), we
# need to some maths:
# Number of tests skip as user - total test as root + skipped as root
TOTAL_AS_ROOT=$(sed -n "s/.*# TOTAL: \(.*\)/\1/p" "${ROOT_SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
NON_ROOT=$(sed -n "s/.*# SKIP: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
AS_ROOT=$(sed -n "s/.*# SKIP: \(.*\)/\1/p" "${ROOT_SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $((NON_ROOT - TOTAL_AS_ROOT + AS_ROOT))
}
function get_fail {
# They used to be SKIP, now they fail (this is a good news)
NON_ROOT=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
AS_ROOT=$(sed -n "s/.*# FAIL: \(.*\)/\1/p" "${ROOT_SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $((NON_ROOT + AS_ROOT))
}
function get_xpass {
NON_ROOT=$(sed -n "s/.*# XPASS: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $NON_ROOT
}
function get_error {
# They used to be SKIP, now they error (this is a good news)
NON_ROOT=$(sed -n "s/.*# ERROR: \(.*\)/\1/p" "${SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
AS_ROOT=$(sed -n "s/.*# ERROR:: \(.*\)/\1/p" "${ROOT_SUITE_LOG_FILE}" | tr -d '\r' | head -n1)
echo $((NON_ROOT + AS_ROOT))
}
export TOTAL=$(get_total)
export PASS=$(get_pass)
export SKIP=$(get_skip)
export FAIL=$(get_fail)
export XPASS=$(get_xpass)
export ERROR=$(get_error)

View file

@ -53,5 +53,6 @@ else
fi
if test -z "$1" && test -n "$CI"; then
echo "Running check-root to run only root tests"
sudo make -j "$(nproc)" check-root SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit="" srcdir="${path_GNU}" TEST_SUITE_LOG="tests/test-suite-root.log" || :
fi