Project

General

Profile

Actions

Bug #8400

closed

skip `Rinda::TestRingFinger` tests on platforms not implementing `getifaddrs()`

Added by jonforums (Jon Forums) almost 11 years ago. Updated over 4 years ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby -v: ruby 2.1.0dev (2013-05-12 trunk 40676) [i386-mingw32]
Backport:
[ruby-core:54943]

Description

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

Updated by jonforums (Jon Forums) almost 11 years ago

@usa (Usaku NAKAMURA), nice...just scanning r40693 :) :)

Looks like NET_LUID redef when using mingw-w64 headers is cause of this fail

http://ci.rubyinstaller.org/view/Ruby%20Trunk/job/ruby-trunk-x86-build/1514/console

Mingw-w64 headers do this

L14: http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/tags/v2.0.6/mingw-w64-headers/include/iptypes.h?revision=5856&view=markup
L87: http://mingw-w64.svn.sourceforge.net/viewvc/mingw-w64/tags/v2.0.6/mingw-w64-headers/include/ifdef.h?revision=5856&view=markup

Haven't looked at mingw.org or msvc headers to see if simple #ifdef for mingw-w64 would be a potential fix.

Updated by jonforums (Jon Forums) almost 11 years ago

test file build results with 32bit compilers => cl, mingw.org 4.2.6, mingw-w64 4.7.2, mingw-w64 4.8.0

https://gist.github.com/jonforums/5570163

Updated by jonforums (Jon Forums) almost 11 years ago

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 {

Updated by jonforums (Jon Forums) almost 11 years ago

Related, should windows-specific implementation for this issue be moved from win32.c to a networking specific
file (win32/net.c ?) and the build scripts updated similar to what Shirosaki-san did for win32/file.c?

win32.c is a 150k, 6900 line pandora's box of awesomeness, and I'm for putting it on a diet.

Updated by hsbt (Hiroshi SHIBATA) about 10 years ago

  • Target version changed from 2.1.0 to 2.2.0
Actions #6

Updated by naruse (Yui NARUSE) about 6 years ago

  • Target version deleted (2.2.0)

Updated by jeremyevans0 (Jeremy Evans) over 4 years ago

  • Status changed from Open to Closed
  • Backport deleted (1.9.3: UNKNOWN, 2.0.0: UNKNOWN)
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0Like0