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

v7.15 test failures on MSWin32+cygwin (related to abs_path) #1030

Closed
kmx opened this issue Jan 10, 2017 · 3 comments
Closed

v7.15 test failures on MSWin32+cygwin (related to abs_path) #1030

kmx opened this issue Jan 10, 2017 · 3 comments

Comments

@kmx
Copy link
Contributor

kmx commented Jan 10, 2017

  • Mojolicious version: 7.15
  • Perl version: 5.22.2
  • Operating system: MS Windows 10

Steps to reproduce the behavior

simply run (d)make test on either cygwin or strawberry perl

Expected behavior

Tests should pass.

Actual behavior

Test failure:

Test Summary Report
-------------------
t/mojo/file.t                            (Wstat: 512 Tests: 9 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
t/mojo/home.t                            (Wstat: 512 Tests: 0 Failed: 0)
  Non-zero exit status: 2
  Parse errors: No plan found in TAP output
Files=89, Tests=10609, 62 wallclock secs ( 0.84 usr  0.34 sys + 27.80 cusr 23.52 csys = 52.51 CPU)
Result: FAIL
Failed 2/89 test programs. 0/10609 subtests failed.

My analysis

In both cases the failure details are like:

t/mojo/file.t .................... file.t: No such file or directory at /cygdrive/d/git/mojo.git/blib/lib/Mojo/File.pm line 103.
t/mojo/home.t .................... /cygdrive/d/git/mojo.git/does_not_exist: No such file or directory at /cygdrive/d/git/mojo.git/blib/lib/Mojo/File.pm line 103.

After some investigation it turned out that Cwd's function abs_path behaves differently on MSWin32, cygwin and linux. The difference is that on linux you can successfully pass a non-existing file as a param to abs_path like this:

[kmx@linux ~]$ perl -MCwd=abs_path -E "say abs_path('nonexisting.file')"
/home/kmx/nonexisting.file

However on MSWin32 (strawberry perl) it dies when the file does not exist:

d:\strawberry> perl -MCwd=abs_path -E "say abs_path('nonexisting.file')"
nonexisting.file: No such file or directory at -e line 1.

and the same on cygwin:

[kmx@cygwin ~]$ perl -MCwd=abs_path -E "say abs_path('nonexisting.file')"
nonexisting.file: No such file or directory at -e line 1.

So perhaps replacing Cwd's abs_path with File::Spec::Functions's rel2abs might be the way to fix this issue. According to rel2abs documentation: No checks against the filesystem are made so it should work fine with non-existing files.

This seems to be the only one issue with v7.15 on cygwin. But there are some more troubles on MSWin32 (mostly related to / vs \ in dir/file paths) - these I have not analysed yet and I think they might be worth a separate issue.

@kmx
Copy link
Contributor Author

kmx commented Jan 10, 2017

possible fix https://github.com/kmx/mojo/commit/5421be279b4cc265183083b9a4b582bb8325f126 (it makes Mojolicious PASS on cygwin)

@Grinnz
Copy link
Contributor

Grinnz commented Jan 10, 2017

Keep in mind that (as you noted) rel2abs does not make any checks against the filesystem, so it does not resolve symlinks nor .. or . path components. This may or may not matter for the tests.

@kraih kraih closed this as completed in d69f603 Jan 10, 2017
@kraih
Copy link
Member

kraih commented Jan 10, 2017

Thank you for the great analysis.

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

3 participants