#16 Actually enable tests.
Merged 3 years ago by smani. Opened 3 years ago by qulogic.
rpms/ qulogic/gdal rawhide  into  rawhide

file modified
+28 -10
@@ -77,6 +77,8 @@ 

  Patch8:        %{name}-gcc11.patch

  # Drop -diag-disable compile flag

  Patch9:        gdal_no-diag-disable.patch

+ # Increase some testing tolerances for new Proj.

+ Patch10:       gdalautotest-increase-tolerances.patch

  

  

  BuildRequires: gcc
@@ -153,6 +155,8 @@ 

  BuildRequires: python3-devel

  BuildRequires: python3-numpy

  BuildRequires: python3-setuptools

+ BuildRequires: python3dist(pytest) >= 3.6

+ BuildRequires: python3dist(lxml) >= 4.5.1

  %endif

  BuildRequires: sqlite-devel

  BuildRequires: swig
@@ -319,6 +323,15 @@ 

    sed -i 's|with_dods_root/lib|with_dods_root/lib64|' configure.ac

  %endif

  

+ # Tests expect to be next to gdal source directory, but we extract them within

+ # it. And putting tests next to the source directory wouldn't account for the

+ # version in the directory name, anyway, so we need to correct this.

+ sed -i \

+     -e 's!../../gdal/swig/python/samples!../../swig/python/samples!' \

+     %{name}autotest-%{testversion}/gcore/{cog,tiff_write}.py \

+     %{name}autotest-%{testversion}/gdrivers/{gpkg,jp2lura,jp2openjpeg,test_validate_jp2}.py \

+     %{name}autotest-%{testversion}/ogr/ogr_gpkg.py

+ 

  

  %build

  # For future reference:
@@ -529,8 +542,6 @@ 

  %endif

  

  pushd %{name}autotest-%{testversion}

- 	# Export test enviroment

- 	export PYTHONPATH=$PYTHONPATH:%{buildroot}%{python2_sitearch}

  	#TODO: Nötig?

  	export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%{buildroot}%{_libdir}

  	# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:%%{buildroot}%%{_libdir}:$java_inc
@@ -541,14 +552,21 @@ 

  	#export GDAL_RUN_SLOW_TESTS=1

  	#export GDAL_DOWNLOAD_TEST_DATA=1

  

- 	# Remove some test cases that would require special preparation

- 	rm -rf ogr/ogr_pg.py # No database available

- 	rm -rf ogr/ogr_mysql.py # No database available

- 	rm -rf osr/osr_esri.py # ESRI datum absent

- 	rm -rf osr/osr_erm.py # File from ECW absent

- 

- 	# Run tests but force normal exit in the end

- 	./run_all.py || true

+ 	# Some tests are currently skipped:

+ 	# - FIXME: `test_fits_vector` because it's crashing.

+ 	# - `test_http*`, `test_jp2openjpeg_45`, `*multithreaded_download*`,

+ 	#   `*multithreaded_upload*`, and `test_vsis3_no_sign_request`, which

+ 	#   try to connect externally.

+ 	# - `test_eedai_GOOGLE_APPLICATION_CREDENTIALS` which seems to use the

+ 	#   internet.

+ 	# - `test_osr_erm_1`, `test_ers_4`, `test_ers_8`, and `test_ers_10` as

+ 	#   they use `ecw_cs.wkt` which was removed due to unclear license.

+ 	# - `test_jpeg2000_8` and `test_jpeg2000_11` as files don't load,

+ 	#   perhaps due to buggy Jasper library?

+ 	# - `test_osr_ct_options_area_of_interest` returns the wrong value, but

+ 	#   it's skipped on macOS by upstream for mysteriously failing as well,

+ 	#   so do the same here.

+ 	%{pytest} -k 'not test_fits_vector and not test_http and not test_jp2openjpeg_45 and not multithreaded_download and not multithreaded_upload and not test_vsis3_no_sign_request and not test_eedai_GOOGLE_APPLICATION_CREDENTIALS and not test_osr_erm_1 and not test_ers_4 and not test_ers_8 and not test_ers_10 and not test_jpeg2000_8 and not test_jpeg2000_11 and not test_osr_ct_options_area_of_interest'

  popd

  %endif

  #%%{run_tests}

@@ -0,0 +1,46 @@ 

+ diff -uPNr gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/alg/warp.py gdal-3.2.1-fedora/gdalautotest-3.2.1/alg/warp.py

+ --- gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/alg/warp.py	2020-12-29 07:16:07.000000000 -0500

+ +++ gdal-3.2.1-fedora/gdalautotest-3.2.1/alg/warp.py	2021-02-07 04:57:31.866254137 -0500

+ @@ -1628,9 +1628,9 @@

+          for option in ('-wo USE_GENERAL_CASE=TRUE', ''):

