summaryrefslogtreecommitdiff
path: root/test/ruby/test_process.rb
AgeCommit message (Collapse)Author
2025-01-11merge revision(s) 8034e9c3d001ca3dff124ab42972684eac8af2ae: [Backport #20995]nagachika
[Bug #20995] Protect `IO.popen` block from exiting by exception
2024-11-06Pend some tests because these are not working with macOS 15 and Xcode 16Hiroshi SHIBATA
2024-08-18Allow waitpid(-1, Process::WNOHANG) to be woken if a waitpid(pid) isStan Hu
...pending If two threads are running, with one calling waitpid(-1, Process::WNOHANG), and another calling waitpid($some_pid), and then $some_other_pid exits, we would expect the waitpid(-1, Process::WNOHANG) call to retrieve that exit status. However, it cannot actually do so until $some_pid _also_ exits. This patch fixes the issue by calling do_waitpid unconditionally in waitpid_wait; this will ensure that a waitpid -1 actually reaps something (after first checking that no PID-directed call wants the process). [Bug #20490]
2024-07-06merge revision(s) a7ff264477105b5dc0ade6facad4176a1b73df0b: [Backport #20393]nagachika
Don't clear pending interrupts in the parent process. (#10365)
2023-09-09Allow waitpid(-1) to be woken if a waitpid(pid) call is pendingKJ Tsanaktsidis
If two threads are running, with one calling waitpid(-1), and another calling waitpid($some_pid), and then $some_other_pid exits, we would expect the waitpid(-1) call to retrieve that exit status; however, it cannot actually do so until $some_pid _also_ exits. This patch fixes the issue by unconditionally checking for pending process group waits on SIGCHLD, and then allowing pending pid-only waits to "steal" the notification. [Fixes #19387]
2022-12-15Remove `require 'io/wait'` where it's no longer necessary. (#6932)Samuel Williams
* Remove `require 'io/wait'` as it's part of core now. * Update ruby specs using version gates. * Add note about why it's conditional. Notes: Merged-By: ioquatix <samuel@codeotaku.com>
2022-11-27Make the timeout of test_system_sigpipe longerTakashi Kokubun
https://github.com/ruby/ruby/actions/runs/3562236318/jobs/5983796689
2022-09-20Ignore EPERM which means already being process-leaderNobuyoshi Nakada
2022-09-19Add another test for `Process.daemon`Nobuyoshi Nakada
Check for that the daemon process is detached, that means it is not a child and not waitable. Notes: Merged: https://github.com/ruby/ruby/pull/6402
2022-01-04Use omit instead of skip: test/ruby/**/*.rbHiroshi SHIBATA
2021-12-16Use `to_s` and `puts` in testsNobuyoshi Nakada
`to_s` has the explict specification while `inspect` is often vague.
2021-12-13Prepare for removing RubyVM::JIT (#5262)Takashi Kokubun
Notes: Merged-By: k0kubun <takashikkbn@gmail.com>
2021-10-25process.c: Add Process._fork (#5017)Yusuke Endoh
* process.c: Add Process._fork This API is supposed for application monitoring libraries to hook fork event. [Feature #17795] Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged-By: mame <mame@ruby-lang.org>
2021-10-07test/ruby/test_process (test_no_curdir): tentatively skipped on SolarisYusuke Endoh
The test gets stuck on Solaris CI. http://rubyci.s3.amazonaws.com/solaris11-gcc/ruby-master/log/20211006T050007Z.fail.html.gz#test-all ``` [14558/21042] TestProcess#test_no_curdirtimeout: output interval exceeds 1800.0 seconds. timeout: the process group 3857 is alive. ``` Related to ee89543e09a2d4e4c503267c248ba7bfffa668cb
2021-10-04Fix regression on Solaris after change to use realpath on loaded featuresJeremy Evans
After the change to use realpath on loaded features, Solaris CI started failing in test_no_curdir (which tests behavior for running ruby without a working directory). I was able to trace the problem to the following call chain: rb_call_inits->Init_Thread->Init_thread_sync->rb_provide-> get_loaded_features_index->rb_check_realpath->rb_dir_getwd_ospath-> ruby_getcwd This will throw an exception, but because Ruby hasn't been fully initialized at the point the exception is thrown, it just exits with a status of 1. The bug here is that rb_check_realpath should not raise an exception, it should return nil. This bug is hit on Solaris because Solaris uses the realpath emulation instead of native realpath, and the realpath emualation raised instead of returning nil if the mode was RB_REALPATH_CHECK. Use rb_rescue in the realpath emulation if the mode is RB_REALPATH_CHECK, and swallow any exceptions raised and return nil. Notes: Merged: https://github.com/ruby/ruby/pull/4935
2021-10-04Revert rescue around internal realpath call on SolarisJeremy Evans
Solaris CI still has a problem even with these commits, so it doesn't appear to fix the issue. Reverting both 84e8e2a39bba874433b661bd378165bd03c9d6aa and bfd2f159f0c60ef8ac5bce6042edd25a571769b7.
2021-10-04Only rescue realpath calls during require on SolarisJeremy Evans
Remove temporary skip of test_no_curdir to see if this fixes the problem. Notes: Merged: https://github.com/ruby/ruby/pull/4931
2021-10-02Temporarily skip test_no_curdir test to avoid CI failures on SolarisJeremy Evans
2021-09-14Handle overwriting Object::ENV in spawnJeremy Evans
Instead of looking for Object::ENV (which can be overwritten), directly look for the envtbl variable. As that is static in hash.c, and the lookup code is in process.c, add a couple non-static functions that will return envtbl (or envtbl#to_hash). Fixes [Bug #18164] Notes: Merged: https://github.com/ruby/ruby/pull/4834
2021-06-29Prefer qualified names under ThreadNobuyoshi Nakada
2021-05-17[Win32] long path name support [Bug #12551]Gabriel Nagy
Implement long path support on Windows by applying Microsoft's recommended application manifest. To make this work on both Visual C++ and MinGW, include the manifest as a resource when generating the resource files. This way it will be embedded into the executables generated by both compilers. It's important for the manifest resource to have ID 1, otherwise GCC will embed a default manifest. Note that in addition to this, the user needs to have [long paths enabled] either by modifying the registry or by enabling a group policy. [long paths enabled]: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org> Notes: Merged: https://github.com/ruby/ruby/pull/4505 Merged-By: nobu <nobu@ruby-lang.org>
2021-01-13Rename RubyVM::MJIT to RubyVM::JITTakashi Kokubun
because the name "MJIT" is an internal code name, it's inconsistent with --jit while they are related to each other, and I want to discourage future JIT implementation-specific (e.g. MJIT-specific) APIs by this rename. [Feature #17490]
2020-12-24Store errno in struct rb_process_statusNobuyoshi Nakada
To propagate errno in the fiber thread scheduler hook. Returns nil when no terminated process. Notes: Merged: https://github.com/ruby/ruby/pull/3998
2020-12-16Fixed marshal compatibility of Process::StatusNobuyoshi Nakada
2020-12-11RDoc states that Process::Status.wait returns nil if cannot waitNobuyoshi Nakada
2020-12-09Add support for non-blocking `Process.wait`.Samuel Williams
Notes: Merged: https://github.com/ruby/ruby/pull/3853
2020-12-04Guard all accesses to RubyVM::MJIT with defined?(RubyVM::MJIT) &&Benoit Daloze
* Otherwise those tests, etc cannot run on alternative Ruby implementations.
2020-05-30test/ruby/test_process.rb: GID.from_name may raise Errno:ESRCHYusuke Endoh
getgrnam(3) says: ``` ERRORS 0 or ENOENT or ESRCH or EBADF or EPERM or ... The given name or gid was not found. ``` Process::GID.from_name raises an ArgumentError for 0, but Errno::ESRCH for ESRCH. Actually, WSL 2 raises Errno::ESRCH. This change accepts all exceptions above.
2020-05-10Run rb_syswait on exec failureTakashi Kokubun
not only when !w but also when w == WAITPID_LOCK_ONLY. See also: f7c0cc36920a4ed14a3ab1ca6cfdf18ceff1e5d5 and a2264342063260d660b99872eaf5080f6ab08e81. We thought this change was an oversight in the latter commit. Without this change, the test fails like: $ make test-all TESTS="../test/ruby/test_process.rb -n test_exec_failure_leaves_no_child" RUN_OPTS="--jit" ... 1) Failure: TestProcess#test_exec_failure_leaves_no_child [/home/k0kubun/src/github.com/ruby/ruby/test/ruby/test_process.rb:2493]: Expected [[26799, #<Process::Status: pid 26799 exit 127>]] to be empty. Co-Authored-By: Yusuke Endoh <mame@ruby-lang.org>
2020-04-17test/ruby/test_process.rb: Skip GID.from_name on AndroidYusuke Endoh
The user management on Android seems very different https://rubyci.org/logs/rubyci.s3.amazonaws.com/android28-x86_64/ruby-master/log/20200416T234122Z.fail.html.gz
2020-04-16Preserve encoding in error messages for invalid user/group nameNobuyoshi Nakada
2020-04-16Added tests for Process::UID.from_name and Process::GID.from_nameNobuyoshi Nakada
2020-04-16Preserve encoding in error message for invalid env exec optionNobuyoshi Nakada
2020-04-16Added test for invalid env exec optionNobuyoshi Nakada
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