Bug #13642


MinGW - Bug::Win32::TestDln#test_check_imported & misc

Added by MSP-Greg (Greg L) about 5 years ago. Updated over 4 years ago.

Target version:
ruby -v:
ruby 2.5.0dev (2017-06-08 trunk 59046) [x64-mingw32]


First of all, this is all windows specific. My current MinGW build system is now showing five failures in test-all. I am comfortable with having repeatable results, so I now hope to investigate and help fix the failures.

The following failure is due the fact that dlntest.dll cannot be found when requiring If I copy it to a location in the path at the time of testing, the test will pass.

 87) Failure:
Bug::Win32::TestDln#test_check_imported [E:/GitHub/ruby/test/-ext-/win32/test_dln.rb:15]:
[Bug #6303].

1. [2/2] Assertion for "stderr"
   | <[]> expected but was
   | <["E:/GitHub/ruby/lib/rubygems/core_ext/kernel_require.rb:60:in `require': 126: The specified module could not be found.   - E:/GitHub/ruby-loco/src/build-x86_64/.ext/x64-mingw32/-test-/win32/ (LoadError)",
   |  "\tfrom E:/GitHub/ruby/lib/rubygems/core_ext/kernel_require.rb:60:in `require'"]>.

I have done a few mswin builds using usa's (Usaku NAKAMURA) mswin-build repo. I have gotten different results for both test-all and test-rubyspec/test-spec versus MinGW builds. I have had mswin failures that do not show up on, but have also appeared in my MinGW builds.

In some recent threads the issue of install before test, differing folder structure between build systems, etc has been addressed. Additionally, there may be issues with what *nix commands/exe's are available during testing. I think for the spec tests, I had to change the path to include some more *nix commands/exe's to minimize the number of failed/errored tests. FWIW, I have tried to keep my build system as close to windows as possible, and my tests are not run in a bash shell.

So now that I've stated some of the things I'm wondering about, two questions:

  1. The above failure. I'll add a copy to my testing code. Is this something that can be changed in the build system source?

  2. Given the odd differences between mswin and MinGW builds, might there be places where something is set for mswin only, but should also be set for MinGW also? I have not looked, but am willing to do so. I say this simply because public facing MinGW build systems have not previously run tests.

Reminder - I don't do c. Hence, I can read c source and get an idea as to how it works, and I can read the build files in the same manner. But that's it, I could never create them.

Updated by h.shirosaki (Hiroshi Shirosaki) almost 5 years ago

RbConfig::CONFIG["PATH_SEPARATOR"] is : which is separator on msys2 shell building ruby.
Should we use File::PATH_SEPARATOR ; on test?

diff --git a/test/-ext-/win32/test_dln.rb b/test/-ext-/win32/test_dln.rb
index 3624346a56..e8f68ac4d4 100644
--- a/test/-ext-/win32/test_dln.rb
+++ b/test/-ext-/win32/test_dln.rb
@@ -11,7 +11,7 @@ def test_check_imported
         so = ::File.expand_path("../ext/-test-/win32/dln/dlntest.dll", ::EnvUtil.rubybin)
         assert_send([::File, :file?, so])
         path = ::ENV['PATH']
-        path = ::File.dirname(so) + ::RbConfig::CONFIG["PATH_SEPARATOR"] + path
+        path = ::File.dirname(so) + ::File::PATH_SEPARATOR + path
         assert_in_out_err([{'PATH'=>path}, '-r-test-/win32/dln', '-eexit'], '', [], [], bug, timeout: 10)

Updated by MSP-Greg (Greg L) almost 5 years ago

Thanks for reviewing. Added the patch, removed my copy command, and test passed in make test-all.

Maybe change

path = ::File.dirname(so) + ::File::PATH_SEPARATOR + path


path = path + ::File::PATH_SEPARATOR + ::File.dirname(so)

Updated by nobu (Nobuyoshi Nakada) almost 5 years ago

h.shirosaki (Hiroshi Shirosaki) wrote:

RbConfig::CONFIG["PATH_SEPARATOR"] is : which is separator on msys2 shell building ruby.
Should we use File::PATH_SEPARATOR ; on test?

Indeed, could you commit it?

Actions #4

Updated by Anonymous over 4 years ago

  • Status changed from Open to Closed

Applied in changeset trunk|r60056.

test_dln.rb: fix path separator on MinGW

  • test/-ext-/win32/test_dln.rb (TestDln#test_check_imported):
    RbConfig::CONFIG["PATH_SEPARATOR"] is : which is a separator on
    msys2 shell building ruby. Use File::PATH_SEPARATOR ; on test.
    [Bug #13642] [ruby-core:81623]

Also available in: Atom PDF