Don't echo the command being run
Capture stress-ng output to file
Only show test output if it fails

Capture all test output in an artifact
---
 .github/workflows/cygwin.yml      | 10 ++++++++++
 winsup/testsuite/stress/cygstress | 13 ++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/.github/workflows/cygwin.yml b/.github/workflows/cygwin.yml
index 871ec3d3a..face1dc96 100644
--- a/.github/workflows/cygwin.yml
+++ b/.github/workflows/cygwin.yml
@@ -255,5 +255,15 @@ jobs:
       run: |
         export PATH=/usr/bin:$(cygpath ${SYSTEMROOT})/system32
         uname -a
+        export LOGDIR=$(cygpath -a logs)
         winsup/testsuite/stress/cygstress CI
       shell: bash --noprofile --norc -o igncr -eo pipefail '{0}'
+
+    # upload logs artifact
+    - name: Capture logs artifact
+      uses: actions/upload-artifact@v4
+      with:
+        name: stress-logs-${{ matrix.pkgarch }}
+        path: |
+          logs
+      if: ${{ !cancelled() }}
diff --git a/winsup/testsuite/stress/cygstress 
b/winsup/testsuite/stress/cygstress
index 493ff3e8b..df5e13881 100755
--- a/winsup/testsuite/stress/cygstress
+++ b/winsup/testsuite/stress/cygstress
@@ -478,6 +478,9 @@ command -V "$killall_force" >/dev/null || exit 1
 
 stress_ng_name=${stress_ng##*/}
 tempdir=${TMP:-/tmp}
+logdir=${LOGDIR:-/tmp/logdir}
+
+mkdir -p ${logdir}
 
 find_stress()
 {
@@ -502,11 +505,11 @@ stress()
   shift || return 1
 
   local td="$tempdir/stress-ng.$$.$total.d"
-  local cmd=("$stress_ng" -v -M --oomable --timestamp --verify --temp-path 
"$td" -t "$timeout")
+  local logfile="$logdir/$name"
+  local cmd=("$stress_ng" -v -M --oomable --timestamp --verify --temp-path 
"$td" -t "$timeout" --log-file $logfile)
   test -z "$taskset" || cmd+=(--taskset "$taskset")
   cmd+=(--"$name" "$workers" "$@")
 
-  echo '$' "${cmd[@]}"
   ! $dryrun || return 0
 
   (
@@ -520,7 +523,7 @@ stress()
 
   mkdir "$td"
   local rc=0
-  "${cmd[@]}" || rc=$?
+  "${cmd[@]}" >/dev/null || rc=$?
 
   kill $watchdog 2>/dev/null ||:
   trap - SIGINT SIGTERM
@@ -547,14 +550,14 @@ stress()
   fi
 
   if ! $ok; then
-    echo
     return 1
   fi
   if [ $rc != 0 ]; then
+    cat ${logfile}
     echo ">>> FAILURE: $name" "$@" "(exit status $rc)"; echo
     return 1
   fi
-  echo ">>> SUCCESS: $name" "$@" ""; echo
+  echo ">>> SUCCESS: $name" "$@" ""
 }
 
 if p=$(find_stress); then
-- 
2.45.1

Reply via email to