[Win32utils-devel] test_services test case

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Sat Jan 31 22:08:56 EST 2004

While working on win32-service-0.3.0 I got hung up trying to resolve that 
"RPC server is unavailable" error message that was popping up on some 
systems.  I couldn't duplicate this on my XP Pro box, but it does show up on 
my Win2k box.

Quick review - this is the test case from tc_service.rb

def test_services
      assert_nothing_raised{ Service.services{ } }
      assert_raises(NotImplementedError){ Service.services } # no non-block
      a = []
      Service.services{ |s| a.push(s) }

I added some more information to the error messages, and it turns out that 
the failure is caused by the call to OpenSCManager() in the services() 
function in service.c.  As far as I can tell, the only reason for this to 
happen would have something to do with the way TestUnit calls the tests.

I discovered two interesting things while tinkering with this test case.  
First, If I remove the 2nd assertion (assert_raises) the test passes fine.  
Second, if I add a "sleep 1" after the "assert raises", I get a different 
error: "Invalid access to memory location.".

I think this is a quirk of TestUnit myself, and can safely be ignored, 
although I wouldn't mind a code review of the services() function after I 
post 0.3.0.  I will note this oddity in the documentation.



Check out the coupons and bargains on MSN Offers! 

More information about the win32utils-devel mailing list