+              # First checksum is proj 4.8, second proj 4.9.2

+              for alg_name, expected_cs in (('near', [3781, 3843]),

+ -                                          ('cubic', [3942, 4133]),

+ -                                          ('cubicspline', [3874, 4076]),

+ -                                          ('bilinear', [4019, 3991])):

+ +                                          ('cubic', [3942, 4133, 3955]),

+ +                                          ('cubicspline', [3874, 4076, 3885]),

+ +                                          ('bilinear', [4019, 3991, 4021])):

+                  dst_ds.GetRasterBand(1).Fill(0)

+                  dst_ds.GetRasterBand(2).Fill(0)

+                  gdal.Warp(dst_ds, src_ds,

+ diff -uPNr gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/gcore/transformer.py gdal-3.2.1-fedora/gdalautotest-3.2.1/gcore/transformer.py

+ --- gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/gcore/transformer.py	2020-12-29 07:15:48.000000000 -0500

+ +++ gdal-3.2.1-fedora/gdalautotest-3.2.1/gcore/transformer.py	2021-02-07 04:38:46.980284425 -0500

+ @@ -785,11 +785,11 @@

+      tr = gdal.Transformer(ds, None, ['METHOD=RPC', 'RPC_HEIGHT_SCALE=2', 'RPC_DEM=/vsimem/dem.tif', 'RPC_DEM_SRS=EPSG:32652+5773'])

+  

+      (success, pnt) = tr.TransformPoint(0, 0.5, 0.5, 0)

+ -    assert success and pnt[0] == pytest.approx(125.64813723085801, abs=0.000001) and pnt[1] == pytest.approx(39.869345977927146, abs=0.000001), \

+ +    assert success and pnt[0] == pytest.approx(125.64813723085801, abs=1e-4) and pnt[1] == pytest.approx(39.869345977927146, abs=1e-3), \

+          'got wrong forward transform result.'

+  

+      (success, pnt) = tr.TransformPoint(1, pnt[0], pnt[1], pnt[2])

+      assert success and pnt[0] == pytest.approx(0.5, abs=0.05) and pnt[1] == pytest.approx(0.5, abs=0.05), \

+          'got wrong reverse transform result.'

+  

+ -    gdal.Unlink('/vsimem/dem.tif')

+ \ No newline at end of file

+ +    gdal.Unlink('/vsimem/dem.tif')

+ diff -uPNr gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/gdrivers/jp2openjpeg.py gdal-3.2.1-fedora/gdalautotest-3.2.1/gdrivers/jp2openjpeg.py

+ --- gdal-3.2.1-fedora/gdalautotest-3.2.1.orig/gdrivers/jp2openjpeg.py	2021-02-07 04:42:44.757957113 -0500

+ +++ gdal-3.2.1-fedora/gdalautotest-3.2.1/gdrivers/jp2openjpeg.py	2021-02-07 04:27:49.783685518 -0500

+ @@ -597,7 +597,7 @@

+      assert ds.GetRasterBand(2).GetColorInterpretation() == gdal.GCI_GreenBand

+      assert ds.GetRasterBand(3).GetColorInterpretation() == gdal.GCI_BlueBand

+      assert ds.GetRasterBand(4).GetColorInterpretation() == gdal.GCI_AlphaBand

+ -    assert ds.GetRasterBand(1).Checksum() in [11457, 11450, 11498]

+ +    assert ds.GetRasterBand(1).Checksum() in [11457, 11450, 11498, 11502]

+      ds = None

+      gdal.Unlink('/vsimem/jp2openjpeg_22.jp2')

+  

run_all.py does not exist, but that was ignored by the || true. Upstream in fact uses pytest to collect and run tests.

Since tests have been ignored, this may or may not work, especially on other arches.

At the moment, it appears that fits tests are crashing right now on all arches.

Also, with pytest, we could run tests in parallel, assuming they are safe for that.

1 new commit added

  • Skip failing tests or increase some tolerances.
3 years ago

This now skips the current few tests that are failing on x86_64, or increases tolerances slightly, with comments added explaining why. Hopefully, there will not be additional errors on other arches.

I'll leave it to people more familiar with GDAL/cfitsio/Proj to figure out what the exact problem is, or who to report it to, but this should at least catch regressions.

Unfortunately, the readme indicates that tests are not quite independent, so we can't run them in parallel yet.

Pull-Request has been merged by smani

3 years ago

Note, it's looking like this is not going to pass on all arches. Some things like checksums could be ignored, though I'm not sure how they're calculated (maybe it's just a small floating-point problem). I see some big-endian bugs that should be reported upstream (libopencad not able to open files because it's the 'wrong' version, for example).

PS, looking at the scratch build, it got stuck on 32-bit systems as well. Might be best to skip running tests entirely on those arches for now.