Unusual rake behaviour

I checked CVS. There is a recent (Dec. 19) change made by Nobu to test/unit.rb that was part of the 1.8.2 release.

The code for auto-running the tests was changed from:

Test::Unit::AutoRunner.run($0)

to:

Test::Unit::AutoRunner.run($0 != "-e" && $0)

Reverting this change will get Rake::TestTask working again, but I'm not sure what else will break as a consequence. The change was likely trying to fix some other problem. The CVS checkin comment doesn't say why it was changed.

Cheers,

Dave

···

On Dec 29, 2004, at 4:28 PM, Jim Weirich wrote:

Jim Weirich said:

Someone just informed me that in 1.8.2 test/unit does not work with the
ruby -e0 -rtestfile technique that Rake is using to load the unit tests.
I haven't been able to verify this. I'm not running 1.8.2 yet, so I am
not able to validate this.

Nathaniel ... is this intentional? What's the story?

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Here's a patch for Rake that provides a workaround for the 1.8.2 Test::Unit behavior. The patch is based on rake/testtask.rb from Rake 0.4.13.

81a82
> name_hack = "$0=\"#{@name}\""
83c84
< ruby %{-I#{lib_path} -e0 #{SEP}#{required_files}#{option_list}}

···

---
> ruby %{-I#{lib_path} -e'#{name_hack}' #{SEP}#{required_files}#{option_list}}

It overrides $0 with the name of the Rake test target, so that Test::Unit never sees the '-e' that was causing problems.

Cheers,

Dave

On Dec 29, 2004, at 8:55 PM, Dave Halliday wrote:

I checked CVS. There is a recent (Dec. 19) change made by Nobu to test/unit.rb that was part of the 1.8.2 release.

The code for auto-running the tests was changed from:

Test::Unit::AutoRunner.run($0)

to:

Test::Unit::AutoRunner.run($0 != "-e" && $0)

Reverting this change will get Rake::TestTask working again, but I'm not sure what else will break as a consequence. The change was likely trying to fix some other problem. The CVS checkin comment doesn't say why it was changed.

Cheers,

Dave

On Dec 29, 2004, at 4:28 PM, Jim Weirich wrote:

Jim Weirich said:

Someone just informed me that in 1.8.2 test/unit does not work with the
ruby -e0 -rtestfile technique that Rake is using to load the unit tests.
I haven't been able to verify this. I'm not running 1.8.2 yet, so I am
not able to validate this.

Nathaniel ... is this intentional? What's the story?

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Thanks ... The fix is in CVS. I'll test the fix tomorrow on a windows box and
if all looks good we will have a new release soon.

···

On Wednesday 29 December 2004 11:09 pm, Dave Halliday wrote:

Here's a patch for Rake that provides a workaround for the 1.8.2
Test::Unit behavior.

--
-- Jim Weirich jim@weirichhouse.org http://onestepback.org
-----------------------------------------------------------------
"Beware of bugs in the above code; I have only proved it correct,
not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)

Dave, thanks! that fixes the problem for now.

···

On Thu, 30 Dec 2004 13:09:54 +0900, Dave Halliday <davehal02@halliday.ca> wrote:

Here's a patch for Rake that provides a workaround for the 1.8.2
Test::Unit behavior. The patch is based on rake/testtask.rb from Rake
0.4.13.

81a82
> name_hack = "$0=\"#{@name}\""
83c84
< ruby %{-I#{lib_path} -e0
#{SEP}#{required_files}#{option_list}}
---
> ruby %{-I#{lib_path} -e'#{name_hack}'
#{SEP}#{required_files}#{option_list}}

It overrides $0 with the name of the Rake test target, so that
Test::Unit never sees the '-e' that was causing problems.

Cheers,

Dave

On Dec 29, 2004, at 8:55 PM, Dave Halliday wrote:

> I checked CVS. There is a recent (Dec. 19) change made by Nobu to
> test/unit.rb that was part of the 1.8.2 release.
>
> The code for auto-running the tests was changed from:
>
> Test::Unit::AutoRunner.run($0)
>
> to:
>
> Test::Unit::AutoRunner.run($0 != "-e" && $0)
>
> Reverting this change will get Rake::TestTask working again, but I'm
> not sure what else will break as a consequence. The change was likely
> trying to fix some other problem. The CVS checkin comment doesn't say
> why it was changed.
>
> Cheers,
>
> Dave
>
>
> On Dec 29, 2004, at 4:28 PM, Jim Weirich wrote:
>
>>
>> Jim Weirich said:
>>
>> Someone just informed me that in 1.8.2 test/unit does not work with
>> the
>> ruby -e0 -rtestfile technique that Rake is using to load the unit
>> tests.
>> I haven't been able to verify this. I'm not running 1.8.2 yet, so I
>> am
>> not able to validate this.
>>
>> Nathaniel ... is this intentional? What's the story?
>>
>> --
>> -- Jim Weirich jim@weirichhouse.org http://onestepback.org
>> -----------------------------------------------------------------
>> "Beware of bugs in the above code; I have only proved it correct,
>> not tried it." -- Donald Knuth (in a memo to Peter van Emde Boas)
>>
>>
>
>

--
- Yogi
Developer, www.thoughtworks.com