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

Test fail on Windows due to hard coded directory separators #10

Closed
nanis opened this issue Dec 9, 2014 · 10 comments
Closed

Test fail on Windows due to hard coded directory separators #10

nanis opened this issue Dec 9, 2014 · 10 comments

Comments

@nanis
Copy link

nanis commented Dec 9, 2014

Same issue as pegex-parser/pegex-pm#26

t\standard.t ................. Can't open './testml/standard.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\standard.t ................. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\strings.t .................. ok
t\testml-arguments.t ......... Can't open './testml/arguments.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-arguments.t ......... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-assertions.t ........ Can't open './testml/assertions.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-assertions.t ........ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-basic.t ............. Can't open './testml/basic.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-basic.t ............. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-dataless.t .......... Can't open './testml/dataless.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-dataless.t .......... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-edge-cases.t ........ Can't open './testml/edge-cases.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-edge-cases.t ........ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-exceptions.t ........ Can't open './testml/exceptions.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-exceptions.t ........ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-external.t .......... Can't open './testml/external.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-external.t .......... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-function.t .......... Can't open './testml/function.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-function.t .......... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-label.t ............. Can't open './testml/label.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-label.t ............. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-lite-arguments.t .... Can't open './testml/arguments.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-lite-arguments.t .... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-lite-basic.t ........ Can't open './testml/basic.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-lite-basic.t ........ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-lite-exceptions.t ... Can't open './testml/exceptions.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-lite-exceptions.t ... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-lite-semicolons.t ... Can't open './testml/semicolons.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-lite-semicolons.t ... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-markers.t ........... Can't open './testml/markers.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-markers.t ........... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-semicolons.t ........ Can't open './testml/semicolons.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-semicolons.t ........ Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-semicolons2.t ....... Can't open './testml/semicolons2.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-semicolons2.t ....... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-standard.t .......... Can't open './testml/standard.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-standard.t .......... Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-truth.t ............. Can't open './testml/truth.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-truth.t ............. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
t\testml-types.t ............. Can't open './testml/types.tml' for input: No such file or directory at C:\Users\sinan\AppData\Local\Temp\TestML-0.49\blib\lib/TestML/Runtime.pm line 285.
t\testml-types.t ............. Dubious, test returned 2 (wstat 512, 0x200)
No subtests run
@ingydotnet
Copy link
Owner

@nanis, I applied same technique as per pegex-pm PR/27.

Please test and close if fixed.

@nanis
Copy link
Author

nanis commented Dec 14, 2014

I am afraid that wasn't sufficient. I submitted test results for both modules using cpanm-reporter. They should appear on CPANTesters soon.

@ingydotnet
Copy link
Owner

@nanis can you provide the code/script/actions/whatever that you are using to build this perl? Then I or someone else can reproduce and easily fix these bugs.

@mohawk2
Copy link

mohawk2 commented Dec 27, 2014

@nanis, I want this to be sorted out. Please help me help you ;-)

@nanis
Copy link
Author

nanis commented Dec 27, 2014

I do not have access to my Windows environment at the moment. However, you can see the sample test failures for Pegex. I explained how I built this perl on my blog: 64-bit Perl 5.20.1 with Visual Studio 2013 Community Edition on Windows 8.1.

I do appreciate your effort, and I am going to come back to this as soon as practicable.

@nanis
Copy link
Author

nanis commented Dec 27, 2014

@mohawk2 You should have said "help me help you help me."

@nanis
Copy link
Author

nanis commented Dec 27, 2014

OK, looking at the source code for TestML-0.51, I see that you are still using a regex match instead of File::Basename::dirname (I explained this earlier).

With the following simple change, most of the test failures disappear:

diff --git a/lib/TestML/Runtime.pm b/lib/TestML/Runtime.pm
index 195c1bd..c9a407b 100644                             
--- a/lib/TestML/Runtime.pm                               
+++ b/lib/TestML/Runtime.pm                               
@@ -1,5 +1,7 @@                                           
 package TestML::Runtime;                                 

+use File::Basename qw( dirname );                        
+                                                         
 use TestML::Base;                                        

 has testml => ();                                        
@@ -16,7 +18,7 @@ has base => ();                         
 sub BUILD {                                              
     my ($self) = @_;                                     
     $TestML::Runtime::Singleton = $self;                 
-    $self->{base} ||= $0 =~ m!(.*)/! ? $1 : ".";         
+    $self->{base} ||= dirname $0;                        
 }                                                        

 sub run {

The only test failure that remains after fixing that obvious problem is:

t\testml-external.t .. Can't open 't\external2.tml' for input: No such file or directory at C:\...\TestML-0.51\blib\lib/TestML/Runtime.pm line 288.

That one seems to be a genuine problem with the %Include mechanism ... It should be looking for t\testml\external2.tml.

@ingydotnet
Copy link
Owner

@nanis, can you please test TestML-0.52 and report back?

@nanis
Copy link
Author

nanis commented Dec 28, 2014

C:\> cpanm TestML
--> Working on TestML
Fetching http://www.cpan.org/authors/id/I/IN/INGY/TestML-0.52.tar.gz ... OK
Configuring TestML-0.52 ... OK
Building and testing TestML-0.52 ... OK
Successfully installed TestML-0.52
1 distribution installed

@nanis nanis closed this as completed Dec 28, 2014
@mohawk2
Copy link

mohawk2 commented Dec 28, 2014

Nice work people!

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