From: "jonforums (Jon Forums)" Date: 2013-05-14T13:09:04+09:00 Subject: [ruby-core:54978] [ruby-trunk - Bug #8400] skip `Rinda::TestRingFinger` tests on platforms not implementing `getifaddrs()` Issue #8400 has been updated by jonforums (Jon Forums). usa, below is the quick patch I needed in order to build on win7 32bit with mingw-w64 gcc 4.7.4. The patch solved the `make test-all` failures and `make test` still passed. ### `make test-all` results ... [11522/13375] TestSprintf#test_float = 0.00 s 72) Failure: TestSprintf#test_float [c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_sprintf.rb:193]: [ruby-dev:42551]. <"0x1p+2"> expected but was <"0x1p+1">. Finished tests in 847.472473s, 15.7822 tests/s, 2649.6365 assertions/s. 13375 tests, 2245494 assertions, 1 failures, 0 errors, 101 skips ruby -v: ruby 2.1.0dev (2013-05-14 trunk 40710) [i386-mingw32] make: *** [yes-test-all] Error 1 ### `make test` results ... gcc version 4.7.3 (rubenvb-4.7.4-release) sample/test.rb:gc OK 4 27K 1210 62 test succeeded PASS all 964 tests ... Driver is ruby 2.1.0dev (2013-05-14 trunk 40710) [i386-mingw32] Target is ruby 2.1.0dev (2013-05-14 trunk 40710) [i386-mingw32] KNOWNBUGS.rbPASS 0 No tests, no problem The first hunk below is a throwaway hack to fix the problem that `if_nametoindex` in `ext/socket/ifaddr.c:143` is only available on vista or greater. In the current rubyinstaller recipes we currently define -D_WIN32_WINNT=0x501 so without this hunk I get link errors. http://msdn.microsoft.com/en-us/library/windows/desktop/bb408409%28v=vs.85%29.aspx I believe the second hunk is more robust than r40721 because it appears that your `NET_LUID` struct is needed only by mingw.org toolchains, not msvc or mingw-w64. I don't know when I'll next have time to look at this, but plan to check that that the second hunk is valid and works on my mingw.org toolchain. Given the os version issues with `if_nametoindex` I think the real fix is an emulation function similar to what cygwin does. Likely an `#ifdef _WIN32_WINNT >= 0x600` that uses the real `if_nametoindex` and falls back to an emulated fcn. What do you think? diff --git a/ext/socket/extconf.rb b/ext/socket/extconf.rb index 88e7366..b7810d0 100644 --- a/ext/socket/extconf.rb +++ b/ext/socket/extconf.rb @@ -442,7 +442,7 @@ EOF if ipv6 if $mingw - $CPPFLAGS << " -D_WIN32_WINNT=0x501" unless $CPPFLAGS.include?("_WIN32_WINNT") + $CPPFLAGS << " -D_WIN32_WINNT=0x601" end ipv6lib = nil class << (fmt = "unknown") diff --git a/win32/win32.c b/win32/win32.c index 2489942..f3d4b2c 100644 --- a/win32/win32.c +++ b/win32/win32.c @@ -3762,7 +3762,7 @@ str2guid(const char *str, GUID *guid) } /* License: Ruby's */ -#ifndef _IFDEF_ +#if !defined(_MSC_VER) && !defined(__MINGW64_VERSION_MAJOR) typedef struct { uint64_t Value; struct { ---------------------------------------- Bug #8400: skip `Rinda::TestRingFinger` tests on platforms not implementing `getifaddrs()` https://bugs.ruby-lang.org/issues/8400#change-39328 Author: jonforums (Jon Forums) Status: Open Priority: Normal Assignee: Category: core Target version: current: 2.1.0 ruby -v: ruby -v: ruby 2.1.0dev (2013-05-12 trunk 40676) [i386-mingw32] Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN The 32 and 64bit trunk builds at ci.rubyinstaller.org are failing `make test-all` 32bit => http://ci.rubyinstaller.org/view/Ruby%20Trunk/job/ruby-trunk-x86-test-all/1333/console 64bit => http://ci.rubyinstaller.org/view/Ruby%20Trunk/job/ruby-trunk-x64-test-all/1218/console as is my Win7 32bit system because non applicable tests are being allowed to fail with `NotImplementedError` rather than being skipped: [ 1948/13374] Rinda::TestRingFinger#test_make_socket_ipv6_multicast = 0.00 s 7) Error: Rinda::TestRingFinger#test_make_socket_ipv6_multicast: NotImplementedError: getifaddrs() function is unimplemented on this machine c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:535:in `getifaddrs' c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:535:in `prepare_ipv6' c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:665:in `test_make_socket_ipv6_multicast' [ 1949/13374] Rinda::TestRingFinger#test_make_socket_ipv6_multicast_hops = 0.00 s 8) Error: Rinda::TestRingFinger#test_make_socket_ipv6_multicast_hops: NotImplementedError: getifaddrs() function is unimplemented on this machine c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:535:in `getifaddrs' c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:535:in `prepare_ipv6' c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/test_rinda.rb:679:in `test_make_socket_ipv6_multicast_hops' Also, after you've made a commit, I ask that you swing by http://ci.rubyinstaller.org/ to double-check that your commit didn't break the relevant mingw-based Windows build. Jon -- http://bugs.ruby-lang.org/