summaryrefslogtreecommitdiff
path: root/test/ruby/test_signal.rb
AgeCommit message (Collapse)Author
2018-08-25thread_pthread.c: main thread always gets hit by signalsnormal
We need to ensure Signal.trap handlers can function if the main thread is sleeping after a subthread has grabbed sigwait_fd, but later exited. Consider the following timeline: main_thread sub-thread ----------------------------------------- Signal.trap() { ... } get sigwait_fd ppoll on sigwait_fd native_cond_sleep (via pthread_cond_wait) ppoll times-out put sigwait_fd sub-thread exits only thread alive SIGNAL HITS The problem is pthread_cond_wait cannot return EINTR, so we can never run the Signal.trap handler. So we will avoid using native_cond_sleep in the main thread and always use ppoll to sleep when in the main thread. This can guarantee the main thread remains aware of signals; even if it cannot safely read off sigwait_fd git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-13test/ruby/test_signal.rb (test_sigchld_ignore): increase timeoutnormal
I suspect CI test machine was overloaded at the time, or swapping at the time due to parallel build with mjit. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63962 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08test/ruby/test_signal.rb: skip ensure if test is skippednormal
Thanks to Greg for the fix. [ruby-core:87860] [Bug #14867] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63880 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-08signal.c: preserve trap(:CHLD, "IGNORE") behavior with SIGCHLDnormal
We need to preserve "IGNORE" behavior from Ruby 2.5 and earlier. We can't rely on SA_NOCLDWAIT any more, since we always need system() and MJIT to work; so we fake that behavior using dedicated reaper (currently in timer-thread). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63879 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-03test/ruby/test_signal.rb: speedup some test by disabling RubyGemsnormal
test_signame_delivered is reduced from 1.0s to 0.1s git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63831 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-10signal.c: refine error messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-10signal.c: check NUL bytesnobu
* signal.c (trap_signm): check NUL bytes explicitly before raising "unsupported signal" ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62715 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-06test_signal.rb: fix arguments ordernobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-12remove ruby_kill() introduced for [Bug #7951].ko1
* thread.c (rbuy_kill): removed. This function is used with SIGSEGV, SIGBUS, SIGKILL, SIGILL, SIGFPE and SIGSTOP and these signals are affect immediately. So that `kill(2)' is enough for them. * signal.c (rb_f_kill): ditto. * vm_core.h (rb_thread_t::interrupt_cond): removed because only `ruby_kill()' uses this field. * test/ruby/test_signal.rb: Without this patch sending SIGSTOP to own process wait another interrupt even if another process sends SIGCONT. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59066 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-01-26Signal.list deduplicates keysnormal
This allows us to reuse string objects used in symbols as well as any string representations of signal names in source code. * signal.c (sig_list): use fstring for hash key * test/ruby/test_signal.rb (test_signal_list_dedupe_keys): added git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-12-16Add frozen_string_literal: false for all filesnaruse
When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-03-02signal.c: nil for invalid signumnobu
* signal.c (sig_signame): return nil if the argument is a valid signal number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49801 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-07signal.c: get rid of deadlock by discarded signalsnobu
* signal.c (rb_f_kill): get rid of deadlock as unhandled and discarded signals do not make interrupt_cond signaled. based on the patch by Kazuki Tsujimoto at [ruby-dev:48606]. [Bug #9820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47832 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-10-06signal.c: send signal unless handlednobu
* signal.c (rb_f_kill): should not ignore signal unless the default handler is registered. [ruby-dev:48592] [Bug #9820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21signal.c: SIGEXIT is not a system signalnobu
* signal.c (trap): SIGEXIT is not a system signal and is dealt with internally, so it should not try to register the system signal handler by sigaction. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47669 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21test_signal.rb: remove stale testnobu
* test/ruby/test_signal.rb (TestSignal#test_trap_system_default): remove stale test. signals are delivered to the main thread always now, so sleep in sub thread is no longer interrupted. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47665 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-21signal.c: EINVAL is a failurenobu
* signal.c (ruby_signal): although "EINVAL from sigaction(2) is not a bug", but even it is a failure. pointed at toRuby/guRuby in RubyHiroba. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47657 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-07-30signal.c: preserve encodingnobu
* signal.c (rb_f_kill, trap_signm): preserve argument encoding in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47007 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10signal.c: directly enqueuenobu
* signal.c (rb_f_kill): directly enqueue an ignored signal to self, except for SIGSEGV and SIGBUS. [ruby-dev:48203] [Bug #9820] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45911 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-10test_signal.rb: test iff SIGQUIT is supportednobu
* test/ruby/test_signal.rb (test_trap_system_default): test only if SIGQUIT is supported, which is platform dependent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45897 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09* signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.akr
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09test_signal.rb: missing argvnobu
* test/ruby/test_signal.rb (test_hup_me): add missing argv. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-05-09test_beginendblock.rb, test_signal.rb: run with default handlernobu
* test/ruby/test_beginendblock.rb (test_propagate_signaled): run with default handler. * test/ruby/test_signal.rb (test_hup_me): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45891 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-31signal.c: preserve encodingnobu
* signal.c (esignal_init): preserve encoding in error messages. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45483 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-10-09test/unit/assertions.rb: return exceptionnobu
* lib/test/unit/assertions.rb (assert_raise_with_message): return raised exception same as assert_raise. * test/ruby, test/-ext-: use assert_raise_with_message. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19test_signal.rb: use standard fdsnobu
* test/ruby/test_signal.rb (test_exit_action): use IO.popen and standard file descriptors instead of fd 3 and 4, which is not available on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41442 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19test_signal.rb: use SIGINT if needednobu
* test/ruby/test_signal.rb (test_kill_immediately_before_termination): use SIGINT if SIGUSR1 is not available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41441 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19test_signal.rb: use assert_in_out_errnobu
* test/ruby/test_signal.rb (test_kill_immediately_before_termination): use assert_in_out_err instead of separated fork and assert. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19test/ruby: reap zombiesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-06-19test_signal.rb: extra quotesnobu
* test/ruby/test_signal.rb (TestSignal#test_signal_process_group): remove extra quotes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41411 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-21thread.c: fix deadlocknobu
* thread.c (ruby_kill): get rid of deadlock on signal 0. [ruby-dev:47182] [Bug #8137] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39862 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-20* test/ruby/test_signal.rb (test_hup_me): skip if HUP isn't supported.shirosaki
On Windows this test causes ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19* test/ruby/test_signal.rb (test_hup_me): added a few comments.kosaki
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-03-19* internal.h: added a declaration of ruby_kill().kosaki
* thread.c (ruby_kill): helper function of kill(). * signal.c (rb_f_kill): use ruby_kill() instead of kill(). * signal.c (rb_f_kill): call rb_thread_execute_interrupts() to ensure that make SignalException if sent a signal to myself. [Bug #7951] [ruby-core:52864] * vm_core.h (typedef struct rb_thread_struct): added th->interrupt_cond. * thread.c (rb_threadptr_interrupt_common): added to initialization of th->interrupt_cond. * thread.c (thread_create_core): ditto. * test/ruby/test_signal.rb (TestSignal#test_hup_me): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39819 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-01-31* test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync"kosaki
should be "STDOUT.sync". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-28* thread.c (struct rb_mutex_struct): add allow_trap field.kosaki
* internal.h (rb_mutex_allow_trap): added. * thread.c (rb_mutex_lock, rb_mutex_unlock): check mutex->allow_trap. * thread.c (mutex_sleep): remove trap check because it uses rb_mutex_lock and rb_mutex_unlock internally. * thread.c (rb_mutex_allow_trap): new helper function for the above. * io.c (io_binwrite): mark fptr->write_lock as writable in trap. * test/ruby/test_signal.rb (test_trap_puts): test for the above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20* test/ruby/test_signal.rb (TestSignal#test_signame): fix windowskosaki
test failure. Process.kill on windows can't send a signal to another process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37747 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-20Don't send INT signal itself.naruse
On make test-all, it kills the process. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37736 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-11-19* signal.c (sig_signame): implements Signal.signame methodkosaki
[Feature #5613] * test/ruby/test_signal.rb (test_signame): adds test for above * NEWS: add an item about above git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11Revert r35622.naruse
It breaks bootstraptest/test_exception.rb:388. "* thread.c (rb_threadptr_execute_interrupts_common): th->errinfo is" git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35623 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-11* thread.c (rb_threadptr_execute_interrupts_common): th->errinfo isnaruse
not Fixnum, but exception object. This causes test_signal_requiring of test/ruby/test_signal.rb fail if the sub process is killed on waiting IO in lex_io_gets in require itself, not sleep. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35622 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-05-03Embed backtrace to debug.naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-12* signal.c (reserved_signal_p): reverted a part of r32523.kosaki
chikanaga noticed trap(:CHLD) has some realworld usecase. * test/ruby/test_signal.rb (TestSignal#test_reserved_signal): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32528 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-07-12* signal.c (sig_trap): don't permit to change a signal handler whichkosaki
the interpreter reserved. * signal.c (reserved_signal_p): ditto. [Bug #2616] [ruby-core:27625] * test/ruby/test_signal.rb (TestSignal#test_reserved_signal): added a test for reserved signal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32523 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-17* test/ruby/test_signal.rb (TestSignal#test_signal_requiring): usenobu
in-process signal to get rid of limitation of Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@32154 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-06-01* test/ruby/test_signal.rb (TestSignal#test_signal_requiring):akr
redirect stderr to null device. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-31* test/ruby/test_signal.rb (TestSignal#test_signal_requiring):akr
initialize SIGINT handler. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30* test/ruby/test_signal.rb (TestSignal#test_signal_requiring): don'takr
close stderr. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-05-30* test/ruby/test_signal.rb (TestSignal#test_signal_requiring): smallusa
but critical typo of r31642. sorry... [Bug #4798] [ruby-core:36550] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31824 b2dd03c8-39d4-4d8f-98ff-823fe69b080e