[前][次][番号順一覧][スレッド一覧]

ruby-changes:37790

From: ko1 <ko1@a...>
Date: Fri, 6 Mar 2015 18:22:36 +0900 (JST)
Subject: [ruby-changes:37790] ko1:r49871 (trunk): * test/webrick/test_filehandler.rb: on vboxsf (on VirtualBox

ko1	2015-03-06 18:22:21 +0900 (Fri, 06 Mar 2015)

  New Revision: 49871

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49871

  Log:
    * test/webrick/test_filehandler.rb: on vboxsf (on VirtualBox
      on Windows 7), file name and permissions are strange (can access
      by short file name and so on).
      Simply skip on such tests on such FS. To detect strange FS, this
      patch use a part of code `File.executable?(__FILE__)`.
      Please correct them if there are better ways.

  Modified files:
    trunk/ChangeLog
    trunk/test/webrick/test_filehandler.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 49870)
+++ ChangeLog	(revision 49871)
@@ -1,8 +1,18 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Fri Mar  6 18:19:13 2015  Koichi Sasada  <ko1@a...>
+
+	* test/webrick/test_filehandler.rb: on vboxsf (on VirtualBox
+	  on Windows 7), file name and permissions are strange (can access
+	  by short file name and so on).
+
+	  Simply skip on such tests on such FS. To detect strange FS, this
+	  patch use a part of code `File.executable?(__FILE__)`.
+	  Please correct them if there are better ways.
+
 Fri Mar  6 17:31:29 2015  Koichi Sasada  <ko1@a...>
 
 	* test/ruby/test_beginendblock.rb: do not change directory.
 
-	  Run system command in the directory mounted by vboxfs on Windows 7
+	  Run system command in the directory mounted by vboxsf on Windows 7
 	  and get warning like that "warning: Insecure world writable dir...".
 
 Fri Mar  6 10:31:00 2015  Nobuyoshi Nakada  <nobu@r...>
Index: test/webrick/test_filehandler.rb
===================================================================
--- test/webrick/test_filehandler.rb	(revision 49870)
+++ test/webrick/test_filehandler.rb	(revision 49871)
@@ -166,7 +166,7 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L166
   def test_non_disclosure_name
     config = { :DocumentRoot => File.dirname(__FILE__), }
     log_tester = lambda {|log, access_log|
-      log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
+      log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
       log = log.reject {|s| /WARN  the request refers nondisclosure name/ =~ s }
       assert_equal([], log)
     }
@@ -193,10 +193,12 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L193
   end
 
   def test_directory_traversal
+    return if File.executable?(__FILE__) # skip on strange file system
+
     config = { :DocumentRoot => File.dirname(__FILE__), }
     log_tester = lambda {|log, access_log|
       log = log.reject {|s| /ERROR bad URI/ =~ s }
-      log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
+      log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
       assert_equal([], log)
     }
     TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|
@@ -222,13 +224,15 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L224
   end
 
   def test_short_filename
+    return if File.executable?(__FILE__) # skip on strange file system
+
     config = {
       :CGIInterpreter => TestWEBrick::RubyBin,
       :DocumentRoot => File.dirname(__FILE__),
       :CGIPathEnv => ENV['PATH'],
     }
     log_tester = lambda {|log, access_log|
-      log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
+      log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
       log = log.reject {|s| /WARN  the request refers nondisclosure name/ =~ s }
       assert_equal([], log)
     }
@@ -262,6 +266,8 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L266
   end
 
   def test_script_disclosure
+    return if File.executable?(__FILE__) # skip on strange file system
+
     config = {
       :CGIInterpreter => TestWEBrick::RubyBin,
       :DocumentRoot => File.dirname(__FILE__),
@@ -276,7 +282,7 @@ class WEBrick::TestFileHandler < Test::U https://github.com/ruby/ruby/blob/trunk/test/webrick/test_filehandler.rb#L282
       },
     }
     log_tester = lambda {|log, access_log|
-      log = log.reject {|s| /ERROR `.*' not found\./ =~ s }
+      log = log.reject {|s| /ERROR `.*\' not found\./ =~ s }
       assert_equal([], log)
     }
     TestWEBrick.start_httpserver(config, log_tester) do |server, addr, port, log|

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]