17
17
18
18
g .test_start = function ()
19
19
process = Process :start (' /bin/sleep' , {' 5' })
20
- fiber .sleep (0.1 )
21
- t .assertEquals (os.execute (' ps -p ' .. process .pid .. ' > /dev/null' ), 0 )
20
+ t .helpers .retrying ({timeout = 0.5 }, function ()
21
+ t .assertEquals (os.execute (' ps -p ' .. process .pid .. ' > /dev/null' ), 0 )
22
+ end )
22
23
process :kill ()
23
- fiber .sleep (0.1 )
24
- t .assertNotEquals (os.execute (' ps -p ' .. process .pid .. ' > /dev/null' ), 0 )
24
+ t .helpers .retrying ({timeout = 0.5 }, function ()
25
+ t .assertNotEquals (os.execute (' ps -p ' .. process .pid .. ' > /dev/null' ), 0 )
26
+ end )
25
27
kill_after_test = false
26
28
end
27
29
@@ -41,11 +43,14 @@ g.test_chdir = function()
41
43
end
42
44
os.execute (' touch ./tmp/' .. file )
43
45
44
- Process :start (' /bin/cp' , {file , file_copy })
45
- fiber .sleep (0.1 )
46
- t .assertEquals (fio .stat (' ./tmp/' .. file_copy ), nil )
46
+ local proc = Process :start (' /bin/cp' , {file , file_copy })
47
+ t .helpers .retrying ({timeout = 0.5 }, function ()
48
+ t .assertNotEquals (os.execute (' ps -p ' .. proc .pid .. ' > /dev/null' ), 0 )
49
+ t .assertEquals (fio .stat (' ./tmp/' .. file_copy ), nil )
50
+ end )
47
51
48
52
Process :start (' /bin/cp' , {file , file_copy }, {}, {chdir = ' ./tmp' })
49
- fiber .sleep (0.1 )
50
- t .assertNotEquals (fio .stat (' ./tmp/' .. file_copy ), nil )
53
+ t .helpers .retrying ({timeout = 0.5 }, function ()
54
+ t .assertNotEquals (fio .stat (' ./tmp/' .. file_copy ), nil )
55
+ end )
51
56
end
0 commit comments