Despite the raster_test passing on AppVeyor, I get error this locally:
running datastructure-tests.exe ...
Running 28 test cases...
unknown location(0): fatal error in "raster_test": std::exception: Failed to parse raster source correctly.
C:\Projects\osrm\unit_tests\data_structures\range_table.cpp(51): last checkpoint
*** 1 failure detected in test suite "datastructure tests"
Problem: git and line endings
The problem stems from the default behavior of git when cloning text files.
In our case:
unit_tests/fixtures/raster_data.asc
A default install of git on Windows automatically converts line endings of text files during clone (to the system default line endings: CRLF=\r\n) and during commit back to Linux line endings (LF=\n).
On AppVeyor the test passes, because the default behavior of git has been overridden to keep the LF line endings.
It seems that the different possible line endings are not accounted for in raster_source.hpp::RasterGrid
Possible solutions
- add
.gitattributes to tell git to keep LF despite the default settings
- change the code to be platform independent and work with
LF and CRLF
My preference is the second option.
The first option would make the test pass, but would also create problems for Windows users who create their own raster files with Windows line endings.
Despite the
raster_testpassing on AppVeyor, I get error this locally:Problem: git and line endings
The problem stems from the default behavior of git when cloning text files.
In our case:
A default install of
giton Windows automatically converts line endings of text files duringclone(to the system default line endings:CRLF=\r\n) and duringcommitback to Linux line endings (LF=\n).On AppVeyor the test passes, because the default behavior of git has been overridden to keep the
LFline endings.It seems that the different possible line endings are not accounted for in
raster_source.hpp::RasterGridPossible solutions
.gitattributesto tell git to keepLFdespite the default settingsLFandCRLFMy preference is the second option.
The first option would make the test pass, but would also create problems for Windows users who create their own raster files with Windows line endings.