Bug #8400

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

Added by Jon Forums 11 months ago. Updated 3 months ago.

[ruby-core:54943]
Status:Open
Priority:Normal
Assignee:-
Category:core
Target version:current: 2.2.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

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#testmakesocketipv6multicast = 0.00 s
7) Error:
Rinda::TestRingFinger#testmakesocketipv6multicast:
NotImplementedError: getifaddrs() function is unimplemented on this machine
c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/testrinda.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/testrinda.rb:665:in `testmakesocketipv6_multicast'

[ 1949/13374] Rinda::TestRingFinger#testmakesocketipv6multicasthops = 0.00 s
8) Error:
Rinda::TestRingFinger#test
makesocketipv6multicasthops:
NotImplementedError: getifaddrs() function is unimplemented on this machine
c:/Users/Jon/Documents/RubyDev/ruby-git/test/rinda/testrinda.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/testrinda.rb:679:in `testmakesocketipv6multicasthops'

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

History

#1 Updated by Jon Forums 11 months ago

@usa, 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.

#2 Updated by Jon Forums 11 months 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

#3 Updated by Jon Forums 11 months 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#testfloat = 0.00 s
72) Failure:
TestSprintf#test
float [c:/Users/Jon/Documents/RubyDev/ruby-git/test/ruby/test_sprintf.rb:193]:
.
<"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 -DWIN32WINNT=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 << " -DWIN32WINNT=0x501" unless $CPPFLAGS.include?("WIN32WINNT")
+ $CPPFLAGS << " -DWIN32WINNT=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(MSCVER) && !defined(_MINGW64VERSIONMAJOR)
typedef struct {
uint64
t Value;
struct {

#4 Updated by Jon Forums 11 months 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.

#5 Updated by Hiroshi SHIBATA 3 months ago

  • Target version changed from 2.1.0 to current: 2.2.0

Also available in: Atom PDF