diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 10:03:09 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-05-27 10:03:09 +0000 |
commit | 6eb8acae90ce774c054f0ea9b393df5a7601ffd7 (patch) | |
tree | f4fca7398c743aa49b83e4144c07124449e15b16 | |
parent | 08e9b7d66c7279dec72dceedfe1ba81cd8c64d46 (diff) | |
download | ruby-6eb8acae90ce774c054f0ea9b393df5a7601ffd7.tar.gz |
* 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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | test/openssl/test_pair.rb | 8 | ||||
-rw-r--r-- | test/openssl/test_ssl.rb | 8 |
3 files changed, 18 insertions, 4 deletions
@@ -1,3 +1,9 @@ +Tue May 27 19:01:49 2014 SHIBATA Hiroshi <shibata.hiroshi@gmail.com> + + * 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@gmail.com> * test/openssl/test_pkcs7.rb: Add tests for PKCS7#type= and add_data. diff --git a/test/openssl/test_pair.rb b/test/openssl/test_pair.rb index c7cfd69129..c2ad735d2a 100644 --- a/test/openssl/test_pair.rb +++ b/test/openssl/test_pair.rb @@ -112,9 +112,13 @@ module OpenSSL::TestPairM 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) } diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 339451e7be..23dc572870 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -78,13 +78,17 @@ class OpenSSL::TestSSL < OpenSSL::SSLTestCase 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 |