aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_signal.rb
Commit message (Collapse)AuthorAgeFilesLines
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-181-5/+0
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Wait for the helper thread to terminateNobuyoshi Nakada2019-06-301-0/+1
|
* Removed unused variablesNobuyoshi Nakada2019-06-281-1/+0
|
* thread_pthread.c: main thread always gets hit by signalsnormal2018-08-251-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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
* test/ruby/test_signal.rb (test_sigchld_ignore): increase timeoutnormal2018-07-131-1/+1
| | | | | | | 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
* test/ruby/test_signal.rb: skip ensure if test is skippednormal2018-07-081-1/+1
| | | | | | 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
* signal.c: preserve trap(:CHLD, "IGNORE") behavior with SIGCHLDnormal2018-07-081-0/+43
| | | | | | | | | 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
* test/ruby/test_signal.rb: speedup some test by disabling RubyGemsnormal2018-07-031-13/+14
| | | | | | 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
* signal.c: refine error messagesnobu2018-03-101-0/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62716 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* signal.c: check NUL bytesnobu2018-03-101-0/+2
| | | | | | | * 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
* test_signal.rb: fix arguments ordernobu2018-03-061-4/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62679 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* remove ruby_kill() introduced for [Bug #7951].ko12017-06-121-0/+14
| | | | | | | | | | | | | | | | | | * 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
* Signal.list deduplicates keysnormal2016-01-261-0/+6
| | | | | | | | | | 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
* Add frozen_string_literal: false for all filesnaruse2015-12-161-0/+1
| | | | | | 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
* signal.c: nil for invalid signumnobu2015-03-021-0/+9
| | | | | | | * 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
* * test/lib/envutil.rb: Moved from test/ruby/.akr2014-11-131-1/+0
| | | | | | | | | | | | | | * 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
* signal.c: get rid of deadlock by discarded signalsnobu2014-10-071-0/+5
| | | | | | | | | * 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
* signal.c: send signal unless handlednobu2014-10-061-0/+7
| | | | | | | * 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
* signal.c: SIGEXIT is not a system signalnobu2014-09-211-0/+8
| | | | | | | | * 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
* test_signal.rb: remove stale testnobu2014-09-211-25/+0
| | | | | | | | * 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
* signal.c: EINVAL is a failurenobu2014-09-211-0/+8
| | | | | | | | * 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
* signal.c: preserve encodingnobu2014-07-301-0/+2
| | | | | | | * 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
* signal.c: directly enqueuenobu2014-05-101-0/+11
| | | | | | | * 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
* test_signal.rb: test iff SIGQUIT is supportednobu2014-05-101-1/+1
| | | | | | | * 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
* * signal.c (trap): Return "SYSTEM_DEFAULT" if SIG_DFL is set.akr2014-05-091-0/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45894 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_signal.rb: missing argvnobu2014-05-091-1/+1
| | | | | | * 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
* test_beginendblock.rb, test_signal.rb: run with default handlernobu2014-05-091-0/+3
| | | | | | | | | * 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
* signal.c: preserve encodingnobu2014-03-311-0/+1
| | | | | | * 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
* test/unit/assertions.rb: return exceptionnobu2013-10-091-3/+1
| | | | | | | | | * 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
* test_signal.rb: use standard fdsnobu2013-06-191-17/+13
| | | | | | | | * 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
* test_signal.rb: use SIGINT if needednobu2013-06-191-3/+4
| | | | | | | * 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
* test_signal.rb: use assert_in_out_errnobu2013-06-191-43/+15
| | | | | | | * 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
* test/ruby: reap zombiesnobu2013-06-191-3/+9
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_signal.rb: extra quotesnobu2013-06-191-1/+1
| | | | | | | * 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
* thread.c: fix deadlocknobu2013-03-211-1/+7
| | | | | | | * 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
* * test/ruby/test_signal.rb (test_hup_me): skip if HUP isn't supported.shirosaki2013-03-201-0/+2
| | | | | | On Windows this test causes ArgumentError. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/ruby/test_signal.rb (test_hup_me): added a few comments.kosaki2013-03-191-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39829 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * internal.h: added a declaration of ruby_kill().kosaki2013-03-191-0/+7
| | | | | | | | | | | | | | | | | | | | * 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
* * test/ruby/test_signal.rb (test_trap_puts): Fix typo. "sync"kosaki2013-01-311-1/+1
| | | | | | should be "STDOUT.sync". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38997 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * thread.c (struct rb_mutex_struct): add allow_trap field.kosaki2012-11-281-0/+13
| | | | | | | | | | | | | | * 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
* * test/ruby/test_signal.rb (TestSignal#test_signame): fix windowskosaki2012-11-201-3/+3
| | | | | | | | | 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
* Don't send INT signal itself.naruse2012-11-201-11/+13
| | | | | | 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
* * signal.c (sig_signame): implements Signal.signame methodkosaki2012-11-191-0/+18
| | | | | | | | | | [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
* Revert r35622.naruse2012-05-111-1/+1
| | | | | | | | 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
* * thread.c (rb_threadptr_execute_interrupts_common): th->errinfo isnaruse2012-05-111-1/+1
| | | | | | | | | 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
* Embed backtrace to debug.naruse2012-05-031-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35535 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * signal.c (reserved_signal_p): reverted a part of r32523.kosaki2011-07-121-6/+0
| | | | | | | | | | 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
* * signal.c (sig_trap): don't permit to change a signal handler whichkosaki2011-07-121-0/+25
| | | | | | | | | | | | | 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
* * test/ruby/test_signal.rb (TestSignal#test_signal_requiring): usenobu2011-06-171-5/+3
| | | | | | 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
* * test/ruby/test_signal.rb (TestSignal#test_signal_requiring):akr2011-06-011-1/+1
| | | | | | | redirect stderr to null device. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31896 b2dd03c8-39d4-4d8f-98ff-823fe69b080e