From: Koji Arai Date: 2002-09-14T02:48:59+09:00 Subject: [ruby-dev:18285] rubicon on EWS4800 新井です。 rubicon をEWS4800で試しました。 この環境で rubicon を通すためのパッチを付けます。(暫定対処ば かりです) rubicon は、あまりいろんな環境に対応しようとする動きがないよ うな気もしますが、以下の問題があることをとりあえず報告致しま す。(というか処理の分岐が RUBY_PLATFORM なため、ちょっとやり にくい。ruby の挙動で処理を分けると ruby のテストにならない し、本当はこれは configure のようなやり方で事前に OS の振舞 いの調査が必要なのかも) # 本当は、前にも同様の現象を確認していたのですが、どうせ困 # るのは私だけだと思ってそのままにしてました(^^;しかし、 # rubicon バージョンアップの度に同じ修正を入れないといけな # いのがつらくなってきたので、とりあえず報告だけでもしてお # こうと思ったのでした。 diff -ru rubicon/builtin/HashBase.rb rubicon-ux48/builtin/HashBase.rb --- rubicon/builtin/HashBase.rb Sat Jan 5 23:35:05 2002 +++ rubicon-ux48/builtin/HashBase.rb Wed Sep 11 10:33:26 2002 @@ -376,6 +376,11 @@ keys = @h.keys expected = [] @h.each { |k, v| expected << k } + #p [keys,expected] + #keys.size.times {|i| + # p [keys[i], expected[i]] + # p [keys[i] == expected[i]] + #} assert_equal([], keys - expected) assert_equal([], expected - keys) end これは、なぜかこのコメントをつけないと ./HashBase.rb:379:in `to_str'(TestHash): wrong number of arguments(0 for 1) (ArgumentError) from ./HashBase.rb:379:in `==' from ./HashBase.rb:379:in `-' from ./HashBase.rb:379:in `test_keys' from ./../rubicon_tests.rb:238:in `handleTests' from TestHash.rb:14 っとエラーになってしまいます。謎です。(GCとか malloc とか C_ALLOCA とかのせいなんでしょう。おそらくEWS4800固有の問題だ と思うのでいつか暇があったときに調査しようと思います) diff -ru rubicon/builtin/TestFile.rb rubicon-ux48/builtin/TestFile.rb --- rubicon/builtin/TestFile.rb Mon Aug 5 00:20:49 2002 +++ rubicon-ux48/builtin/TestFile.rb Wed Sep 11 10:02:08 2002 @@ -176,7 +176,7 @@ MsWin32.dont do tests["_file3"] = "link" - tests["_sock"] = "socket" + # tests["_sock"] = "socket" end Linux.only do @@ -298,6 +298,7 @@ assert_equal("wombat\n", f.gets) assert_nil(f.puts("koala")) f.rewind + assert_equal("wombat\n", f.gets) assert_equal("wombat\n", f.gets) assert_equal("koala\n", f.gets) } EWS4800 では、SysV の STREAMS で、双方向パイプやソケットが実 装されていますが、Unix ドメインソケットファイルは外見え名前 付きパイプ "fifo" にしか見えません。で、前者の修正はとりあえ ずテストを飛ばしてます。後者はこれまた謎なのですが、このよう に修正しないとテストが通りません。(これも要調査・・・っと昔 から思ってるんだけどなかなか手がつけられない) diff -ru rubicon/builtin/TestFileTest.rb rubicon-ux48/builtin/TestFileTest.rb --- rubicon/builtin/TestFileTest.rb Wed Nov 28 09:10:21 2001 +++ rubicon-ux48/builtin/TestFileTest.rb Wed Sep 11 09:42:26 2002 @@ -118,7 +118,7 @@ end MsWin32.dont do - tests << [ :socket?, ?S, filesock, true ] + #tests << [ :socket?, ?S, filesock, true ] end Unix.or_variant do 上記と同様の理由です。 diff -ru rubicon/builtin/TestFile__Stat.rb rubicon-ux48/builtin/TestFile__Stat.rb --- rubicon/builtin/TestFile__Stat.rb Wed Nov 28 09:35:50 2001 +++ rubicon-ux48/builtin/TestFile__Stat.rb Wed Sep 11 10:05:51 2002 @@ -116,7 +116,7 @@ "../_test" => "directory", "_file1" => "file", "/dev/tty" => "characterSpecial", - "/tmp/.X11-unix/X0" => "socket", + "/tmp/.X11-unix/X0" => "fifo", } MsWin32.dont do @@ -268,7 +268,7 @@ try(:socket?, "/dev/tty", false) try(:socket?, ".", false) try(:socket?, @file1, false) - try(:socket?, "/tmp/.X11-unix/X0", true) + try(:pipe?, "/tmp/.X11-unix/X0", true) end Unix.or_variant do 同上 diff -ru rubicon/builtin/TestKernel.rb rubicon-ux48/builtin/TestKernel.rb --- rubicon/builtin/TestKernel.rb Thu Sep 5 21:02:10 2002 +++ rubicon-ux48/builtin/TestKernel.rb Wed Sep 11 09:43:43 2002 @@ -1191,6 +1191,7 @@ assert_nil(f.puts("koala")) f.rewind assert_equal("wombat\n", f.gets) + assert_equal("wombat\n", f.gets) assert_equal("koala\n", f.gets) } 謎です。 diff -ru rubicon/builtin/TestThread.rb rubicon-ux48/builtin/TestThread.rb --- rubicon/builtin/TestThread.rb Sat Nov 10 13:53:16 2001 +++ rubicon-ux48/builtin/TestThread.rb Wed Sep 11 09:27:24 2002 @@ -298,6 +298,7 @@ assert_equals(4, Thread.current.safe_level) Thread.pass end + sleep 1 assert_equals(0, Thread.current.safe_level) assert_equals(4, t.safe_level) t.kill sleep をいれないとタイミングによって Thread.current.safe_level が 0 になりませんでした。うーん、おっかしいなあ。 diff -ru rubicon/util/checkstat.c rubicon-ux48/util/checkstat.c --- rubicon/util/checkstat.c Mon Nov 26 13:09:52 2001 +++ rubicon-ux48/util/checkstat.c Wed Sep 11 09:36:45 2002 @@ -30,7 +30,7 @@ s.st_dev, s.st_ino, s.st_mode, s.st_nlink, s.st_uid, s.st_gid, s.st_rdev, s.st_size); -#ifdef _WIN32 +#if 1 printf("-1 -1 "); #else printf("%d %lld ", s.st_blksize, (long long)s.st_blocks); long long がない Unix ではコンパイルできないのでした。これぐ らいは対処した方が良さそうに思います。って自分でやれ 以下、上記の対処を入れた結果です。まだ、問題を残してます。 TestThread は、途中 ^C を入れないとテストが継続しませんでし た。 $ ruby AllBuiltinTests.rb TestArray: ..........................................S....................... Time: 0.98 OK (65/65 tests 474 asserts) TestBignum: ............................. Time: 3.66 OK (29/29 tests 1598 asserts) TestBinding: Time: 0.0 OK (0/0 tests 0 asserts) TestClass: ..... Time: 0.03 OK (5/5 tests 16 asserts) TestComparable: ....... Time: 0.06 OK (7/7 tests 26 asserts) TestContinuation: ..... Time: 0.05 OK (5/5 tests 5 asserts) TestDir: .......S......S........ Time: 3.16 OK (21/21 tests 96 asserts) TestEnumerable: ................. Time: 0.15 OK (17/17 tests 76 asserts) TestException: ..... Time: 0.04 OK (5/5 tests 14 asserts) TestFalseClass: ...... Time: 0.05 OK (6/6 tests 17 asserts) TestFile: ..S.........S...................... Time: 8.73 OK (33/33 tests 306 asserts) TestFileTest: ..S.. Time: 1.73 OK (4/4 tests 106 asserts) TestFile__Stat: ..S......S.S..S..S.S.................. Time: 10.18 OK (32/32 tests 318 asserts) TestFixnum: ................................... Time: 0.48 OK (35/35 tests 414 asserts) TestFloat: ............................ Time: 0.3400000000000001 OK (28/28 tests 178 asserts) TestGC: .S.S.S. Time: 0.41 OK (4/4 tests 1 asserts) TestHash: .......................................... Time: 0.45 OK (42/42 tests 276 asserts) TestIO: .S..........S......S....F..................F.............. Time: 17.14 FAILURES!!! Test Results: Run: 53/53(1243 asserts) Failures: 2 Errors: 0 Failures: 2 ./TestIO.rb:631:in `test_pid'(TestIO): expected:<20773> but was:<20772> (RUNIT:: AssertionFailedError) from ./../rubicon_tests.rb:379:in `run' from ./../rubicon_tests.rb:370:in `each' from ./../rubicon_tests.rb:370:in `run' from AllBuiltinTests.rb:12 ./TestIO.rb:208:in `test_s_popen_spawn'(TestIO): expected:<12> but was:<0> (RUNI T::AssertionFailedError) from ./TestIO.rb:198:in `dont' from ./TestIO.rb:198:in `test_s_popen_spawn' from ./../rubicon_tests.rb:379:in `run' from ./../rubicon_tests.rb:370:in `each' from ./../rubicon_tests.rb:370:in `run' from AllBuiltinTests.rb:12 TestInteger: ......... Time: 0.28 OK (9/9 tests 347 asserts) TestKanjiIndex: .................... Time: 0.26 OK (20/20 tests 190 asserts) TestKernel: ................................UX:sh (sh): ERROR: not_a_valid_comma nd: Not found UX:sh (sh): ERROR: not_a_valid_command: Not found ................S............................................S................ Time: 60.34 OK (108/108 tests 6463 asserts) TestMarshal: ...... Time: 0.09999999999999999 OK (6/6 tests 31 asserts) TestMatchData: ........... Time: 0.09 OK (11/11 tests 18 asserts) TestMath: .. Time: 0.12 OK (2/2 tests 62 asserts) TestMethod: .... Time: 0.04 OK (4/4 tests 11 asserts) TestModule: ......................... Time: 0.45 OK (25/25 tests 93 asserts) TestModulePrivate: .S.............. Time: 0.16 OK (15/15 tests 41 asserts) TestNilClass: ....... Time: 0.06 OK (7/7 tests 20 asserts) TestNumeric: S.S..S..S..... Time: 0.08 OK (10/10 tests 21 asserts) TestObject: Time: 0.0 OK (0/0 tests 0 asserts) TestObjectSpace: ...S. Time: 1.89 OK (4/4 tests 6 asserts) TestProc: .... Time: 0.03 OK (4/4 tests 12 asserts) TestRange: .......... Time: 0.1000000000000001 OK (10/10 tests 46 asserts) TestRegexp: .............. Time: 0.12 OK (14/14 tests 39 asserts) TestString: .................................................................... .......S.... Time: 1.53 OK (79/79 tests 1211 asserts) TestStruct: ........... Time: 0.12 OK (11/11 tests 47 asserts) TestStruct__Tms: . Time: 3.29 OK (1/1 tests 9 asserts) TestSymbol: ........ Time: 0.06999999999999999 OK (8/8 tests 20 asserts) TestThread: ...S.............E................ Time: 162.82 FAILURES!!! Test Results: Run: 32/32(87 asserts) Failures: 0 Errors: 1 Errors: 1 ./TestKernel.rb:1572:in `test_s_raise'(TestThread): Interrupt (RuntimeError) from ./TestKernel.rb:1572:in `call' from ./TestThread.rb:423:in `test_s_critical=' from ./TestThread.rb:423:in `times' from ./TestThread.rb:423:in `test_s_critical=' from ./../rubicon_tests.rb:379:in `run' from ./../rubicon_tests.rb:370:in `each' from ./../rubicon_tests.rb:370:in `run' from AllBuiltinTests.rb:12 TestThreadGroup: .... Time: 0.2 OK (4/4 tests 7 asserts) TestTime: ..............S........................... Time: 4.53 OK (41/41 tests 1813 asserts) TestTrueClass: ...... Time: 0.05 OK (6/6 tests 17 asserts) ======================================================================== Built-ins Test Results V0.3.5 ======================================================================== Name OK? Tests Asserts Failures Errors ------------------------------------------------------------ Array 65 474 Bignum 29 1598 Binding 0 0 Class 5 16 Comparable 7 26 Continuation 5 5 Dir 21 96 Enumerable 17 76 Exception 5 14 FalseClass 6 17 File 33 306 FileTest 4 106 File__Stat 32 318 Fixnum 35 414 Float 28 178 GC 4 1 Hash 42 276 IO FAIL 53 1243 2 Integer 9 347 KanjiIndex 20 190 Kernel 108 6463 Marshal 6 31 MatchData 11 18 Math 2 62 Method 4 11 Module 25 93 ModulePrivate 15 41 NilClass 7 20 Numeric 10 21 Object 0 0 ObjectSpace 4 6 Proc 4 12 Range 10 46 Regexp 14 39 String 79 1211 Struct 11 47 Struct__Tms 1 9 Symbol 8 20 Thread FAIL 32 87 1 ThreadGroup 4 7 Time 41 1813 TrueClass 6 17 ======================================================================== All 42 files FAIL 822 15775 2 1 ======================================================================== Failure Report ======================================================================== TestIO: ------- ./TestIO.rb:631:in `test_pid'(TestIO) ....Expected: "<20773> " ....But was: "<20772>" ./TestIO.rb:208:in `test_s_popen_spawn'(TestIO) ./TestIO.rb:198:in `dont' ./TestIO.rb:198:in `test_s_popen_spawn' ....Expected: "<12> " ....But was: "<0>" ======================================================================== Error Report ======================================================================== TestThread: ----------- ./TestKernel.rb:1572:in `test_s_raise'(TestThread) ./TestKernel.rb:1572:in `call' ./TestThread.rb:423:in `test_s_critical=' ./TestThread.rb:423:in `times' ./TestThread.rb:423:in `test_s_critical=' ....Interrupt ======================================================================== -- 新井康司 (Koji Arai)