Skip to content

Commit 560ae0d

Browse files
committed
selinux test: collect and process the results
1 parent fe57215 commit 560ae0d

File tree

2 files changed

+31
-5
lines changed

2 files changed

+31
-5
lines changed

.github/workflows/GnuTests.yml

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,12 +55,14 @@ jobs:
5555
#
5656
SUITE_LOG_FILE="${path_GNU_tests}/test-suite.log"
5757
ROOT_SUITE_LOG_FILE="${path_GNU_tests}/test-suite-root.log"
58+
SELINUX_SUITE_LOG_FILE="${path_GNU_tests}/selinux-test-suite.log"
59+
SELINUX_ROOT_SUITE_LOG_FILE="${path_GNU_tests}/selinux-test-suite-root.log"
5860
TEST_LOGS_GLOB="${path_GNU_tests}/**/*.log" ## note: not usable at bash CLI; [why] double globstar not enabled by default b/c MacOS includes only bash v3 which doesn't have double globstar support
5961
TEST_FILESET_PREFIX='test-fileset-IDs.sha1#'
6062
TEST_FILESET_SUFFIX='.txt'
6163
TEST_SUMMARY_FILE='gnu-result.json'
6264
TEST_FULL_SUMMARY_FILE='gnu-full-result.json'
63-
outputs SUITE_LOG_FILE ROOT_SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE TEST_FULL_SUMMARY_FILE
65+
outputs SUITE_LOG_FILE ROOT_SUITE_LOG_FILE SELINUX_SUITE_LOG_FILE SELINUX_ROOT_SUITE_LOG_FILE TEST_FILESET_PREFIX TEST_FILESET_SUFFIX TEST_LOGS_GLOB TEST_SUMMARY_FILE TEST_FULL_SUMMARY_FILE
6466
- name: Checkout code (uutil)
6567
uses: actions/checkout@v4
6668
with:
@@ -198,6 +200,19 @@ jobs:
198200
- name: Selinux - Run selinux tests as root
199201
run: |
200202
lima bash -c "cd ~/work/uutils/ && CI=1 bash util/run-gnu-test.sh run-root \$(cat selinux-tests.txt)"
203+
- name: Selinux - Collect test logs
204+
run: |
205+
# Create directories for SELinux test logs
206+
mkdir -p ${{ steps.vars.outputs.path_GNU_tests }}-selinux
207+
208+
# Copy the test logs from the Lima VM to the host
209+
lima bash -c "mkdir -p ~/work/gnu/tests-selinux && cp ~/work/gnu/tests/test-suite.log ~/work/gnu/tests-selinux/ || echo 'No test-suite.log found'"
210+
lima bash -c "cp ~/work/gnu/tests/test-suite-root.log ~/work/gnu/tests-selinux/ || echo 'No test-suite-root.log found'"
211+
rsync -a -e ssh lima-default:~/work/gnu/tests-selinux/ ./${{ steps.vars.outputs.path_GNU_tests }}-selinux/
212+
213+
# Copy SELinux logs to the main test directory for integrated processing
214+
cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/test-suite.log ${{ steps.vars.outputs.path_GNU_tests }}/selinux-test-suite.log || echo "No SELinux test-suite.log found"
215+
cp -f ${{ steps.vars.outputs.path_GNU_tests }}-selinux/test-suite-root.log ${{ steps.vars.outputs.path_GNU_tests }}/selinux-test-suite-root.log || echo "No SELinux test-suite-root.log found"
201216
202217
- name: Run GNU tests
203218
shell: bash
@@ -230,11 +245,13 @@ jobs:
230245
#
231246
SUITE_LOG_FILE='${{ steps.vars.outputs.SUITE_LOG_FILE }}'
232247
ROOT_SUITE_LOG_FILE='${{ steps.vars.outputs.ROOT_SUITE_LOG_FILE }}'
233-
ls -al ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE}
248+
SELINUX_SUITE_LOG_FILE='${{ steps.vars.outputs.SELINUX_SUITE_LOG_FILE }}'
249+
SELINUX_ROOT_SUITE_LOG_FILE='${{ steps.vars.outputs.SELINUX_ROOT_SUITE_LOG_FILE }}'
250+
ls -al ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE} ${SELINUX_SUITE_LOG_FILE} ${SELINUX_ROOT_SUITE_LOG_FILE}
234251
235252
if test -f "${SUITE_LOG_FILE}"
236253
then
237-
source ${path_UUTILS}/util/analyze-gnu-results.sh ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE}
254+
source ${path_UUTILS}/util/analyze-gnu-results.sh ${SUITE_LOG_FILE} ${ROOT_SUITE_LOG_FILE} ${SELINUX_SUITE_LOG_FILE} ${SELINUX_ROOT_SUITE_LOG_FILE}
238255
if [[ "$TOTAL" -eq 0 || "$TOTAL" -eq 1 ]]; then
239256
echo "::error ::Failed to parse test results from '${SUITE_LOG_FILE}'; failing early"
240257
exit 1
@@ -287,7 +304,11 @@ jobs:
287304
have_new_failures=""
288305
REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/test-suite.log'
289306
ROOT_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/test-suite-root.log'
307+
SELINUX_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/selinux-test-suite.log'
308+
SELINUX_ROOT_REF_LOG_FILE='${{ steps.vars.outputs.path_reference }}/test-logs/selinux-test-suite-root.log'
290309
REF_SUMMARY_FILE='${{ steps.vars.outputs.path_reference }}/test-summary/gnu-result.json'
310+
311+
291312
REPO_DEFAULT_BRANCH='${{ steps.vars.outputs.repo_default_branch }}'
292313
path_UUTILS='${{ steps.vars.outputs.path_UUTILS }}'
293314
# https://github.com/uutils/coreutils/issues/4294

util/run-gnu-test.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,13 @@ else
8282
# in case we would like to run tests requiring root
8383
if test -z "$1" -o "$1" == "run-root"; then
8484
if test -n "$CI"; then
85-
echo "Running check-root to run only root tests"
86-
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" || :
85+
if test $# -ge 2; then
86+
echo "Running check-root to run only selinux root tests"
87+
sudo "${MAKE}" -j "$("${NPROC}")" check-root TESTS="$SPECIFIC_TESTS" 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" || :
88+
else
89+
echo "Running check-root to run only root tests"
90+
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" || :
91+
fi
8792
fi
8893
fi
8994
fi

0 commit comments

Comments
 (0)