Forum: Ruby-dev Error in TestEnv#test_memory_leak_* on Solaris

205ca9566e14fb669ed977cae5af88e0?d=identicon&s=25 unknown (Guest)
on 2014-07-08 11:42
(Received via mailing list)
Issue #10010 has been updated by Naohisa Goto.


以下のように test/ruby/test_env.rb を実行すると、なぜか、
uninitialized constant EnvUtil::RbConfig (NameError) になります。
実行に使ったrubyはr46751で、svnレポジトリのローカルコピーr46756 の test/ruby/test_env.rb
を相対パス指定にて直接実行した結果のものです。

~~~
 $ ruby test/ruby/test_env.rb
Run options:

# Running tests:

[22/49] TestEnv#test_memory_leak_aset = 0.15 s
  1) Failure:
TestEnv#test_memory_leak_aset [test/ruby/test_env.rb:514]:
[ruby-dev:48323] [Bug #9977].
<[true, ""]> expected but was
<[false,
 "/XXXXX/test/ruby/find_executable.rb:3:in `find_executable':
uninitialized constant EnvUtil::RbConfig (NameError)\n\tfrom
/XXXXX/test/ruby/memory_status.rb:87:in `<module:Memory>'\n\tfrom
/XXXXX/test/ruby/memory_status.rb:1:in `<top (required)>'\n\tfrom -:1:in
`require'\n"]>.

[23/49] TestEnv#test_memory_leak_select = 0.06 s
  2) Failure:
TestEnv#test_memory_leak_select [test/ruby/test_env.rb:525]:
[ruby-dev:48325] [Bug #9978].
<[true, ""]> expected but was
<[false,
 "/XXXXX/test/ruby/find_executable.rb:3:in `find_executable':
uninitialized constant EnvUtil::RbConfig (NameError)\n\tfrom
/XXXXX/test/ruby/memory_status.rb:87:in `<module:Memory>'\n\tfrom
/XXXXX/test/ruby/memory_status.rb:1:in `<top (required)>'\n\tfrom -:1:in
`require'\n"]>.

[24/49] TestEnv#test_memory_leak_shift = 0.06 s
  3) Failure:
TestEnv#test_memory_leak_shift [test/ruby/test_env.rb:543]:
[ruby-dev:48332] [Bug #9983].
<[true, ""]> expected but was
<[false,
 "/XXXXX/test/ruby/find_executable.rb:3:in `find_executable':
uninitialized constant EnvUtil::RbConfig (NameError)\n\tfrom
/XXXXX/test/ruby/memory_status.rb:87:in `<module:Memory>'\n\tfrom
/XXXXX/test/ruby/memory_status.rb:1:in `<top (required)>'\n\tfrom -:1:in
`require'\n"]>.

Finished tests in 0.608052s, 80.5852 tests/s, 596.9886 assertions/s.
49 tests, 363 assertions, 3 failures, 0 errors, 0 skips

ruby -v: ruby 2.2.0dev (2014-07-07) [sparc64-solaris2.10]
~~~


----------------------------------------
Bug #10010: Error in TestEnv#test_memory_leak_* on Solaris
https://bugs.ruby-lang.org/issues/10010#change-47642

* Author: Naohisa Goto
* Status: Closed
* Priority: Normal
* Assignee: Nobuyoshi Nakada
* Category:
* Target version: current: 2.2.0
* ruby -v: ruby 2.2.0dev (2014-07-04) [sparc64-solaris2.10]
* Backport: 2.0.0: UNKNOWN, 2.1: UNKNOWN
----------------------------------------
r46550 くらい以降、Solaris 10 にて make test-all 中、以下のエラーが発生します。
(r44686 にて確認)

test/envutil.rb の 438行目にて、:size や :rss
用の情報が、OS側の何らかの理由で示されず、その結果ハッシュにも格納されず、 a または b が nil
になることがあるのに、それに対応していないのが原因と思います。

なお、Solaris では、/proc/self/status は struct  pstatus_t
の内容のバイナリを返しますが、それには全く対応していないので、nil
になるか、偶然バイナリ値が何かに一致した場合にでたらめな値が返されるかのいずれかになります。

~~~
 53) Error:
TestEnv#test_memory_leak_shift:
NoMethodError: undefined method `>' for nil:NilClass
    /XXXXX/test/ruby/envutil.rb:438:in `block in assert_no_memory_leak'
    /XXXXX/test/ruby/envutil.rb:435:in `each'
    /XXXXX/test/ruby/envutil.rb:435:in `assert_no_memory_leak'
    /XXXXX/test/ruby/test_env.rb:543:in `test_memory_leak_shift'

 54) Error:
TestEnv#test_memory_leak_select:
NoMethodError: undefined method `>' for nil:NilClass
    /XXXXX/test/ruby/envutil.rb:438:in `block in assert_no_memory_leak'
    /XXXXX/test/ruby/envutil.rb:435:in `each'
    /XXXXX/test/ruby/envutil.rb:435:in `assert_no_memory_leak'
    /XXXXX/test/ruby/test_env.rb:525:in `test_memory_leak_select'

 55) Error:
TestEnv#test_memory_leak_aset:
NoMethodError: undefined method `>' for nil:NilClass
    /XXXXX/test/ruby/envutil.rb:438:in `block in assert_no_memory_leak'
    /XXXXX/test/ruby/envutil.rb:435:in `each'
    /XXXXX/test/ruby/envutil.rb:435:in `assert_no_memory_leak'
    /XXXXX/test/ruby/test_env.rb:514:in `test_memory_leak_aset'

~~~
This topic is locked and can not be replied to.