From fabbe931ab45651edc154693c7b06cc8ce171e28 Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Tue, 19 Dec 2023 14:37:22 +0100 Subject: [PATCH 1/4] pdal: enable unit tests --- pkgs/development/libraries/pdal/default.nix | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/pdal/default.nix b/pkgs/development/libraries/pdal/default.nix index 1c11e4d449e1..f96f6c64adf3 100644 --- a/pkgs/development/libraries/pdal/default.nix +++ b/pkgs/development/libraries/pdal/default.nix @@ -1,6 +1,5 @@ { lib, stdenv , fetchFromGitHub -, fetchpatch , cmake , pkg-config , openscenegraph @@ -59,6 +58,8 @@ stdenv.mkDerivation rec { "-DBUILD_PLUGIN_HDF=ON" "-DBUILD_PLUGIN_PGPOINTCLOUD=ON" "-DBUILD_PLUGIN_TILEDB=ON" + "-DWITH_TESTS=ON" + "-DBUILD_PGPOINTCLOUD_TESTS=OFF" # Plugins can probably not be made work easily: "-DBUILD_PLUGIN_CPD=OFF" @@ -75,6 +76,36 @@ stdenv.mkDerivation rec { "-DBUILD_PLUGIN_RIVLIB=OFF" ]; + doCheck = true; + + disabledTests = [ + # Tests failing due to TileDB library implementation, disabled also + # by upstream CI. + # See: https://github.com/PDAL/PDAL/blob/bc46bc77f595add4a6d568a1ff923d7fe20f7e74/.github/workflows/linux.yml#L81 + "pdal_io_tiledb_writer_test" + "pdal_io_tiledb_reader_test" + "pdal_io_tiledb_time_writer_test" + "pdal_io_tiledb_time_reader_test" + "pdal_io_tiledb_bit_fields_test" + "pdal_io_e57_read_test" + "pdal_io_e57_write_test" + "pdal_io_stac_reader_test" + + # Segfault + "pdal_io_hdf_reader_test" + + # Failure + "pdal_app_plugin_test" + ]; + + checkPhase = '' + runHook preCheck + # tests are flaky and they seem to fail less often when they don't run in + # parallel + ctest -j 1 --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$' + runHook postCheck + ''; + meta = with lib; { description = "PDAL is Point Data Abstraction Library. GDAL for point cloud data"; homepage = "https://pdal.io"; From c6e8d2b31ed1a686cbd402d713af0cae281e609d Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Tue, 19 Dec 2023 14:54:11 +0100 Subject: [PATCH 2/4] pdal: add package tests --- pkgs/development/libraries/pdal/default.nix | 13 +++++++++---- pkgs/development/libraries/pdal/tests.nix | 10 ++++++++++ 2 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 pkgs/development/libraries/pdal/tests.nix diff --git a/pkgs/development/libraries/pdal/default.nix b/pkgs/development/libraries/pdal/default.nix index f96f6c64adf3..a5c3740b8721 100644 --- a/pkgs/development/libraries/pdal/default.nix +++ b/pkgs/development/libraries/pdal/default.nix @@ -1,4 +1,5 @@ { lib, stdenv +, callPackage , fetchFromGitHub , cmake , pkg-config @@ -19,14 +20,14 @@ , zstd }: -stdenv.mkDerivation rec { +stdenv.mkDerivation (finalAttrs: { pname = "pdal"; version = "2.5.6"; src = fetchFromGitHub { owner = "PDAL"; repo = "PDAL"; - rev = version; + rev = finalAttrs.version; sha256 = "sha256-JKwa89c05EfZ/FxOkj8lYmw0o2EgSqafRDIV2mTpZ5E="; }; @@ -102,10 +103,14 @@ stdenv.mkDerivation rec { runHook preCheck # tests are flaky and they seem to fail less often when they don't run in # parallel - ctest -j 1 --output-on-failure -E '^${lib.concatStringsSep "|" disabledTests}$' + ctest -j 1 --output-on-failure -E '^${lib.concatStringsSep "|" finalAttrs.disabledTests}$' runHook postCheck ''; + passthru.tests = { + pdal = callPackage ./tests.nix { pdal = finalAttrs.finalPackage; }; + }; + meta = with lib; { description = "PDAL is Point Data Abstraction Library. GDAL for point cloud data"; homepage = "https://pdal.io"; @@ -113,4 +118,4 @@ stdenv.mkDerivation rec { maintainers = teams.geospatial.members; platforms = platforms.all; }; -} +}) diff --git a/pkgs/development/libraries/pdal/tests.nix b/pkgs/development/libraries/pdal/tests.nix new file mode 100644 index 000000000000..1f71626856b3 --- /dev/null +++ b/pkgs/development/libraries/pdal/tests.nix @@ -0,0 +1,10 @@ +{ runCommand, pdal }: + +let + inherit (pdal) pname; +in +runCommand "${pname}-tests" { meta.timeout = 60; } + '' + ${pdal}/bin/pdal --drivers + touch $out + '' From 51ae8643e49278898a4a82788b723950587d462e Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Tue, 19 Dec 2023 15:00:34 +0100 Subject: [PATCH 3/4] pdal: alphabetical re-ordering of dependencies --- pkgs/development/libraries/pdal/default.nix | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/pkgs/development/libraries/pdal/default.nix b/pkgs/development/libraries/pdal/default.nix index a5c3740b8721..3fe28a4ebe11 100644 --- a/pkgs/development/libraries/pdal/default.nix +++ b/pkgs/development/libraries/pdal/default.nix @@ -1,18 +1,21 @@ -{ lib, stdenv +{ lib +, stdenv , callPackage , fetchFromGitHub + +, enableE57 ? lib.meta.availableOn stdenv.hostPlatform libe57format + , cmake -, pkg-config -, openscenegraph , curl , gdal , hdf5-cpp , LASzip -, enableE57 ? lib.meta.availableOn stdenv.hostPlatform libe57format , libe57format , libgeotiff , libtiff , libxml2 +, openscenegraph +, pkg-config , postgresql , tiledb , xercesc @@ -37,7 +40,6 @@ stdenv.mkDerivation (finalAttrs: { ]; buildInputs = [ - openscenegraph curl gdal hdf5-cpp @@ -45,6 +47,7 @@ stdenv.mkDerivation (finalAttrs: { libgeotiff libtiff libxml2 + openscenegraph postgresql tiledb xercesc From e6ba94f191c169b0ed198353121e55bdcba8e41f Mon Sep 17 00:00:00 2001 From: Ivan Mincik Date: Tue, 19 Dec 2023 15:32:11 +0100 Subject: [PATCH 4/4] pdal: add pkg-config and version tests --- pkgs/development/libraries/pdal/default.nix | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/pkgs/development/libraries/pdal/default.nix b/pkgs/development/libraries/pdal/default.nix index 3fe28a4ebe11..4f477a94a683 100644 --- a/pkgs/development/libraries/pdal/default.nix +++ b/pkgs/development/libraries/pdal/default.nix @@ -2,6 +2,7 @@ , stdenv , callPackage , fetchFromGitHub +, testers , enableE57 ? lib.meta.availableOn stdenv.hostPlatform libe57format @@ -111,7 +112,13 @@ stdenv.mkDerivation (finalAttrs: { ''; passthru.tests = { + version = testers.testVersion { + package = finalAttrs.finalPackage; + command = "pdal --version"; + version = "pdal ${finalAttrs.finalPackage.version}"; + }; pdal = callPackage ./tests.nix { pdal = finalAttrs.finalPackage; }; + pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; }; meta = with lib; { @@ -120,5 +127,6 @@ stdenv.mkDerivation (finalAttrs: { license = licenses.bsd3; maintainers = teams.geospatial.members; platforms = platforms.all; + pkgConfigModules = [ "pdal" ]; }; })