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

gdal3 ci #86

Merged
merged 1 commit into from
Sep 30, 2020
Merged

gdal3 ci #86

merged 1 commit into from
Sep 30, 2020

Conversation

michaelkirk
Copy link
Member

@michaelkirk michaelkirk commented Aug 28, 2020

Tests are currently failing for gdal 3.1 on both mac and linux.

Crate changes

  • adds gdal_3_1 features
  • adds prebuilt 3.1 bindings
  • changes some test expactations for gdal_3_1
  • extracts gdal_3 feature, which is shared by gdal_3_0 and gdal_3_1 for sharing test behavior.

CI Changes

  • Adds a stable-rust gdal 3.0 target for linux
  • Adds a stable-rust gdal 2.4 target for macos
  • Adds a stable-rust gdal 3.1 target for macos

For now, I've maintained all the existing stable, beta, nightly gdal 2.0 test runners, though it might make sense to remove some of these older ones and emphasize more modern combinations if that better reflects the user base. The work in this PR makes it fairly easy to shuffle around the test matrix.

@michaelkirk michaelkirk mentioned this pull request Aug 28, 2020
@rmanoka
Copy link
Contributor

rmanoka commented Aug 29, 2020

@michaelkirk Nice scripts! Looking through some of the proj tests that have failed, it seems the test case indeed covers gdal 3.0 also. See for example:

#[test]
fn from_epsg_to_wkt_proj4() {
    let spatial_ref = SpatialRef::from_epsg(4326).unwrap();
    let wkt = spatial_ref.to_wkt().unwrap();
    // TODO: handle proj changes on lib level
    #[cfg(not(feature = "gdal_3_0"))]
    assert_eq!("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AUTHORITY[\"EPSG\",\"4326\"]]", wkt);
    #[cfg(feature = "gdal_3_0")]
    assert_eq!("GEOGCS[\"WGS 84\",DATUM[\"WGS_1984\",SPHEROID[\"WGS 84\",6378137,298.257223563,AUTHORITY[\"EPSG\",\"7030\"]],AUTHORITY[\"EPSG\",\"6326\"]],PRIMEM[\"Greenwich\",0,AUTHORITY[\"EPSG\",\"8901\"]],UNIT[\"degree\",0.0174532925199433,AUTHORITY[\"EPSG\",\"9122\"]],AXIS[\"Latitude\",NORTH],AXIS[\"Longitude\",EAST],AUTHORITY[\"EPSG\",\"4326\"]]", wkt);
    let proj4string = spatial_ref.to_proj4().unwrap();
    assert_eq!("+proj=longlat +datum=WGS84 +no_defs", proj4string.trim());
}

It seems to expect the feature gdal_3_0 to be set. Could you add this feature tag in CI for 3.0? This might fix many of the issues.

Some of the raster tests are being run on a png file, which seems to have been fixed upstream to not give any GIS metadata (scale, offset). Might be prudent to use a geotiff here (see "tinymarble.png"). We could convert the png into a tiff as follows:

# from inside fixtures/ directory
gdalwarp -to SRC_METHOD=NO_GEOTRANSFORM -te 0 0 100 50 tinymarble.png tinymarble.tif

This will create a tinymarble.tif file; then we could modify the failing tests to use tinymarble.tif instead. Specifically, tests get_offset and get_scale in src/raster/tests.rs . should now pass on both gdal versions.

@michaelkirk
Copy link
Member Author

An update:

GDAL 2.0 builds passing on linux (ubuntu trusty) and macos.

GDAL 3.0 build on macos is failing these two tests:

