[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[patch] remove Ruby bindings tests dependency on win32utils

From: Joe Swatosh <joe.swatosh_at_gmail.com>
Date: 2007-03-16 07:32:58 CET

Hi kou,

The patch is as the subject line.

Your fixes to fs are working here.

[[[
* subversion/bindings/swig/ruby/test/windows_util.rb
  use `sc` instead of Win32::Service to manage the
  svnserve used to test the client. Leave the service
  running the whole time the tests are up to try to
  save some time.
]]]

--
Joe
Index: subversion/bindings/swig/ruby/test/windows_util.rb
===================================================================
--- subversion/bindings/swig/ruby/test/windows_util.rb  (revision 23864)
+++ subversion/bindings/swig/ruby/test/windows_util.rb  (working copy)
@@ -3,52 +3,48 @@
 module SvnTestUtil
   module Windows
     module Svnserve
-      begin
-        require 'win32/service'
+      SERVICE_NAME = 'test-svn-server'
+
+      def first_pass?
+        @@first_pass = defined? @@first_pass
+      end
-        SERVICE_NAME = 'test-svn-server'
+      def service_control command, args={}
+        arg = args.inject( ''){|a,p| a << "#{p[0]}= \"#{p[1]}\" " }
+        the_command = "sc #{command} #{SERVICE_NAME} #{arg}"
+        `#{the_command}`
+      end
-        def setup_svnserve
-          @svnserve_port = @svnserve_ports.first
-          @repos_svnserve_uri = "svn://#{@svnserve_host}:#{@svnserve_port}"
+      def setup_svnserve
+        @svnserve_port = @svnserve_ports.first
+        @repos_svnserve_uri = "svn://#{@svnserve_host}:#{@svnserve_port}"
-          unless Win32::Service.exists?(SERVICE_NAME)
-            # Here we assume that svnserve is going available on the path when
-            # the service starts.  So use "svnserve" unqualified.  This isn't
-            # normally how I'd recommend installing a windows service, but for
-            # running these tests it is a significantly simplifying assumption.
-            # We can't even test for svnserve being on the path here because
-            # when the service starts, it'll be running as LocalSystem and the
-            # new process may actually have a different path than we have here.
-
-            Win32::Service.new.create_service do |s|
-              s.service_name = SERVICE_NAME
-              root = @full_repos_path.tr('/','\\')
-              s.binary_path_name = "svnserve"
-              s.binary_path_name << " --service"
-              s.binary_path_name << " --root \"#{root}\""
-              s.binary_path_name << " --listen-host #{@svnserve_host}"
-              s.binary_path_name << " --listen-port #{@svnserve_port}"
-            end.close
-            at_exit{Win32::Service.delete(SERVICE_NAME)}
+        if first_pass?
+          # Here we assume that svnserve is going available on the path when
+          # the service starts.  So use "svnserve" unqualified.  This isn't
+          # normally how I'd recommend installing a windows service, but for
+          # running these tests it is a significantly simplifying assumption.
+          # We can't even test for svnserve being on the path here because
+          # when the service starts, it'll be running as LocalSystem and the
+          # new process may actually have a different path than we have here.
+          #
+          # Start the service and just let it run to try to save some time.
+          root = @full_repos_path.tr('/','\\')
+          binary_path_name = "svnserve"
+          binary_path_name << " --service"
+          binary_path_name << " --root \"#{root}\""
+          binary_path_name << " --listen-host #{@svnserve_host}"
+          binary_path_name << " --listen-port #{@svnserve_port}"
+          service_control 'create', 'binPath' => binary_path_name,
'DisplayName' => SERVICE_NAME
+          service_control 'start'
+          at_exit do
+            service_control 'stop'
+            service_control 'delete'
           end
-
-          Win32::Service.start(SERVICE_NAME)
         end
+      end
-        def teardown_svnserve
-          Win32::Service.stop(SERVICE_NAME) rescue Win32::ServiceError
-        end
-      rescue LoadError
-        puts "Testing with file:// instead of svn://."
-        puts "Install win32-service to enable testing with svnserve."
-
-        def setup_svnserve
-          @repos_svnserve_uri = @repos_uri
-        end
-
-        def teardown_svnserve
-        end
+      def teardown_svnserve
       end
       def add_pre_revprop_change_hook
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Mar 16 07:33:12 2007

This is an archived mail posted to the Subversion Dev mailing list.