Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)

gdal: Split tests into separate attributes

Makes it easier to run single tests for debugging purposes.

Co-authored-by: Robert Schütz <github@dotlambda.de>

+32 -26
+1 -3
pkgs/development/libraries/gdal/default.nix
··· 270 270 popd # autotest 271 271 ''; 272 272 273 - passthru.tests = { 274 - gdal = callPackage ./tests.nix { gdal = finalAttrs.finalPackage; }; 275 - }; 273 + passthru.tests = callPackage ./tests.nix { gdal = finalAttrs.finalPackage; }; 276 274 277 275 __darwinAllowLocalNetworking = true; 278 276
+31 -23
pkgs/development/libraries/gdal/tests.nix
··· 1 - { runCommand, gdal, jdk }: 1 + { runCommand, gdal, jdk, lib, testers }: 2 2 3 3 let 4 4 inherit (gdal) pname version; 5 5 6 6 in 7 - runCommand "${pname}-tests" { meta.timeout = 60; } 8 - '' 9 - # test version 10 - ${gdal}/bin/ogrinfo --version \ 11 - | grep 'GDAL ${version}' 7 + { 8 + ogrinfo-version = testers.testVersion { 9 + package = gdal; 10 + command = "ogrinfo --version"; 11 + }; 12 12 13 - ${gdal}/bin/gdalinfo --version \ 14 - | grep 'GDAL ${version}' 13 + gdalinfo-version = testers.testVersion { 14 + package = gdal; 15 + command = "gdalinfo --version"; 16 + }; 15 17 16 - 17 - # test formats 18 - ${gdal}/bin/ogrinfo --formats \ 18 + ogrinfo-format-geopackage = runCommand "${pname}-ogrinfo-format-geopackage" { } '' 19 + ${lib.getExe' gdal "ogrinfo"} --formats \ 19 20 | grep 'GPKG.*GeoPackage' 21 + touch $out 22 + ''; 20 23 21 - ${gdal}/bin/gdalinfo --formats \ 24 + gdalinfo-format-geotiff = runCommand "${pname}-gdalinfo-format-geotiff" { } '' 25 + ${lib.getExe' gdal "gdalinfo"} --formats \ 22 26 | grep 'GTiff.*GeoTIFF' 27 + touch $out 28 + ''; 23 29 24 - 25 - # test vector file 30 + vector-file = runCommand "${pname}-vector-file" { } '' 26 31 echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv 27 - ${gdal}/bin/ogrinfo ./test.csv 32 + ${lib.getExe' gdal "ogrinfo"} ./test.csv 33 + touch $out 34 + ''; 28 35 29 - 30 - # test raster file 31 - ${gdal}/bin/gdal_create \ 36 + raster-file = runCommand "${pname}-raster-file" { } '' 37 + ${lib.getExe' gdal "gdal_create"} \ 32 38 -a_srs "EPSG:4326" \ 33 39 -of GTiff \ 34 40 -ot UInt16 \ ··· 38 44 -co COMPRESS=LZW \ 39 45 test.tif 40 46 41 - ${gdal}/bin/gdalinfo ./test.tif 47 + ${lib.getExe' gdal "gdalinfo"} ./test.tif 48 + touch $out 49 + ''; 42 50 43 - # test java bindings 51 + java-bindings = runCommand "${pname}-java-bindings" { } '' 44 52 cat <<EOF > main.java 45 53 import org.gdal.gdal.gdal; 46 54 class Main { ··· 49 57 } 50 58 } 51 59 EOF 52 - ${jdk}/bin/java -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java 53 - 60 + ${lib.getExe jdk} -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java 54 61 touch $out 55 - '' 62 + ''; 63 + }