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
net/http/cgi: tests fail with 64-bit ActiveState Perl on Windows #4401
Labels
Milestone
Comments
Brad, Please, help me. I am investigating this. One of the problems I see here is ActiveState perl interprets 'print "\n"'; differently from mingw perl. So I started to look in our test.cgi to see how to change it. But, I do not know perl, and I am confused. We are using "\r\n" in some places, but ActiveState perl outputs it as "\r" + "\r\n". I think our perl script assumes that "\r\n" outputs as "\r\n". Should I change perl script to do different things on different perls? Also, please, help me with http://code.google.com/p/go/source/browse/src/pkg/net/http/cgi/testdata/test.cgi#20. Where does mode in $NL = "\n" if $params->{mode} eq "NL"; come from? Does $NL = "\n" ever runs? You have TODO in the tests // TODO: make the child process be Go, not Perl. Do you think it is time? Alex |
Maybe http://golang.org/cl/6853067 will fix this. I suppose we could write it in Go now, but having a separate implementation (this one in Perl) was useful in finding bugs. The problem with a Go implementation is the same authors (us) will make the same (sometimes wrong) assumptions on both the child and host implementations, and then we'll have a false sense of confidence in our implementation. I'm also find keeping it in Perl. The test should be skipped if Perl isn't available, so it shouldn't affect anybody. |
OK. I will try your CL. What about my question? ... Also, please, help me with http://code.google.com/p/go/source/browse/src/pkg/net/http/cgi/testdata/test.cgi#20. Where does mode in $NL = "\n" if $params->{mode} eq "NL"; come from? Does $NL = "\n" ever runs? Alex |
This issue was updated by revision c8e7469. R=golang-dev, mattn.jp CC=golang-dev http://golang.org/cl/6853067 |
Oh, it's this part: # NOTE: don't call getcwd() for windows. # msys return /c/go/src/... not C:\go\... my $dir; if ($^O eq 'MSWin32' || $^O eq 'msys') { my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe'; $cmd =~ s!\\!/!g; $dir = `$cmd /c cd`; chomp $dir; } else { $dir = getcwd(); } print "cwd=$dir\n"; I bet it's not finding your cmd.exe. That logic, hard-coding the path to cmd.exe, is not ideal. Status changed to Accepted. |
This issue was closed by revision e070aea. Status changed to Fixed. |
Brad, This still fails (on both mingw and ActiveState perl): C:\go\src\pkg\net\http\cgi>go test --- FAIL: TestEnvOverride (0.11 seconds) host_test.go:67: for key "cwd" got "C:\\go\\root\\src\\pkg\\net\\http\\cgi"; expected "c:\\go\\root\\src\\pkg\\net\\http\\cgi" FAIL exit status 1 FAIL net/http/cgi 0.266s But, I think adding more code will not help. Because, mingw bash shell sometimes does this: $ perl -e 'use Cwd; print getcwd();' /home/brainman And you will not be able to translate this to "windows path". I think we should go back to the original code instead. I will send a change unless someone beats me to it. I also think the fact that builder succeeds, while the test is broken, puts idea of using perl here in question again. Alex Status changed to Accepted. |
FWIW, the landed CL works on my machine for both ActiveState Perl and msys perl. The original code works for me as well, if I explicitly make sure I convert to the right slashedness of the target system: if ($^O eq 'MSWin32' || $^O eq 'msys') { my $cmd = $ENV{'COMSPEC'} || 'c:\\windows\\system32\\cmd.exe'; if ($^O eq 'MSWin32') { $cmd =~ s!/!\\!g; } elsif ($^O eq 'msys') { $cmd =~ s!\\!/!g; } $dir = `$cmd /c cd`; chomp $dir; } MSys Perl wants slashes in its backticks, and MSWin32 wants backslashes. |
krautz, > FWIW, the landed CL works on my machine for both ActiveState Perl and msys perl. My test fails, because drive letter case differs - c: and C:. I suspect, yours are the same for one reason or the other. Drive letter case we can fix, but we still cannot convert "/home/brainman" to a windows path. Here is my change http://golang.org/cl/6847072. Alex |
This issue was closed by revision 54b9c20. Status changed to Fixed. |
This issue was closed.
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
The text was updated successfully, but these errors were encountered: