summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
AgeCommit message (Collapse)Author
2020-03-07Removed unnecessary `chomp`Nobuyoshi Nakada
As `String#split` with the default argument drops trailing newline as a separator, preceding `String#chomp` is futile.
2020-02-11Restart timer thread even after preparation failedNobuyoshi Nakada
If the timer thread is left stopped, memory crash or segfault can happen.
2020-02-07Removed useless empty linesNobuyoshi Nakada
2019-12-17test/ruby/test_process.rb: suppress "unused variable" warningYusuke Endoh
2019-12-16Kernel#abort without arguments should print error infoNobuyoshi Nakada
[Bug #16424] Notes: Merged: https://github.com/ruby/ruby/pull/2754
2019-10-15Try to avoid random failureKazuhiro NISHIYAMA
https://rubyci.org/logs/rubyci.s3.amazonaws.com/openbsd-current/ruby-master/log/20191015T070011Z.fail.html.gz ``` 1) Failure: TestProcess#test_kill_at_spawn_failure [/home/chkbuild/chkbuild/tmp/build/20191015T070011Z/ruby/test/ruby/test_process.rb:2276]: [ruby-core:69304] [Bug #11166]. <#<Thread:0x000009f60a7cac40@/home/chkbuild/chkbuild/tmp/build/20191015T070011Z/ruby/test/ruby/test_process.rb:2272 dead>> expected but was <nil>. ``
2019-09-09Make test-all and test-spec runnable on AndroidYusuke Endoh
Calling some syscall functions such as Dir.chroot causes SIGSYS instead of EPERM on Android. This change skips all tests that stops the test-suite run.
2019-08-06Give up stabilizing TestProcess on Travis osxTakashi Kokubun
They have been too unstable. Revert "Extend sleep before sending USR1 in TestProcess" This reverts commit aaf69a8ba866193863a7eafe5c6044844bd71bc3. Revert "Extend sleep before sending USR1 in TestProcess" This reverts commit 076f3fcf11a061394d3d5f8c671512df1e983023.
2019-08-05Refined assertion messagesNobuyoshi Nakada
2019-08-05Fixed assertionNobuyoshi Nakada
The regexp should be expected to match the error message.
2019-08-04Extend sleep before sending USR1 in TestProcessTakashi Kokubun
just like 076f3fcf11a061394d3d5f8c671512df1e983023. This test also hanged on Travis osx https://travis-ci.org/ruby/ruby/jobs/567547060
2019-08-01Extend sleep before sending USR1 in TestProcessTakashi Kokubun
because the test seems to hang there forever: https://travis-ci.org/ruby/ruby/jobs/566409880
2019-06-30Removed unused variablesNobuyoshi Nakada
2019-05-31Keep vm->orig_progname aliveAlan Wu
`vm->orig_progname` can be different from `vm->progname` when user code assigns to `$0`. While `vm->progname` is kept alive by the global table, nothing marked `vm->orig_progname`. [Bug #15887]
2019-05-26test/ruby/test_process.rb: Use EnvUtil.timeout for timeout scale factorYusuke Endoh
https://rubyci.org/logs/rubyci.s3.amazonaws.com/solaris11s-sunc/ruby-master/log/20190526T052508Z.fail.html.gz
2018-12-26test/ruby/test_process.rb (test_execopts_uid): rescue Errno::EACCESmame
The tests fail under the following condition: * executed as a root * the code is in a directory that uid:30000 user cannot access (e.g., /root) So, this change rescues Errno::EACCES explicitly. Also, this change adds `exception: true` to `Kernel#system` calls. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-17Fix test failure if ENV["USER"] doesn't match Process.euidnormal
When dropping privileges to run tests, ENV["USER"] could be set to a user that doesn't match Process.euid, which causes this test to fail with Errno::EPERM. Try to get the name for the current euid, and only fallback to ENV["USER"] if that doesn't work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66428 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-16Refine error message for time intervalnobu
* time.c (time_timespec): Time interval value can be zero, not only positive. [ruby-dev:50709] [Bug #15420] From: shuujii (Shuji KOBAYASHI) <shuujii@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-12-03process.c: fix ETXTBUSY from MJIT compiler processnormal
This affects test/ruby/test_process.rb (test_execopt_env_path). Since MJIT uses vfork+execve in a separate thread, there can be small window in-between vfork and execve where tmp_script.cmd is held open by the vforked child. vfork only pauses the MJIT thread, not any Ruby Threads, so our call to Process.spawn will hit ETXTBUSY in that window unless we fork. main thread | MJIT thread ---------------------------------------------------- fd = open(tmp) | | | vfork for CC | CC running write | | --------------- fchmod | | sees "fd" here close(fd) | | Process.spawn called | | vfork (spawn)| (new process) | | | execve => TXTBUSY | | | | | execve (FD_CLOEXEC on fd) | | vfork returns | Holding the waitpid_lock whenever we intend to spawn a process prevents the MJIT thread from spawning a process while we are spawning in Ruby-land. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66171 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-22io + socket: make pipes and sockets nonblocking by defaultnormal
All normal Ruby IO methods (IO#read, IO#gets, IO#write, ...) are all capable of appearing to be "blocking" when presented with a file description with the O_NONBLOCK flag set; so there is little risk of incompatibility within Ruby-using programs. The biggest compatibility risk is when spawning external programs. As a result, stdin, stdout, and stderr are now always made blocking before exec-family calls. This change will make an event-oriented MJIT usable if it is waiting on pipes on POSIX_like platforms. It is ALSO necessary to take advantage of (proposed lightweight concurrency (aka "auto-Fiber") or any similar proposal for network concurrency: https://bugs.ruby-lang.org/issues/13618 Named-pipe (FIFO) are NOT yet non-blocking by default since they are rarely-used and may introduce compatibility problems and extra syscall overhead for a common path. Please revert this commit if there are problems and if I am afk since I am afk a lot, lately. [ruby-core:89950] [Bug #14968] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65922 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20Skip known MJIT random test failuresk0kubun
Let me silence this until I have time to work on them, and make the CI usable for testing other features. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65893 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-20process.c: do not try to pause MJITk0kubun
while child handler is disabled. trying to fix [Bug #15320] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65817 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19test_process.rb: Process.daemon seems irrelevant [ci skip]k0kubun
in the backtrace: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1468677 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65816 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-19revert r65807k0kubun
it didn't work. http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1468677 and skips broken tests for now. But this issue should be fixed soon. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65814 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07Generalize r65594nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-11-07test_process.rb: avoid test failure by r65588k0kubun
on macOS. https://travis-ci.org/ruby/ruby/jobs/451709313 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22revisit more MJIT test skipsk0kubun
r65308 passed both trunk-mjit and trunk-mjit-wait CIs. MJIT copy job looks working fine. Then this commit skips 5 more tests. Some of them were skipped in a very early stage and may still need to be skipped, but I want to confirm them since they haven't been changed for a long time. And this prefers having inline information on `RubyVM::MJIT.enabled?`. This commit makes it easier to confirm whether there's suspicious test skip by RubyVM::MJIT.enabled? or not. After this commit, tentatively we're not skipping tests for MJIT other than `assert_no_memory_leak` ones. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65311 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-22revert r65292 and r65297k0kubun
now mjit CIs are stable. Let me try this to confirm if it's fixed or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-10-21skip 2 tests for MJIT for nowk0kubun
These tests seem to be broken by r65275. Let me skip this to confirm if other things are fine or not. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65292 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-17passing non-stdio fds is not supported on Windowsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-16process.c: defaults to close_others falsenormal
Arbitrarily closing file descriptors on exec breaks use cases where a Ruby process sets up a descriptor for non-Ruby children to use. For example, the "rake foo" target may spawn any number of subprocesses (Ruby or not) which depends on parsing the "FOO" environment variable for out_fd:99 and writing to foo.out FOO=out_fd:99 rake foo 99>>foo.out Unfortunately, this introduced one incompatibility in test/lib/test/unit.rb and it now requires explicitly setting IO#close_on_exec=true [ruby-core:88007] [Misc #14907] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64399 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-13thread_pthread.c: eliminate timer thread by restructuring GVLnormal
This reverts commit 194a6a2c68e9c8a3536b24db18ceac87535a6051 (r64203). Race conditions which caused the original reversion will be fixed in the subsequent commit. [ruby-core:88360] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64352 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-06thread_pthread.c: restore timer-thread for now :<normal
[ruby-core:88306] Revert "process.c: ensure th->interrupt lock is held when migrating" This reverts commit 5ca416bdf6b6785cb20f139c2c514eda005fe42f (r64201) Revert "process.c (rb_waitpid): reduce sigwait_fd bouncing" This reverts commit 217bdd776fbeea3bfd0b9324eefbfcec3b1ccb3e (r64200). Revert "test/ruby/test_thread.rb (test_thread_timer_and_interrupt): add timeouts" This reverts commit 9f395f11202fc3c7edbd76f5aa6ce1f8a1e752a9 (r64199). Revert "thread_pthread.c (native_sleep): reduce ppoll sleeps" This reverts commit b3aa256c4d43d3d7e9975ec18eb127f45f623c9b (r64193). Revert "thread.c (consume_communication_pipe): do not retry after short read" This reverts commit 291a82f748de56e65fac10edefc51ec7a54a82d4 (r64185). Revert "test/ruby/test_io.rb (test_race_gets_and_close): timeout each thread" This reverts commit 3dbd8d1f66537f968f0461ed8547460b3b1241b3 (r64184). Revert "thread_pthread.c (gvl_acquire_common): persist timeout across calls" This reverts commit 8c2ae6e3ed072b06fc3cbc34fa8a14b2acbb49d5 (r64165). Revert "test/ruby/test_io.rb (test_race_gets_and_close): use SIGABRT on timeout" This reverts commit 931cda4db8afd6b544a8d85a6815765a9c417213 (r64135). Revert "thread_pthread.c (gvl_yield): do ubf wakeups when uncontended" This reverts commit 508f00314f46c08b6e9b0141c01355d24954260c (r64133). Revert "thread_pthread.h (native_thread_data): split condvars on some platforms" This reverts commit a038bf238bd9a24bf1e1622f618a27db261fc91b (r64124). Revert "process.c (waitpid_nogvl): prevent conflicting use of sleep_cond" This reverts commit 7018acc946882f21d519af7c42ccf84b22a46b27 (r64117). Revert "thread_pthread.c (rb_sigwait_sleep): th may be 0 from MJIT" This reverts commit 56491afc7916fb24f5c4dc2c632fb93fa7063992 (r64116). Revert "thread*.c: waiting on sigwait_fd performs periodic ubf wakeups" This reverts commit ab47a57a46e70634d049e4da20a5441c7a14cdec (r64115). Revert "thread_pthread.c (gvl_destroy): make no-op on GVL bits" This reverts commit 95cae748171f4754b97f4ba54da2ae62a8d484fd (r64114). Revert "thread_pthread.c (rb_sigwait_sleep): fix uninitialized poll set in UBF case" This reverts commit 4514362948fdb914c6138b12d961d92e9c0fee6c (r64113). Revert "thread_pthread.c (rb_sigwait_sleep): re-fix [Bug #5343] harder" This reverts commit 26b8a70bb309c7a367b9134045508b5b5a580a77 (r64111). Revert "thread.c: move ppoll wrapper into thread_pthread.c" This reverts commit 3dc7727d22fecbc355597edda25d2a245bf55ba1 (r64110). Revert "thread.c: move ppoll wrapper before thread_pthread.c" This reverts commit 2fa1e2e3c3c5c4b3ce84730dee4bcbe9d81b8e35 (r64109). Revert "thread_pthread.c (ubf_select): refix [Bug #5343]" This reverts commit 4c1ab82f0623eca91a95d2a44053be22bbce48ad (r64108). Revert "thread_win32.c: suppress warnings by -Wsuggest-attribute" This reverts commit 6a9b63e39075c53870933fbac5c1065f7d22047c (r64159). Revert "thread_pthread: remove timer-thread by restructuring GVL" This reverts commit 708bfd21156828526fe72de2cedecfaca6647dc1 (r64107). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64203 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-08-05test/ruby/test_process.rb (test_wait_and_sigchld): allow extra SIGCHLDnormal
MJIT way generate an extra SIGCHLD, so we'll have to deal with it. Any realistic Ruby program may hit unexpected SIGCHLD, too, since any spawned subprocess could have extra grandchildren which get reaped by the main Ruby process, and SIGCHLD may be sent spuriously by an external process using kill(2) syscall (via kill(1) or Process.kill). cf. http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1194620 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64194 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29thread_pthread: remove timer-thread by restructuring GVLnormal
To reduce resource use and reduce CI failure; remove timer-thread. Single-threaded Ruby processes (including forked children) will never see extra thread overhead. This prevents glibc and jemalloc from going into multi-threaded mode and initializing locks or causing fragmentation via arena explosion. The GVL is implements its own wait-queue as a ccan/list to permit controlling wakeup order. Timeslice under contention is handled by a designated timer thread (similar to choosing a "patrol_thread" for current deadlock checking). There is only one self-pipe, now, as wakeups for timeslice are done independently using condition variables. This reduces FD pressure slightly. Signal handling is handled directly by a Ruby Thread (instead of timer-thread) by exposing signal self-pipe to callers of rb_thread_fd_select, native_sleep, rb_wait_for_single_fd, etc... Acquiring, using, and releasing the self-pipe is exposed via 4 new internal functions: 1) rb_sigwait_fd_get - exclusively acquire timer_thread_pipe.normal[0] 2) rb_sigwait_fd_sleep - sleep and wait for signal (and no other FDs) 3) rb_sigwait_fd_put - release acquired result from rb_sigwait_fd_get 4) rb_sigwait_fd_migrate - migrate signal handling to another thread after calling rb_sigwait_fd_put. rb_sigwait_fd_migrate is necessary for waitpid callers because only one thread can wait on self-pipe at a time, otherwise a deadlock will occur if threads fight over the self-pipe. TRAP_INTERRUPT_MASK is now set for the main thread directly in signal handler via rb_thread_wakeup_timer_thread. Originally, I wanted to use POSIX timers (timer_create/timer_settime) for this. Unfortunately, this proved unfeasible as Mutex#sleep resumes on spurious wakeups and test/thread/test_cv.rb::test_condvar_timed_wait failed. Using pthread_sigmask to mask out SIGVTALRM fixed that test, but test/fiddle/test_function.rb::test_nogvl_poll proved there'd be some unavoidable (and frequent) incompatibilities from that approach. Finally, this allows us to drop thread_destruct_lock and interrupt current ec directly. We don't need to rely on vm->thread_destruct_lock or a coherent vm->running_thread on any platform. Separate timer-thread for time slice and signal handling is relegated to thread_win32.c, now. [ruby-core:88088] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64107 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-29test/ruby/test_process.rb (test_wait_and_sigchld): improve reliabilitynormal
This should fix CI failure under MJIT, 100ms wait may not be enough for signal handler to fire: http://ci.rvm.jp/results/trunk-mjit@silicon-docker/1169472 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64105 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05unrevert r63852 but keep SIGCHLD path disabled for win32normal
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...) on that platform will never conflict with mjit use of waitpid. In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h so it can be easy for Linux/BSD users to test (hopefully!) win32-compatible code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-04Revert r63758 and related commitsnaruse
The change is unstable on Windows. Please re-commit it when it correctly supports Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-29test_process.rb (test_wait_exception): check assertion soonernormal
To diagnose f.puts => EPIPE failures in CI(*). I'm not sure what's wrong and can't reproduce EPIPE even with my slow laptop from 2005. (*) http://ci.rvm.jp/results/trunk_gcc5@silicon-docker/1058203 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63786 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27tests: increase timeouts and speedup some slow testsnormal
I'm still using the computer from 2005, so enabling MJIT makes some tests take longer. For test_deadlock_by_signal_at_forking I got it down to 135s to 89s by disabling RubyGems. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63774 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-27Revert "test_process.rb: skip tests for Bug 14867"normal
This reverts r63740 (commit 042395a7f7262464265ce70cdffbe1812aa145d3). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63759 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-24test_process.rb: skip tests for Bug 14867k0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63740 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-15gettimeofday is obsoletenobu
* test/ruby/test_process.rb gettimeofday is obsolete in SUSv4, and may not be available in the future. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63671 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22test_process.rb: assert minimum maxgroupsnobu
* test/ruby/test_process.rb (TestProcess#test_maxgroups): maxgroups should be one at least. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62519 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-21test_process.rb: unlimited getgroups on darwinnobu
* test/ruby/test_process.rb (TestProcess#test_maxgroups): Darwin extension of getgroups(2) which is not limited to MAXGROUPS is used. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62516 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31io.c: fptr_copy_finalizernobu
* io.c (fptr_copy_finalizer): remove fptr from pipe_list when pipe became ordinary file, to fix access after free. to be finalized by pipe_finalize and being in pipe_list must match. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62123 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31io.c: pipe_register_fptrnobu
* io.c (pipe_register_fptr): get rid of double registration which causes access after free and segfault. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-31trick ruby-mode.el by heredocsnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-01-06test_process.rb: skip not-found groupsnobu
* test/ruby/test_process.rb (test_execopts_gid): under some network configuration (maybe with Open Directory but disconnected temporarily), some groups may fail to find. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61637 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-25test/ruby/test_process.rb: get rid of timing issuenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61476 b2dd03c8-39d4-4d8f-98ff-823fe69b080e