diff --git a/.github/workflows/GnuTests.yml b/.github/workflows/GnuTests.yml index 55c57080821..f55ead26ae1 100644 --- a/.github/workflows/GnuTests.yml +++ b/.github/workflows/GnuTests.yml @@ -27,6 +27,7 @@ env: DEFAULT_BRANCH: ${{ github.event.repository.default_branch }} TEST_FULL_SUMMARY_FILE: 'gnu-full-result.json' TEST_ROOT_FULL_SUMMARY_FILE: 'gnu-root-full-result.json' + TEST_STTY_FULL_SUMMARY_FILE: 'gnu-stty-full-result.json' TEST_SELINUX_FULL_SUMMARY_FILE: 'selinux-gnu-full-result.json' TEST_SELINUX_ROOT_FULL_SUMMARY_FILE: 'selinux-root-gnu-full-result.json' @@ -137,12 +138,34 @@ jobs: path_GNU='gnu' path_UUTILS='uutils' bash "uutils/util/run-gnu-test.sh" run-root + - name: Extract testing info from individual logs (run as root) into JSON shell: bash run : | path_UUTILS='uutils' python uutils/util/gnu-json-result.py gnu/tests > ${{ env.TEST_ROOT_FULL_SUMMARY_FILE }} + ### This shell has been changed from "bash" to this command + ### "script" will start a pty and the -q command removes the "script" initiation log + ### the -e flag makes it propagate the error code and -c runs the command in a pty + ### the primary purpose of this change is to run the tty GNU tests + ### The reason its separated from the rest of the tests is because one test can corrupt the other + ### tests through the use of the shared terminal and it changes the environment that the other + ### tests are run in, which can cause different results. + - name: Run GNU stty tests + shell: 'script -q -e -c "bash {0}"' + run: | + ## Run GNU root tests + path_GNU='gnu' + path_UUTILS='uutils' + bash "uutils/util/run-gnu-test.sh" run-tty + + - name: Extract testing info from individual logs (stty) into JSON + shell: bash + run : | + path_UUTILS='uutils' + python uutils/util/gnu-json-result.py gnu/tests > ${{ env.TEST_STTY_FULL_SUMMARY_FILE }} + ### Upload artifacts - name: Upload full json results uses: actions/upload-artifact@v5 @@ -154,6 +177,12 @@ jobs: with: name: gnu-root-full-result path: ${{ env.TEST_ROOT_FULL_SUMMARY_FILE }} + - name: Upload stty json results + uses: actions/upload-artifact@v5 + with: + name: gnu-stty-full-result + path: ${{ env.TEST_STTY_FULL_SUMMARY_FILE }} + - name: Compress test logs shell: bash run : | @@ -358,6 +387,13 @@ jobs: name: gnu-root-full-result path: results merge-multiple: true + - name: Download stty json results + uses: actions/download-artifact@v6 + with: + name: gnu-stty-full-result + path: results + merge-multiple: true + - name: Download selinux json results uses: actions/download-artifact@v6 with: @@ -380,7 +416,7 @@ jobs: path_UUTILS='uutils' json_count=$(ls -l results/*.json | wc -l) - if [[ "$json_count" -ne 4 ]]; then + if [[ "$json_count" -ne 5 ]]; then echo "::error ::Failed to download all results json files (expected 4 files, found $json_count); failing early" ls -lR results || true exit 1 diff --git a/util/run-gnu-test.sh b/util/run-gnu-test.sh index 7fa52f84ee0..43eb25f66c5 100755 --- a/util/run-gnu-test.sh +++ b/util/run-gnu-test.sh @@ -54,7 +54,18 @@ if test $# -ge 1; then done fi -if [[ "$1" == "run-root" && "$has_selinux_tests" == true ]]; then +if [[ "$1" == "run-tty" ]]; then + # Handle TTY tests - dynamically find tests requiring TTY and run each individually + shift + TTY_TESTS=$(grep -r "require_controlling_input_terminal" tests --include="*.sh" --include="*.pl" -l 2>/dev/null) + echo "Running TTY tests individually:" + # If a test fails, it can break the implementation of the other tty tests. By running them separately this stops the different tests from being able to break each other + for test in $TTY_TESTS; do + echo " Running: $test" + script -qec "timeout -sKILL 5m '${MAKE}' check TESTS='$test' SUBDIRS=. RUN_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit='' srcdir='${path_GNU}'" /dev/null || : + done + exit 0 +elif [[ "$1" == "run-root" && "$has_selinux_tests" == true ]]; then # Handle SELinux root tests separately shift if test -n "$CI"; then @@ -63,7 +74,7 @@ if [[ "$1" == "run-root" && "$has_selinux_tests" == true ]]; then sudo "${MAKE}" -j "$("${NPROC}")" check 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" || : fi exit 0 -elif test "$1" != "run-root"; then +elif test "$1" != "run-root" && test "$1" != "run-tty"; then if test $# -ge 1; then # if set, run only the tests passed SPECIFIC_TESTS="" @@ -91,7 +102,7 @@ fi # * `srcdir=..` specifies the GNU source directory for tests (fixing failing/confused 'tests/factor/tNN.sh' tests and causing no harm to other tests) #shellcheck disable=SC2086 -if test "$1" != "run-root"; then +if test "$1" != "run-root" && test "$1" != "run-tty"; then # run the regular tests if test $# -ge 1; then timeout -sKILL 4h "${MAKE}" -j "$("${NPROC}")" check TESTS="$SPECIFIC_TESTS" SUBDIRS=. RUN_EXPENSIVE_TESTS=yes RUN_VERY_EXPENSIVE_TESTS=yes VERBOSE=no gl_public_submodule_commit="" srcdir="${path_GNU}" || : # Kill after 4 hours in case something gets stuck in make