Christian Franke wrote:
Jon Turney wrote:
---
  .github/workflows/cygwin.yml      |  22 +-
  winsup/testsuite/stress/cygstress | 603 ++++++++++++++++++++++++++++++


Attached is a minor update of my local version for current Cygwin and stress-ng HEADs. Mostly changed comments, but also adds "pty" to CI. This works (on main only) thanks to the "termios: Implement tcflow(), tcdrain(), TCXONC, TIOCINQ" patch.


Another update on top of the above. It uses Windows own taskkill tool instead of Sysinternals pskill as suggested by Jeremy Drake on cygwin-apps.

Testcase:

./cygstress mprotect

This nasty test runs mprotect(ptr, size, flags) in seven child processes on same mmap()ed region with random address ranges and PROT_* flags.

--
Regards,
Christian




diff --git a/cygstress b/cygstress
index 9e31325..21e4cb1 100644
--- a/cygstress
+++ b/cygstress
@@ -17,7 +17,6 @@ Usage: ${0##*/} [OPTION...] {CI|WORK|FAIL|test...}
   -n        print commands only (dry-run)
   -f        force execution of tests tagged 'heavy' or 'admin'
   -c LIST   set CPU affinity to LIST
-  -k PATH   tool to stop hanging tests [default: pskill]
   -s PATH   stress-ng executable [default: stress-ng]
   -t N      run each test for at least N seconds [default: 5]
   -w N      start N workers for each test [default: 2]
@@ -237,7 +236,7 @@ stress_tests='
   module        # -----
   monte-carlo   # WORKS
   mpfr          # WORKS     # uses libmpfr
-  mprotect      # FAILS     # TODO Cygwin: crashes or hangs
+  mprotect      # FAILS     # TODO Cygwin: crashes or hangs and then ignores 
SIGKILL
   mq            # FAILS     # TODO undecided: "fail: ... mq_[timed]receive 
failed, errno=1"
                             # (fixed in Cygwin 3.5.6: crash on invalid mq fd)
   mremap        # -----
@@ -444,10 +443,6 @@ stress_tests='
   zombie        # WORKS,CI
 '
 
-# SIGKILL may not work if stress-ng hangs.
-# Use Sysinternals 'pskill' as no 'killall --force' is available,
-killall_force="pskill"
-
 stress_ng="stress-ng"
 timeout=5; workers=2
 dryrun=false; force=false
@@ -456,7 +451,6 @@ taskset=
 while :; do case $1 in
   -c) shift; taskset=$1 ;;
   -f) force=true ;;
-  -k) shift; killall_force=$1 ;;
   -n) dryrun=true ;;
   -s) shift; stress_ng=$1 ;;
   -t) shift; timeout=$1 ;;
@@ -476,7 +470,10 @@ esac; shift; done
 $run_ci || $run_work || $run_fail || [ ${run_tests:+t} ] || usage
 
 command -V "$stress_ng" >/dev/null || exit 1
-command -V "$killall_force" >/dev/null || exit 1
+
+# SIGKILL may not work if stress-ng hangs.
+# Use Windows 'taskkill' as no 'killall --force' is available.
+command -V taskkill >/dev/null || exit 1
 
 stress_ng_name=${stress_ng##*/}
 tempdir=${TMP:-/tmp}
@@ -490,8 +487,8 @@ find_stress()
 
 stop_stress()
 {
-  echo '$' "$killall_force" "$stress_ng_name"
-  "$killall_force" "$stress_ng_name" ||:
+  echo '$' taskkill /F /T /IM "${stress_ng_name}.exe"
+  taskkill /F /T /IM "${stress_ng_name}.exe" ||:
 }
 
 total=0
@@ -529,12 +526,12 @@ stress()
 
   local ok=true
   if wait $watchdog; then
-    echo ">>> FAILURE: $name" "$@" "(command hangs)"
     sleep 2
+    echo ">>> FAILURE: $name" "$@" "(command hangs)"
     ok=false
   fi
 
-  local n=0 p
+  local p
   if p=$(find_stress); then
     echo ">>> FAILURE: $name" "$@" "(processes left, exit status $rc):"
     echo "$p"

Reply via email to