The Ruby greener test challenge (a Windows challenge)

Hello,

Since I started RubyInstaller 4 years ago, ensuring that Ruby worked on
every
single release took time.

Back then, my hardware was limited, so running Ruby tests took a
considerable
amount of time (more than one cup of tea using tea cups scale).

Not only that, even after 4 years and different versions of Ruby and
Windows,
Ruby still have some failures:

Finished tests in 526.522392s, 21.2128 tests/s, 3665.2629 assertions/s.
11169 tests, 1929843 assertions, 9 failures, 2 errors, 80 skips

Wouldn’t be awesome that Ruby own tests were all green on Windows?

The truth is that having Ruby achieve 0F0E (0 failures, 0 errors) will
help
detect real errors, not to mention automate the testing process, perhaps
allowing teams have nightly builds of Ruby to play with.

Following a similar idea from Ruby 1.9.3 Documentation Challenge [1], I
would
like to propose some test-fixing hunt!

Objective

Reach 0 failures and 0 errors for Windows (MinGW) in the upcoming weeks,
is
not that hard: 9 failures and 2 errors.

The target is Ruby trunk (upcoming 2.0), but I expect these fixes be
backported to Ruby 1.9.3 too.

I have no idea how to compile things…

I heard I would like to help but have no idea how to compile Ruby, and
I
know is not easy, so that is why I present to you the Ruby Challenge
Kit

Those of you who are well versed in the art of compiling can skip to the
next
section (Compiling).

Ruby Challenge Pack

The Ruby Challenge Pack is a single-file package that provides all the
tools
require to compile, test and fix Ruby. Once extracted, it provides:

  • Ruby 1.9.3-p194 (required as base to compile Ruby).
  • 32bits DevKit GCC 4.6.1 (based on TDM builds).
  • 32bits support libraries (OpenSSL, zlib, libffi, libyaml, etc).
  • Easy 1-click batch to start a tailored Command Prompt
  • Easy 1-step batch to compile Ruby and run basic tests
  • A document (README) describing how compile and send your fixes.

What is not included and you need is:

  • A working Git installation on your computer (recommended is msysGit).
  • A clone of Ruby source from GitHub [2]

Download here:
http://cdn.rubyinstaller.org/archives/experimental/RubyChallengePack-v1.exe

MD5 for verification:
0e6259c256beb5fba7e7ec53bd9e5c21

After download of the package, extract into a directory without spaces
(e.g. C:\RubyChallenge) and check the included README for instructions
(or
keep reading)

Compiling

For those using the Ruby Challenge Pack, simply run quick-compile.bat
as indicated in the documentation.

For others, do what you do and always verify Ruby core tests pass:

make test

Compiling will take long, depending on your system. You can go and grab
a cup of tea while it completes.

Running and fixing tests

Once you’ve compiled Ruby, you can run the tests:

make test-all TESTS=“-q”

Above command will run all Ruby tests, which could take around 10
minutes.

Once it completes, you should get a list that only contains the errors.
For
example, let’s look at the following one:

[ 3348/11169] TestEnv#test_win32_blocksize = 0.00 s
4) Failure:
test_win32_blocksize(TestEnv)
[C:/Users/Worker/Code/ruby/ruby/test/ruby/test_env.rb:404]:
Errno::EINVAL expected but nothing was raised.

Notice the file where the test failed: test/ruby/test_env.rb and the
line
too.

Now open your editor/IDE, find that file, open it, and locate the
failing
test.

Figure out if the test is valid and Ruby is failing or is test that is
not
meant to be run on Windows.

At any time, you can email RubyInstaller group [3] and ask questions,
everybody will be pleased to help you out.

Once you find a solution, modify the file and run the tests again, but
this
time just for a single file:

make test-all TESTS=“-q ruby/test_env.rb”

Sending your patches

You fixed a test, great! Now is time to send this to Ruby developers so
they
can apply it.

Open a ticket on Ruby-trunk [4] tracker and assign it to me
(luislavena).
I’ll review and merge accordingly.

