On Oct 29, 2009, at 11:17 AM, Student <blog...@pierian-spring.net> wrote:

forever.sh:
while true ; do sleep 5 ; done

tc_forks.rb
2.times do
 fork {`nohup sh forever.sh &`}
end

describe "We can do tests in the air" do

 it "Here is the first test" do
   1.should not_raise

1.should_not raise_error

 end
end


spec tc_forks_spec.rb
nohup: redirecting stderr to stdout
nohup: redirecting stderr to stdout
F

1)
NameError in 'We can do tests in the air Here is the first test'
undefined local variable or method `not_raise' for
#<Spec::Example::ExampleGroup::Subclass_1:0xb7a5005c>
./tc_forks_spec.rb:8:

Finished in 0.005975 seconds

1 example, 1 failure
nathan-desktop ~/work/rspec_multiple ps
 PID TTY          TIME CMD
10637 pts/2    00:00:00 bash
11010 pts/2    00:00:00 nedit
11286 pts/2    00:00:00 spec
11287 pts/2    00:00:00 spec
11288 pts/2    00:00:00 sh <defunct>
11289 pts/2    00:00:00 sh <defunct>
11290 pts/2    00:00:00 sh
11291 pts/2    00:00:00 sh
11300 pts/2    00:00:00 sleep
11301 pts/2    00:00:00 sleep
11303 pts/2    00:00:00 ps
nathan-desktop ~/work/rspec_multiple kill 11290
nathan-desktop ~/work/rspec_multiple nohup: redirecting stderr to
stdout
nohup: redirecting stderr to stdout
F

1)
NameError in 'We can do tests in the air Here is the first test'
undefined local variable or method `not_raise' for
#<Spec::Example::ExampleGroup::Subclass_1:0xb7a4e900>
./tc_forks_spec.rb:8:
./tc_forks_spec.rb:2:

Finished in 0.006251 seconds

1 example, 1 failure

nathan-desktop ~/work/rspec_multiple ps
 PID TTY          TIME CMD
10637 pts/2    00:00:00 bash
11010 pts/2    00:00:01 nedit
11286 pts/2    00:00:00 spec
11288 pts/2    00:00:00 sh <defunct>
11291 pts/2    00:00:00 sh
11346 pts/2    00:00:00 spec
11347 pts/2    00:00:00 spec
11348 pts/2    00:00:00 sh <defunct>
11349 pts/2    00:00:00 sh
11350 pts/2    00:00:00 sh <defunct>
11351 pts/2    00:00:00 sh
11436 pts/2    00:00:00 sleep
11437 pts/2    00:00:00 sleep
11438 pts/2    00:00:00 sleep
11439 pts/2    00:00:00 ps

There are variations here.  This particular example spawned two new
spec processes when I killed one of the sh process.   I thought it
worthwhile to publish the one that works. ;)




On Oct 29, 9:54 am, Ashley Moran <ashley.mo...@patchspace.co.uk>
wrote:
On Oct 29, 2009, at 12:28 pm, Student wrote:

No autoscript here. I don't doubt that there are wrappers that might
handle it, I was going for a solution in a bare rspec environment.

Still not sure I understand the problem.  Can you explain what you
mean by "getting them running without causing the tests to be rerun
when they stop is a bit..tricky"?  Can you paste output to illustrate
this?

Ashley

--http://www.patchspace.co.uk/http://www.linkedin.com/in/ashleymoranhttp://aviewfromafar.net/

_______________________________________________
rspec-users mailing list
rspec-us...@rubyforge.orghttp://rubyforge.org/mailman/listinfo/ rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to