Unverified Commit d95f2f39 authored by K900's avatar K900 Committed by GitHub
Browse files

Merge pull request #275416 from NixOS/pdal-tests

pdal: enable unit and package tests
parents b4394617 e6ba94f1
Loading
Loading
Loading
Loading
+56 −9
Original line number Diff line number Diff line
{ lib, stdenv
{ lib
, stdenv
, callPackage
, fetchFromGitHub
, fetchpatch
, testers

, 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
@@ -20,14 +24,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=";
  };

@@ -37,7 +41,6 @@ stdenv.mkDerivation rec {
  ];

  buildInputs = [
    openscenegraph
    curl
    gdal
    hdf5-cpp
@@ -45,6 +48,7 @@ stdenv.mkDerivation rec {
    libgeotiff
    libtiff
    libxml2
    openscenegraph
    postgresql
    tiledb
    xercesc
@@ -59,6 +63,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,11 +81,52 @@ 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 "|" finalAttrs.disabledTests}$'
    runHook postCheck
  '';

  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; {
    description = "PDAL is Point Data Abstraction Library. GDAL for point cloud data";
    homepage = "https://pdal.io";
    license = licenses.bsd3;
    maintainers = teams.geospatial.members;
    platforms = platforms.all;
    pkgConfigModules = [ "pdal" ];
  };
}
})
+10 −0
Original line number Diff line number Diff line
{ runCommand, pdal }:

let
  inherit (pdal) pname;
in
runCommand "${pname}-tests" { meta.timeout = 60; }
  ''
    ${pdal}/bin/pdal --drivers
    touch $out
  ''