mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2025-07-26 08:55:57 +02:00
73 lines
2.1 KiB
Diff
73 lines
2.1 KiB
Diff
From ec27b6250c2a00b4f2720abd86669e194ca016ac Mon Sep 17 00:00:00 2001
|
|
From: MSP-Greg <Greg.mpls@gmail.com>
|
|
Date: Fri, 21 May 2021 11:24:15 -0500
|
|
Subject: [PATCH] Update test_processes.rb
|
|
|
|
---
|
|
tests/test_processes.rb | 35 +++++++++++++++++++++++++++--------
|
|
1 file changed, 27 insertions(+), 8 deletions(-)
|
|
|
|
diff --git a/tests/test_processes.rb b/tests/test_processes.rb
|
|
index eb21a6cec..9546022e7 100644
|
|
--- a/tests/test_processes.rb
|
|
+++ b/tests/test_processes.rb
|
|
@@ -32,23 +32,42 @@ def setup
|
|
end
|
|
|
|
def test_em_system
|
|
+ out, status = nil, nil
|
|
+
|
|
EM.run{
|
|
- EM.system('ls'){ |out,status| $out, $status = out, status; EM.stop }
|
|
+ EM.system('ls'){ |_out,_status| out, status = _out, _status; EM.stop }
|
|
}
|
|
|
|
- assert( $out.length > 0 )
|
|
- assert_equal(0, $status.exitstatus)
|
|
- assert_kind_of(Process::Status, $status)
|
|
+ assert(out.length > 0 )
|
|
+ assert_kind_of(Process::Status, status)
|
|
+ assert_equal(0, status.exitstatus)
|
|
+ end
|
|
+
|
|
+ def test_em_system_bad_exitstatus
|
|
+ status = nil
|
|
+ sys_pid = nil
|
|
+
|
|
+ EM.run{
|
|
+ sys_pid = EM.system('exit 1'){ |_out,_status| status = _status; EM.stop }
|
|
+ }
|
|
+
|
|
+ assert_kind_of(Process::Status, status)
|
|
+ refute_equal(0, status.exitstatus)
|
|
+ assert_equal sys_pid, status.pid
|
|
end
|
|
|
|
def test_em_system_pid
|
|
- $pids = []
|
|
+ status = nil
|
|
+ sys_pid = nil
|
|
|
|
EM.run{
|
|
- $pids << EM.system('echo hi', proc{ |out,status|$pids << status.pid; EM.stop })
|
|
+ sys_pid = EM.system('echo hi', proc{ |_out,_status| status = _status; EM.stop })
|
|
}
|
|
|
|
- assert_equal $pids[0], $pids[1]
|
|
+ refute_equal(0, sys_pid)
|
|
+ assert_kind_of(Process::Status, status)
|
|
+ refute_equal(0, status.pid)
|
|
+ assert_equal sys_pid, status.pid
|
|
end
|
|
|
|
def test_em_system_with_proc
|
|
@@ -57,8 +76,8 @@ def test_em_system_with_proc
|
|
}
|
|
|
|
assert( $out.length > 0 )
|
|
- assert_equal(0, $status.exitstatus)
|
|
assert_kind_of(Process::Status, $status)
|
|
+ assert_equal(0, $status.exitstatus)
|
|
end
|
|
|
|
def test_em_system_with_two_procs
|