---- raster::tests::test_get_offset stdout ----
thread 'raster::tests::test_get_offset' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some(0.0)`', src/raster/tests.rs:347:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
---- raster::tests::test_get_scale stdout ----
thread 'raster::tests::test_get_scale' panicked at 'assertion failed: `(left == right)`
  left: `None`,
 right: `Some(1.0)`', src/raster/tests.rs:339:5
failures:
    raster::tests::test_get_offset
    raster::tests::test_get_scale
test result: FAILED. 69 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out

https://travis-ci.org/github/georust/gdal/jobs/722360412#L298

these the the problematic lines:
gdal_sys::GDALGetRasterScale(self.c_rasterband, &mut pb_success)
and
gdal_sys::GDALGetRasterOffset(self.c_rasterband, &mut pb_success)

On macos, both fail because pb_success != 1

Some of the raster tests are being run on a png file, which seems to have been fixed upstream to not give any GIS metadata (scale, offset).

Interestingly, GDAL 3.0 build on linux (ubuntu bionic) is passing these same tests:
https://travis-ci.org/github/georust/gdal/jobs/722360408#L857

Does that debunk the theory that it's just a matter of a bad PNG @rmanoka?

For context, I'm not familiar with GDAL, or even explicitly using it. This was all in pursuit of updating to the latest geo-types, but figured I should have a working test suite first.

@michaelkirk
Copy link
Member Author

This will create a tinymarble.tif file; then we could modify the failing tests to use tinymarble.tif instead. Specifically, tests get_offset and get_scale in src/raster/tests.rs . should now pass on both gdal versions.

Also, just tried this, and tests still failing for me.

@rmanoka
Copy link
Contributor

rmanoka commented Aug 31, 2020

@michaelkirk Found this relevant issue on OSGeo/gdal. It seems like it changed with release 3.1.0. The linux CI might be passing because it is 3.x but < 3.1.0. The issue also suggests the same behavior for tif files, so I was wrong there. Unfortunately, we can't use the feature flag as the regression is between 3.0 and 3.1.0.

Could you try this: once you have the tinymarble.tif ; run:

gdal_edit -scale 1.2 -offset 12 file.tif

Then, in the test, we should look for these two values (instead of 1.0, 0.0). Now that we're setting explicit non-default values, I'm hoping it will reflect in the calls.

@michaelkirk michaelkirk force-pushed the mkirk/gdal3-ci branch 7 times, most recently from 451f712 to de8ae12 Compare August 31, 2020 21:50
@michaelkirk
Copy link
Member Author

Thanks for your guidance @rmanoka, I think this PR is now ready for review.

@michaelkirk michaelkirk marked this pull request as ready for review August 31, 2020 22:03
@jdroenner
Copy link
Member

Hi, thank you for your contribution. This kind of issue is why i ceated the "Feature_gated_versions" branch which i intend to merge into master soon. It splits gdal 2 and 3 and add Features for different versions.
However, i am away for the next 10 days. Untill then think i can't review or merge PRs.

@michaelkirk
Copy link
Member Author

This kind of issue is why i ceated the "Feature_gated_versions" branch which i intend to merge into master soon. It splits gdal 2 and 3 and add Features for different versions.

To be clear, the issue here was not one of a new feature being added or removed. Rather, the behavior of an existing method changed and we weren't running CI to test that version.

@jdroenner
Copy link
Member

Oh sorry if i got it wrong. There are so many issues related to the versioning i thought it is one of them.

@jdroenner
Copy link
Member

Could you update this PR to reflect the changes in version handling?

@michaelkirk michaelkirk force-pushed the mkirk/gdal3-ci branch 2 times, most recently from f73b548 to d887cd3 Compare September 30, 2020 07:55
- enable GDAL3 tests for CI
- Speed up gdal3 build on osx by using newer image instead of brew upgrade

for `rasterband.scale` and `rasterband.offset`, default values behave
differently for v3.1. See  OSGeo/gdal#2579 for
details.

gdalwarp -to SRC_METHOD=NO_GEOTRANSFORM -te 0 0 100 50 tinymarble.png offset_scaled_tinymarble.tif
gdal_edit -scale 1.2 -offset 12 offset_scaled_tinymarble.tif

prebuild 3.1 bindings

Built on the gdal 3.1.0 ubuntu-full docker container:
https://hub.docker.com/layers/osgeo/gdal/ubuntu-full-3.1.0/images/sha256-6c6bf79e32b6f33d1d2b29761f78e05557b0f2a491fe799ae1e56aad3c5c868d
@michaelkirk
Copy link
Member Author

Could you update this PR to reflect the changes in version handling?

Done! Provided CI passes this should be good to go.

@jdroenner jdroenner merged commit ee245b6 into georust:master Sep 30, 2020
@jdroenner jdroenner mentioned this pull request Oct 1, 2020
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

Successfully merging this pull request may close these issues.

3 participants