Commit c1d5b67b authored by Kirill Smelkov's avatar Kirill Smelkov

os/signal: Adjust signal_test_all.py to support Windows

- There is no e.g. signal.SIGKILL on windows:

    golang/os/signal_test.py::test_signal_all Traceback (most recent call last):
      File "Z:\home\kirr\src\tools\go\pygo-win\pygolang\golang\os\testprog\signal_test_all.py", line 82, in <module>
        main()
      File "Z:\home\kirr\src\tools\go\pygo-win\pygolang\golang\os\testprog\signal_test_all.py", line 39, in main
        allsigv.remove(syscall.SIGKILL) # SIGKILL/SIGSTOP cannot be caught
    AttributeError: module 'golang.syscall' has no attribute 'SIGKILL'. Did you mean: 'SIGILL'?

  -> filter-out signals conditionally depending on their presence.

- Need to also filter-out SIGILL/SIGABRT because upon reception MSVC
  runtime terminates process.
parent ca4af748
...@@ -36,11 +36,17 @@ def main(): ...@@ -36,11 +36,17 @@ def main():
if sig not in allsigv: # avoid e.g. SIGCHLD/SIGCLD dups if sig not in allsigv: # avoid e.g. SIGCHLD/SIGCLD dups
allsigv.append(sig) allsigv.append(sig)
allsigv.sort(key=lambda sig: sig.signo) allsigv.sort(key=lambda sig: sig.signo)
allsigv.remove(syscall.SIGKILL) # SIGKILL/SIGSTOP cannot be caught def without(signame):
allsigv.remove(syscall.SIGSTOP) sig = getattr(syscall, signame, None)
allsigv.remove(syscall.SIGBUS) # AddressSanitizer crashes on SIGBUS/SIGFPE/SIGSEGV if sig is not None:
allsigv.remove(syscall.SIGFPE) allsigv.remove(sig)
allsigv.remove(syscall.SIGSEGV) without('SIGKILL') # SIGKILL/SIGSTOP cannot be caught
without('SIGSTOP')
without('SIGBUS') # AddressSanitizer crashes on SIGBUS/SIGFPE/SIGSEGV
without('SIGFPE')
without('SIGSEGV')
without('SIGILL') # SIGILL/SIGABRT cause termination on windows
without('SIGABRT')
# Notify() -> kill * -> should be notified # Notify() -> kill * -> should be notified
ch = chan(10, dtype=gos.Signal) ch = chan(10, dtype=gos.Signal)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment