Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t/pegex-parser.t may fail on Mac OS X #54

Closed
eserte opened this issue May 19, 2016 · 11 comments · Fixed by #63
Closed

t/pegex-parser.t may fail on Mac OS X #54

eserte opened this issue May 19, 2016 · 11 comments · Fixed by #63

Comments

@eserte
Copy link

eserte commented May 19, 2016

I see the following error while running the test suite on a Mac OS X El Capitan with homebrew perl518:

rm: _Inline*: No such file or directory
rm: -fr: No such file or directory
rm: _Inline: is a directory
rm: -fr: No such file or directory
# Looks like your test exited with 256 before it could output anything.
t/pegex-parser.t ......... skipped: $ENV{PERL_INLINE_DEVELOPER_TEST} not set

It seems that the rm here does not like having the options after the files. Using rm -rf _Inline* instead seems to fix the problem.

@eserte
Copy link
Author

eserte commented May 19, 2016

@eserte
Copy link
Author

eserte commented May 20, 2016

It's not Mac-only. I see the same problem on a FreeBSD 10.1 system with perl 5.24.0.

@plicease
Copy link

plicease commented Jun 14, 2016

I am seeing this too on OS X 10.11. I didn't see it on a previous version, the userland rm probably changed. The patch by @eserte worked for me. Alternatively using File::Path::rmtree might be more portable.

@jyaworski
Copy link

I am seeing this as well on OS X 10.11. I installed it with -T while this is being addressed.

@bulk88
Copy link
Contributor

bulk88 commented Jul 19, 2016

rm isn't a native Win32 command, but if msysgit/cygwin are in PATH, there is a rm.exe to run, and that fails because you can't delete a DLL that is loaded in memory

C:\Users\Owner\.cpan\build\Inline-C-0.76-0>perl -Mblib t/pegex-parser.t
1..0 # SKIP $ENV{PERL_INLINE_DEVELOPER_TEST} not set
rm: cannot unlink `_Inline/lib/auto/pegex_parser_t_c4f8/pegex_parser_t_c4f8.dll'
: Permission denied
rm: cannot remove directory `_Inline/lib/auto/pegex_parser_t_c4f8': Directory no
t empty
rm: cannot remove directory `_Inline/lib/auto': Directory not empty
rm: cannot remove directory `_Inline/lib': Directory not empty
rm: cannot remove directory `_Inline': Directory not empty
# Looks like your test exited with 256 before it could output anything.

C:\Users\Owner\.cpan\build\Inline-C-0.76-0>

The skip added in 9bd6b3e never executes

use Test::More;
plan skip_all => '$ENV{PERL_INLINE_DEVELOPER_TEST} not set'
  unless defined $ENV{PERL_INLINE_DEVELOPER_TEST};
plan tests => 2;

use IO::All;
use YAML::XS;

BEGIN { system "rm _Inline* -fr" }
END { system "rm _Inline* -fr" }

use Inline C => <<'END', USING => '::Parser::Pegex';
SV* JAxH(char* x) {
    return newSVpvf ("Just Another %s Hacker",x);
}
END

because use below always runs before plan() executes and so does the END{}. The plan() needs to be in a begin block.

@chorny
Copy link

chorny commented Nov 14, 2016

From perlmod:
"Inside an END code block, $? contains the value that the program is going to pass to exit(). You can modify $? to change the exit value of the program. Beware of changing $? by accident (e.g. by running something via system). "

Test is skipped, but END block is still executed. When system fails due to missing rm or inability to remove, $? is modified and test fails.

@jomo666
Copy link

jomo666 commented Mar 5, 2017

The rm _Inline* -fr bug is here nearly a year long. It is really so hard to patch two lines, e.g.

diff --git a/test/pegex-parser.t b/test/pegex-parser.t
index 28e15cf..ac976a6 100644
--- a/test/pegex-parser.t
+++ b/test/pegex-parser.t
@@ -6,8 +6,8 @@ plan tests => 2;
 use IO::All;
 use YAML::XS;
 
-BEGIN { system "rm _Inline* -fr" }
-END { system "rm _Inline* -fr" }
+BEGIN { system "rm -fr _Inline*" }
+END { system "rm -fr _Inline*" }
 
 use Inline C => <<'END', USING => '::Parser::Pegex';
 SV* JAxH(char* x) {

and make an CPAN release? Me using plenv heavily and the Inline::C too. It is f...ing boring to manually installing it every time, just because the strange usage of the rm (switches after the filename).

@chorny
Copy link

chorny commented Mar 5, 2017

It is boring to manually installing it every time

You can skip tests using TAP::Harness::Restricted. Please don't use it with test reporting enabled - it will send incorrect report.

local $ENV{'HARNESS_SUBCLASS'} = 'TAP::Harness::Restricted';
local $ENV{'HARNESS_SKIP'} = 't/pegex-parser.t';
`cpan Inline::C`;

Or you can use cpan distroprefs to automatically apply my patch from #55 . This will work only with CPAN.pm client.

@jomo666
Copy link

jomo666 commented Mar 5, 2017

@chorny The TAP::Harness::Restricted is new for me, great, again learned a new thing.
Thank you very much! Love the community. :)
jm.

Ps: just for note, in the pull request #55 the rm is still problematic (e.g. rm _Inline* -fr instead of rm -fr _Inline*).

@pdl
Copy link

pdl commented Apr 19, 2017

I also experienced this with the rm from GNU coreutils 8.21 on Ubuntu. @eserte's patch worked for me.

@jomo666
Copy link

jomo666 commented Apr 20, 2017

Yes, Eserte's patch changes the wrong rm _Inline* -fr to correct rm -fr _Inline*.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants