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
Several protobuf unit tests fail when compiled with VS 2010 with x64 #547
Comments
I had another look at this today. While stepping through, I found that the executable expects to find files in the src directory. I ran it with protobuf source directory as the current working directory. It passes most of the tests that it failed before. Sadly, it still doesn't past all tests. But given the names of the tests that failed, it doesn't appear to be as serious as before. Some of them might be due to missing dependencies (I don't have ruby for example). [==========] 1493 tests from 159 test cases ran. (2072 ms total) 18 FAILED TESTS |
I took another crack at this. I moved my executables to the source directory and re-ran. Now it's down to 5 failures. I debugged one of them out of curiosity: TextFormatMapTest.Sorted. And unfortunately, this one really is a legitimate failure (the text actual and expected text does not match). I thought it had to do with CRLF issues, but this was not the case. See below for a summary. Unfortunately these failing unit tests don't shed any light on my own problem. I have an application that does not appear to be saving binary data properly. But tests having to do with binary data all pass. [ PASSED ] 1488 tests. 5 FAILED TESTS |
The failing of BootstrapTest.GeneratedDescriptorMatches suggests that you need to regenerate descriptor.pb.(h|cc). Had you edited the descriptor.proto file? |
I did not edit any proto files. But I thought this might be a problem. I followed up with that failed test by modifying the generate_descriptor_proto.sh to command me to compile protoc after generating new source files. It looped twice for convergence. I found that the protoc-generated files differed only by CRLF vs LF. However, unfortunately the other 4 tests still fail. Is it possible that the testdata files have not been updated? |
It seems when you check out the code, "LF" is converted to "CRLF" automatically. I suspect the other failures are also related to this. Another possibility is that it has something to do with other changes you made. Could you send your changes as PR? That will trigger travis and appveyor tests and we can see whether the change passes on other platform + compilers. |
It's possible. But I will say that I stepped through the TextFormatMapTest.Sorted in debug mode and the actual text differed to expected text by more than CR. I can certainly run it again and check. Let me run it again and verify before I burden you with a pull request. I'll check when I get home. I appreciate your prompt response. Thanks. |
I'm very delighted to be wrong! [==========] 1493 tests from 159 test cases ran. (3395 ms total) Thanks again for all your help. I'm going to try "Close and comment." If it doesn't close, you can close it. |
@nslay, what did you do to fix the problem? I am getting almost same set of error (one less failure than your set). This is under both 32 and 64 bit, VS 2013. |
Hi kkm000, I had to convert text files to CR from CRLF. That was the remaining issue. Also, the unit test executable expects to run in the source directory while also having access to other executables/libraries. So just copy all of your executable code into the source directory to be safe. |
@nslay: Thanks. I figured it out as well. I think that it makes sense to fix the tests so that both line endings are acceptable. The test currently do literal comparison to golden strings having '\n' s in them. |
See reproduction notes below.
Summary:
[ PASSED ] 1477 tests.
[ FAILED ] 16 tests, listed below:
[ FAILED ] EncodeDecodeTest.Encode
[ FAILED ] EncodeDecodeTest.Decode
[ FAILED ] EncodeDecodeTest.Partial
[ FAILED ] EncodeDecodeTest.DecodeRaw
[ FAILED ] EncodeDecodeTest.UnknownType
[ FAILED ] EncodeDecodeTest.ProtoParseError
[ FAILED ] BootstrapTest.GeneratedDescriptorMatches
[ FAILED ] GeneratedDescriptorTest.IdenticalDescriptors
[ FAILED ] RubyGeneratorTest.GeneratorTest
[ FAILED ] TextFormatMapTest.Sorted
[ FAILED ] MessageTest.ParseFromFileDescriptor
[ FAILED ] MessageTest.ParsePackedFromFileDescriptor
[ FAILED ] TextFormatTest.Basic
[ FAILED ] TextFormatTest.ParseBasic
[ FAILED ] TextFormatExtensionsTest.Extensions
[ FAILED ] TextFormatExtensionsTest.ParseExtensions
16 FAILED TESTS
Reproduce:
I used gmock-1.7.0 from an old Google Code page of gmock.
Making it build in VS 2010:
You'll want to replace the following in several places
isnan() with _isnan()
isfinite() with _finite()
VS 2010 acts dumb and complains about not initializing const members of a union. Make all const members of the union non-const (datapiece.h). While VS 2010 includes quite a bit of C++11, I'm not sure how well it works with that non-POD data member in the union.
VS 2010 complains about passing NULL to a std::pair<char *, int> constructor since it treats NULL as an integer. You'll need to cast NULL to (char *) around line 154 in json_util_test.cpp while initializing last_segment_.
There's also a scary lseek() #define somewhere. I forget where, but it doesn't actually perform a seek.
Other than that, it was pretty easy to setup, compile and run. Thanks for the convenient CMakelists.txt!
The text was updated successfully, but these errors were encountered: