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

ruby-changes:34083

From: hsbt <ko1@a...>
Date: Tue, 27 May 2014 19:03:17 +0900 (JST)
Subject: [ruby-changes:34083] hsbt:r46164 (trunk): * test/openssl/test_pair.rb: Modify TestSSL#test_read_and_write

hsbt	2014-05-27 19:03:09 +0900 (Tue, 27 May 2014)

  New Revision: 46164

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

  Log:
    * test/openssl/test_pair.rb: Modify TestSSL#test_read_and_write
      to handle partial sysreads. [Bug #7398][ruby-core:49563]
    * test/openssl/test_ssl.rb: ditto.

  Modified files:
    trunk/ChangeLog
    trunk/test/openssl/test_pair.rb
    trunk/test/openssl/test_ssl.rb
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 46163)
+++ ChangeLog	(revision 46164)
@@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1
+Tue May 27 19:01:49 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
+
+	* test/openssl/test_pair.rb: Modify TestSSL#test_read_and_write
+	  to handle partial sysreads. [Bug #7398][ruby-core:49563]
+	* test/openssl/test_ssl.rb: ditto.
+
 Tue May 27 18:46:23 2014  SHIBATA Hiroshi  <shibata.hiroshi@g...>
 
 	* test/openssl/test_pkcs7.rb: Add tests for PKCS7#type= and add_data.
Index: test/openssl/test_pair.rb
===================================================================
--- test/openssl/test_pair.rb	(revision 46163)
+++ test/openssl/test_pair.rb	(revision 46164)
@@ -112,9 +112,13 @@ module OpenSSL::TestPairM https://github.com/ruby/ruby/blob/trunk/test/openssl/test_pair.rb#L112
     ssl_pair {|s1, s2|
       s2.write "a\nbcd"
       assert_equal("a\n", s1.gets)
-      assert_equal("bcd", s1.readpartial(10))
+      result = ""
+      result << s1.readpartial(10) until result.length == 3
+      assert_equal("bcd", result)
       s2.write "efg"
-      assert_equal("efg", s1.readpartial(10))
+      result = ""
+      result << s1.readpartial(10) until result.length == 3
+      assert_equal("efg", result)
       s2.close
       assert_raise(EOFError) { s1.readpartial(10) }
       assert_raise(EOFError) { s1.readpartial(10) }
Index: test/openssl/test_ssl.rb
===================================================================
--- test/openssl/test_ssl.rb	(revision 46163)
+++ test/openssl/test_ssl.rb	(revision 46164)
@@ -78,13 +78,17 @@ class OpenSSL::TestSSL < OpenSSL::SSLTes https://github.com/ruby/ruby/blob/trunk/test/openssl/test_ssl.rb#L78
         ITERATIONS.times{|i|
           str = "x" * 100 + "\n"
           ssl.syswrite(str)
-          assert_equal(str, ssl.sysread(str.size))
+          newstr = ''
+          newstr << ssl.sysread(str.size - newstr.size) until newstr.size == str.size
+          assert_equal(str, newstr)
 
           str = "x" * i * 100 + "\n"
           buf = ""
           ssl.syswrite(str)
           assert_equal(buf.object_id, ssl.sysread(str.size, buf).object_id)
-          assert_equal(str, buf)
+          newstr = buf
+          newstr << ssl.sysread(str.size - newstr.size) until newstr.size == str.size
+          assert_equal(str, newstr)
         }
 
         # puts and gets

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

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