[Win32utils-devel] test_services test case

win32utils-devel at rubyforge.org win32utils-devel at rubyforge.org
Sun Feb 1 20:32:22 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
> 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
>       a = []
>       Service.services{ |s| a.push(s) }
>       assert_kind_of(Struct::Win32Service,a.first)
> end
> 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.
After some debugging, I am confinced that there is some bug at assert_raise
in test\unit\assertions.rb related to block and yield. But I can't figure
How about comment out of the test assert_raises(NotImplementedError){
Service.services }
until further notice?


Park Heesob

More information about the win32utils-devel mailing list