[perl #34978] lib/Parrot/Test.pm should not use "&&" in commands

1 view
Skip to first unread message

Jens Rieks

unread,
Apr 14, 2005, 6:52:23 AM4/14/05
to bugs-bi...@rt.perl.org
# New Ticket Created by Jens Rieks
# Please include the string: [perl #34978]
# in the subject line of all future correspondence about this issue.
# <URL: https://rt.perl.org/rt3/Ticket/Display.html?id=34978 >


lib/Parrot/Test.pm has several lines like
$cmd = qq{(cd $path_to_parrot && $parrot $args "$code_f")};
As this command is executed with system(), it should not include "&&".
All tests on Win98/VC6 are failing with "Command not found" due to this.

Michael G Schwern

unread,
Apr 14, 2005, 9:36:23 PM4/14/05
to perl6-i...@perl.org
On Thu, Apr 14, 2005 at 03:52:23AM -0700, Jens Rieks wrote:
> lib/Parrot/Test.pm has several lines like
> $cmd = qq{(cd $path_to_parrot && $parrot $args "$code_f")};
> As this command is executed with system(), it should not include "&&".
> All tests on Win98/VC6 are failing with "Command not found" due to this.

This idiom shows up in several places. :( Here's a quick scan.

./languages/m4/t/basic/003_getopt.t
./languages/m4/t/basic/012_eval.t
./languages/m4/t/freezing/001_freeze.t
./languages/m4/t/freezing/002_many_files.t
./languages/m4/t/harness (documentation)
./languages/parrot_compiler/lib/Parrot/Test/ParrotCompiler.pm
./languages/parrot_compiler/t/harness (documentation)
./languages/python/t/harness (documentation)
./languages/tcl/README (documentation)
./languages/testall (documentation)
./lib/Parrot/Test/m4.pm
./lib/Parrot/Test/Tcl.pm
./lib/Parrot/Test.pm

The cross-platform version of

system("cd $dir && command");

is

my($dir, @command) = @_;
my $orig_dir = cwd;
chdir $dir;
my $ret = system(@command);
chdir $orig_dir;

return $ret;

which I have added to Parrot::Test::_run_command() and made it publicly
available. Lots of code was using it already anyway.

Also languages/m4/M4/Test.pm, languages/perl6/P6C/TestCompiler.pm,
languages/scheme/Scheme/Test.pm, lib/Parrot/Configure/Step.pm, have their
own probably duplicate _run_commands() which should probably be eliminated
but I'm not going to do in this patch.

I've also left the "cd dir && foo" idiom used in documentation alone,
though again this should probably be changed.

Finally I haven't fixed the m4 tests as they're just straight `` not going
through run_command() and require a bit more time to fix than I have at the
moment.

run_command.patch

Michael G Schwern

unread,
Apr 14, 2005, 9:55:07 PM4/14/05
to perl6-i...@perl.org
And this patch has the added benefit of working.


run_command.patch

Jens Rieks

unread,
Apr 15, 2005, 4:40:49 AM4/15/05
to perl6-i...@perl.org
Thank you, applied!

jens

Reply all
Reply to author
Forward
0 new messages