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

Tests t/03errors.t and t/09perl5lib.t fails on Windows 10: 'inc\bin\testml-cpan' is not recognized as an internal or external command #79

Open
hakonhagland opened this issue Aug 13, 2020 · 4 comments

Comments

@hakonhagland
Copy link

I am trying to install Inline on Windows 10 with Strawberry Perl version 5.30.1:

>gmake test
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/000-require-modules.t .. ok
t/01usages.t ............. ok
t/02config.t ............. ok
t/03errors.t ............. 'inc\bin\testml-cpan' is not recognized as an internal or external command,
operable program or batch file.
t/03errors.t ............. No subtests run
t/04create.t ............. ok
t/05files.t .............. Skipping - couldn't load the Inline::Files module
t/05files.t .............. ok
t/06rewrite_config.t ..... ok
t/07rewrite2_config.t .... ok
t/08unicode.t ............ ok
t/09perl5lib.t ........... 'inc\bin\testml-cpan' is not recognized as an internal or external command,
operable program or batch file.
t/09perl5lib.t ........... No subtests run
t/author-pod-syntax.t .... skipped: these tests are for testing by the author

Test Summary Report
-------------------
t/03errors.t           (Wstat: 0 Tests: 0 Failed: 0)
  Parse errors: No plan found in TAP output
t/09perl5lib.t         (Wstat: 0 Tests: 0 Failed: 0)
  Parse errors: No plan found in TAP output
Files=11, Tests=23,  6 wallclock secs ( 0.06 usr +  0.08 sys =  0.14 CPU)
Result: FAIL
Failed 2/11 test programs. 0/23 subtests failed.
gmake: *** [Makefile:873: test_dynamic] Error 255
@hakonhagland
Copy link
Author

It seems that the shebang in t\03errors.t is not interpreted: #!inc\bin\testml-cpan. I can run the test fine like this:

>perl -Mblib ./inc/bin/testml-cpan t/03errors.t
ok 1 - Bad first parameter
ok 2 - Bad first parameter
ok 3 - Bad shortcut
ok 4 - Bad shortcut
ok 5 - Bad shortcut
ok 6 - Bad shortcut
ok 7 - Bad config option
1..7

@sisyphus
Copy link
Collaborator

sisyphus commented Aug 13, 2020 via email

@hakonhagland
Copy link
Author

hakonhagland commented Aug 13, 2020

@sisyphus I can confirm that .CMD was missing from my %PATHEXT% environment variable. So this now works:

>set PATHEXT=.exe;.bat;.pl;.PL;.cmd
>gmake test
"C:\Strawberry\perl\bin\perl.exe" "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib\lib', 'blib\arch')" t/*.t
t/000-require-modules.t .. ok
t/01usages.t ............. ok
t/02config.t ............. ok
t/03errors.t ............. ok
t/04create.t ............. ok
t/05files.t .............. Skipping - couldn't load the Inline::Files module
t/05files.t .............. ok
t/06rewrite_config.t ..... ok
t/07rewrite2_config.t .... ok
t/08unicode.t ............ ok
t/09perl5lib.t ........... ok
t/author-pod-syntax.t .... skipped: these tests are for testing by the author
All tests successful.
Files=11, Tests=33,  9 wallclock secs ( 0.08 usr +  0.01 sys =  0.09 CPU)
Result: PASS

Note I did not change the shebang, so it is still #!inc\bin\testml-cpan . As I understand, Windows do not use Shebang, but instead the shebang is interpreted by perl, according to perldoc perlrun:

If the #! line does not contain the word "perl" nor the word "indir", the program named after the #! is executed instead of the Perl interpreter. This is slightly bizarre, but it helps people on machines that don't do #! , because they can tell a program that their SHELL is /usr/bin/perl, and Perl will then dispatch the program to the correct interpreter for them.

So this will execute the CMD script inc\bin\testml-cpan.CMD which contains a single line:

if exist "%~dpn0" perl %0 %*

which is expanded to something like (for the file t/03errors.t as processed by gmake test):

if exist "C:\Users\hakon\perl\Inline-0.86\inc\bin\testml-cpan" perl inc\bin\testml-cpan t/03errors.t

Unfortunately I cannot remember why I removed .CMD from PATHEXT long time ago.

I am not sure if the Makefile should check if the .CMD is in %PATHEXT% or we simply ignore the possibility that it could be missing since it should be in %PATHEXT% by default, according to this post..

@sisyphus
Copy link
Collaborator

sisyphus commented Aug 13, 2020 via email

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

No branches or pull requests

2 participants