From 99d797bc991789130c29f3233646d2cff17c8a77 Mon Sep 17 00:00:00 2001 From: Maarten Pronk Date: Wed, 13 Nov 2024 22:19:30 +0100 Subject: [PATCH] Fix tests for GDAL 3.9. --- test/test_drivers.jl | 2 +- test/test_feature.jl | 170 +++++++++++++++--------------- test/test_gdalutilities_errors.jl | 30 +++--- 3 files changed, 105 insertions(+), 97 deletions(-) diff --git a/test/test_drivers.jl b/test/test_drivers.jl index 35c7568a..777595f9 100644 --- a/test/test_drivers.jl +++ b/test/test_drivers.jl @@ -83,7 +83,7 @@ import ArchGDAL as AG "RandomWrite" => false, "RandomRead" => true, "CurveGeometries" => false, - "FastGetExtent" => false, + "FastGetExtent" => true, "Transactions" => false, "AlterFieldDefn" => false, ) diff --git a/test/test_feature.jl b/test/test_feature.jl index b283fd2f..2157f94f 100644 --- a/test/test_feature.jl +++ b/test/test_feature.jl @@ -97,99 +97,101 @@ end @test AG.validate(f, AG.F_VAL_ALLOW_DIFFERENT_GEOM_DIM, false) == true - @testset "Missing and Null Semantics" begin - @test isnothing(AG.getdefault(f, 1)) - AG.setdefault!(AG.getfielddefn(f, 1), "default value") - @test AG.getdefault(f, 1) == "default value" + # This testset is commented because GDAL 3.9 has disabled most of this behaviour in C + # https://gdal.org/en/latest/development/rfc/rfc97_feature_and_fielddefn_sealing.html + # @testset "Missing and Null Semantics" begin + # @test isnothing(AG.getdefault(f, 1)) + # AG.setdefault!(AG.getfielddefn(f, 1), "default value") + # @test AG.getdefault(f, 1) == "default value" - @test AG.isfieldsetandnotnull(f, 1) - @test AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) - @test AG.getfield(f, 1) == "point-a" + # @test AG.isfieldsetandnotnull(f, 1) + # @test AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) + # @test AG.getfield(f, 1) == "point-a" - AG.unsetfield!(f, 1) - @test !AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) # carried over from earlier - @test isnothing(AG.getfield(f, 1)) + # AG.unsetfield!(f, 1) + # @test !AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) # carried over from earlier + # @test isnothing(AG.getfield(f, 1)) - # unset & notnull: missing - AG.fillunsetwithdefault!(f) - # nothing has changed - @test isnothing(AG.getfield(f, 1)) - # because it is a nullable field - @test AG.isnullable(AG.getfielddefn(f, 1)) - # even though it is not a null value - @test !AG.isfieldnull(f, 1) - # the field is still not set - @test !AG.isfieldset(f, 1) + # # unset & notnull: missing + # AG.fillunsetwithdefault!(f) + # # nothing has changed + # @test isnothing(AG.getfield(f, 1)) + # # because it is a nullable field + # @test AG.isnullable(AG.getfielddefn(f, 1)) + # # even though it is not a null value + # @test !AG.isfieldnull(f, 1) + # # the field is still not set + # @test !AG.isfieldset(f, 1) - # set & notnull: value - AG.fillunsetwithdefault!(f, notnull = false) - if !AG.isdefaultdriverspecific(AG.getfielddefn(f, 1)) - # now the field is set to the default - @test AG.getfield(f, 1) == AG.getdefault(f, 1) - @test AG.isfieldset(f, 1) # the field is now set - end - @test !AG.isfieldnull(f, 1) # still as expected + # # set & notnull: value + # AG.fillunsetwithdefault!(f, notnull = false) + # if !AG.isdefaultdriverspecific(AG.getfielddefn(f, 1)) + # # now the field is set to the default + # @test AG.getfield(f, 1) == AG.getdefault(f, 1) + # @test AG.isfieldset(f, 1) # the field is now set + # end + # @test !AG.isfieldnull(f, 1) # still as expected - # set the field to be notnullable - AG.setnullable!(AG.getfielddefn(f, 1), false) - # now if we unset the field - AG.unsetfield!(f, 1) - @test !AG.isfieldnull(f, 1) - @test !AG.isfieldset(f, 1) - @test isnothing(AG.getfield(f, 1)) - # and we fill unset with default again - AG.fillunsetwithdefault!(f) - if !AG.isdefaultdriverspecific(AG.getfielddefn(f, 1)) - # the field is set to the default - @test AG.getfield(f, 1) == AG.getdefault(f, 1) - @test AG.isfieldset(f, 1) - end - @test !AG.isfieldnull(f, 1) + # # set the field to be notnullable + # AG.setnullable!(AG.getfielddefn(f, 1), false) + # # now if we unset the field + # AG.unsetfield!(f, 1) + # @test !AG.isfieldnull(f, 1) + # @test !AG.isfieldset(f, 1) + # @test isnothing(AG.getfield(f, 1)) + # # and we fill unset with default again + # AG.fillunsetwithdefault!(f) + # if !AG.isdefaultdriverspecific(AG.getfielddefn(f, 1)) + # # the field is set to the default + # @test AG.getfield(f, 1) == AG.getdefault(f, 1) + # @test AG.isfieldset(f, 1) + # end + # @test !AG.isfieldnull(f, 1) - # set & null: missing - AG.setfieldnull!(f, 1) - @test AG.isfieldnull(f, 1) - @test AG.isfieldset(f, 1) - @test ismissing(AG.getfield(f, 1)) + # # set & null: missing + # AG.setfieldnull!(f, 1) + # @test AG.isfieldnull(f, 1) + # @test AG.isfieldset(f, 1) + # @test ismissing(AG.getfield(f, 1)) - # unset & null: N/A (but nothing otherwise) - AG.unsetfield!(f, 1) - # Observe that OGRUnset and OGRNull are mutually exclusive - @test !AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) # notice the field is notnull + # # unset & null: N/A (but nothing otherwise) + # AG.unsetfield!(f, 1) + # # Observe that OGRUnset and OGRNull are mutually exclusive + # @test !AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) # notice the field is notnull - # setting the field for a notnullable column - AG.setnullable!(AG.getfielddefn(f, 1), false) - AG.setfield!(f, 1, "value") - @test AG.getfield(f, 1) == "value" - @test AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) - AG.setfield!(f, 1, missing) - @test AG.getfield(f, 1) == AG.getdefault(f, 1) - @test AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) - AG.setfield!(f, 1, nothing) - @test isnothing(AG.getfield(f, 1)) - @test !AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) + # # setting the field for a notnullable column + # AG.setnullable!(AG.getfielddefn(f, 1), false) + # AG.setfield!(f, 1, "value") + # @test AG.getfield(f, 1) == "value" + # @test AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) + # AG.setfield!(f, 1, missing) + # @test AG.getfield(f, 1) == AG.getdefault(f, 1) + # @test AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) + # AG.setfield!(f, 1, nothing) + # @test isnothing(AG.getfield(f, 1)) + # @test !AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) - # setting the field for a nullable column - AG.setnullable!(AG.getfielddefn(f, 1), true) - AG.setfield!(f, 1, "value") - @test AG.getfield(f, 1) == "value" - @test AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) - AG.setfield!(f, 1, missing) - @test ismissing(AG.getfield(f, 1)) - @test AG.isfieldset(f, 1) - @test AG.isfieldnull(f, 1) # different from that of notnullable - AG.setfield!(f, 1, nothing) - @test isnothing(AG.getfield(f, 1)) - @test !AG.isfieldset(f, 1) - @test !AG.isfieldnull(f, 1) - end + # # setting the field for a nullable column + # AG.setnullable!(AG.getfielddefn(f, 1), true) + # AG.setfield!(f, 1, "value") + # @test AG.getfield(f, 1) == "value" + # @test AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) + # AG.setfield!(f, 1, missing) + # @test ismissing(AG.getfield(f, 1)) + # @test AG.isfieldset(f, 1) + # @test AG.isfieldnull(f, 1) # different from that of notnullable + # AG.setfield!(f, 1, nothing) + # @test isnothing(AG.getfield(f, 1)) + # @test !AG.isfieldset(f, 1) + # @test !AG.isfieldnull(f, 1) + # end end end diff --git a/test/test_gdalutilities_errors.jl b/test/test_gdalutilities_errors.jl index 01803c52..6f7966e9 100644 --- a/test/test_gdalutilities_errors.jl +++ b/test/test_gdalutilities_errors.jl @@ -3,8 +3,8 @@ import ArchGDAL as AG using Test @testset "test_gdalutilities_errors.jl" begin - AG.read("data/utmsmall.tif") do ds_small - @testset "GDAL Error" begin + @testset "GDAL Error" begin + AG.read("data/utmsmall.tif") do ds_small @test_throws GDAL.GDALError AG.gdalinfo( ds_small, ["-novalidoption"], @@ -17,11 +17,14 @@ using Test [ds_small], ["-novalidoption"], ) - @test_throws GDAL.GDALError AG.unsafe_gdaldem( - ds_small, - "hillshade", - ["-novalidoption"], - ) + # This throws + # signal 6: Abort trap: 6 + # libc++abi: terminating due to uncaught exception of type std::invalid_argument + # @test_throws GDAL.GDALError AG.unsafe_gdaldem( + # ds_small, + # "hillshade", + # ["-novalidoption"], + # ) @test_throws GDAL.GDALError AG.unsafe_gdalnearblack( ds_small, ["-novalidoption"], @@ -44,11 +47,14 @@ using Test [ds_small], ["-novalidoption"], ) - @test_throws GDAL.GDALError AG.unsafe_gdaldem( - ds_small, - "hillshade", - ["-novalidoption"], - ) + # This throws + # signal 6: Abort trap: 6 + # libc++abi: terminating due to uncaught exception of type std::invalid_argument + # @test_throws GDAL.GDALError AG.unsafe_gdaldem( + # ds_small, + # "hillshade", + # ["-novalidoption"], + # ) @test_throws GDAL.GDALError AG.unsafe_gdalnearblack( ds_small, ["-novalidoption"],