Merge pull request #290298 from l0b0/gdal-test-separation

gdal: Split tests into separate attributes
This commit is contained in:
Robert Schütz 2024-02-22 05:21:59 +00:00 committed by GitHub
commit f433c05d56
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 32 additions and 26 deletions

View file

@ -270,9 +270,7 @@ stdenv.mkDerivation (finalAttrs: {
popd # autotest popd # autotest
''; '';
passthru.tests = { passthru.tests = callPackage ./tests.nix { gdal = finalAttrs.finalPackage; };
gdal = callPackage ./tests.nix { gdal = finalAttrs.finalPackage; };
};
__darwinAllowLocalNetworking = true; __darwinAllowLocalNetworking = true;

View file

@ -1,34 +1,40 @@
{ runCommand, gdal, jdk }: { runCommand, gdal, jdk, lib, testers }:
let let
inherit (gdal) pname version; inherit (gdal) pname version;
in in
runCommand "${pname}-tests" { meta.timeout = 60; } {
'' ogrinfo-version = testers.testVersion {
# test version package = gdal;
${gdal}/bin/ogrinfo --version \ command = "ogrinfo --version";
| grep 'GDAL ${version}' };
${gdal}/bin/gdalinfo --version \ gdalinfo-version = testers.testVersion {
| grep 'GDAL ${version}' package = gdal;
command = "gdalinfo --version";
};
ogrinfo-format-geopackage = runCommand "${pname}-ogrinfo-format-geopackage" { } ''
# test formats ${lib.getExe' gdal "ogrinfo"} --formats \
${gdal}/bin/ogrinfo --formats \
| grep 'GPKG.*GeoPackage' | grep 'GPKG.*GeoPackage'
touch $out
'';
${gdal}/bin/gdalinfo --formats \ gdalinfo-format-geotiff = runCommand "${pname}-gdalinfo-format-geotiff" { } ''
${lib.getExe' gdal "gdalinfo"} --formats \
| grep 'GTiff.*GeoTIFF' | grep 'GTiff.*GeoTIFF'
touch $out
'';
vector-file = runCommand "${pname}-vector-file" { } ''
# test vector file
echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv echo -e "Latitude,Longitude,Name\n48.1,0.25,'Test point'" > test.csv
${gdal}/bin/ogrinfo ./test.csv ${lib.getExe' gdal "ogrinfo"} ./test.csv
touch $out
'';
raster-file = runCommand "${pname}-raster-file" { } ''
# test raster file ${lib.getExe' gdal "gdal_create"} \
${gdal}/bin/gdal_create \
-a_srs "EPSG:4326" \ -a_srs "EPSG:4326" \
-of GTiff \ -of GTiff \
-ot UInt16 \ -ot UInt16 \
@ -38,9 +44,11 @@ runCommand "${pname}-tests" { meta.timeout = 60; }
-co COMPRESS=LZW \ -co COMPRESS=LZW \
test.tif test.tif
${gdal}/bin/gdalinfo ./test.tif ${lib.getExe' gdal "gdalinfo"} ./test.tif
touch $out
'';
# test java bindings java-bindings = runCommand "${pname}-java-bindings" { } ''
cat <<EOF > main.java cat <<EOF > main.java
import org.gdal.gdal.gdal; import org.gdal.gdal.gdal;
class Main { class Main {
@ -49,7 +57,7 @@ runCommand "${pname}-tests" { meta.timeout = 60; }
} }
} }
EOF EOF
${jdk}/bin/java -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java ${lib.getExe jdk} -Djava.library.path=${gdal}/lib/ -cp ${gdal}/share/java/gdal-${version}.jar main.java
touch $out touch $out
'' '';
}