To reduce changes people stepping into each other, please email
RubyInstaller
group [3] before to announce or see if others are working on that
particular
failure.

A big thank you

There is no such thing as small contributions, all contributions are
valuable.

Help us make a better Ruby.

Thank you.

[1]
http://blog.segment7.net/2011/05/09/ruby-1-9-3-documentation-challenge
[2] GitHub - ruby/ruby: The Ruby Programming Language
[3] Redirecting to Google Groups
[4] Ruby Issue Tracking System

On Mon, Jun 25, 2012 at 7:53 PM, Dušan D. Majkić [email protected]
wrote:

For those using the Ruby Challenge Pack, simply run quick-compile.bat

This failed on my machine. It killed CMD.exe garbling the screen, so I
suspect that it collides with ansicon.

Oh yeah, a lot of things don’t play nice with ANSICON. We had the same
problem RubyInstaller, make + ANSICON last year.

Please disable ANSICON before attempting to compile from the batch
file, ANSICON will try to hook cmd.exe and the child processes
(make.exe) which will fail and crash.

You can “set ANSICON_EXC=make.exe” to exclude it from being hooked.

The good thing is that Ruby 2.0 doesn’t require external tools for
ANSI coloring anymore ;-9

Thanks for pointing it out.

On Tue, Jun 26, 2012 at 10:51 AM, lizzy leiz [email protected] wrote:

El martes, 26 de junio de 2012 03:21:26 UTC-3, Luis L. escribi:

Please tell us which revision you have cloned and if you have any existing
instalation of ruby, gcc or something like that.

I cloned trunk from GitHub - ruby/ruby: The Ruby Programming Language, commit
9ac51c29930fa92a32186e7c217fa219915487c6. I go back in history about 10
commits but it’s the same.

I just tried the same commit and worked.

However, I took the output from your first message (the configure
output)

And compared against my local build. Here is the diff:

You will notice that is failing to obtain the size of int, functions
like memmove and others.

This might indicate that there is something else interfering with the
configure process, which is resulting in broken information.

Do you have cygwin or another MinGW installation that is always in the
PATH?

Do you have something like ANSICON installed in the AutoRun section?
(if you used ansicon -i)

Can you check the config.log for the first lines, when it check for
size of int, what is the command output?

If you can attach config.log (and not paste since is too big) will be
great.

Thank you.

On Fri, Jul 13, 2012 at 2:37 PM, Oleg S. [email protected]
wrote:

    CC = gcc
    CPPFLAGS = -DFD_SETSIZE=32767 -D_WIN32_WINNT=0x0501   -I.

identifiers
.ext/include/i386-mingw32/ruby/config.h:131:9: error: macro names must be
identifiers
.ext/include/i386-mingw32/ruby/config.h:133:9: error: macro names must be
identifiers

Hello,

I believe I mentioned this error before:

https://groups.google.com/d/msg/rubyinstaller/A92K_EYJX2A/AufN8RzlGAYJ

131 line of the problematic file is:
| #define $as_echo "HAVE_$ac_func" | $as_tr_cpp 1

This doesn’t looks like a good macro :wink:

Is this a known problem? How I can workaround it?

See link provided above, I got no answer from poster, so will be great
get your feedback :slight_smile:

I use Windows7 64bits, ruby’s revision is
d57103b9a2a62a67eb09fc9fb7c2828b53d1a590

I tested that version last night, and it worked.

Can you tell me if other looks like FRAPPS, ANSICON, existing
MinGW/Cygwin/MSYS installations around that could be affecting?

What “gcc --version” says after you open the command prompt shortcut?

Can gcc compile a simple program, like hello world?

hello.c:

#include <stdio.h>

int main(void)
{
puts(“Hello world”);

return 0;
}

And compile with “gcc hello.c -o hello.exe”

That should work, and if not, then try with “-v” option so we get debug
output.

Please use pastie.org or gist.github.com if the output you provide is
long so we keep readability :slight_smile:

Thank you.