Skip to content

Commit 1b13092

Browse files
committed
Tests
MPI test failing still
1 parent b7e2b30 commit 1b13092

2 files changed

Lines changed: 27 additions & 54 deletions

File tree

flake.nix

Lines changed: 10 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -62,55 +62,16 @@
6262
# #systemd.services = { ... };
6363
# };
6464

65-
# # Tests run by 'nix flake check' and by Hydra.
66-
# checks = forAllSystems
67-
# (system:
68-
# with nixpkgsFor.${system};
69-
70-
# {
71-
# inherit (self.packages.${system}) hello;
72-
73-
# # Additional tests, if applicable.
74-
# test = stdenv.mkDerivation {
75-
# pname = "hello-test";
76-
# inherit version;
77-
78-
# buildInputs = [ hello ];
79-
80-
# dontUnpack = true;
81-
82-
# buildPhase = ''
83-
# echo 'running some integration tests'
84-
# [[ $(hello) = 'Hello Nixers!' ]]
85-
# '';
86-
87-
# installPhase = "mkdir -p $out";
88-
# };
89-
# }
90-
91-
# // lib.optionalAttrs stdenv.isLinux {
92-
# # A VM test of the NixOS module.
93-
# vmTest =
94-
# with import (nixpkgs + "/nixos/lib/testing-python.nix") {
95-
# inherit system;
96-
# };
97-
98-
# makeTest {
99-
# nodes = {
100-
# client = { ... }: {
101-
# imports = [ self.nixosModules.hello ];
102-
# };
103-
# };
104-
105-
# testScript =
106-
# ''
107-
# start_all()
108-
# client.wait_for_unit("multi-user.target")
109-
# client.succeed("hello")
110-
# '';
111-
# };
112-
# }
113-
# );
65+
# Tests run by 'nix flake check' and by Hydra.
66+
checks = forAllSystems
67+
(system:
68+
with self.packages.${system};
69+
70+
{
71+
# Additional tests, if applicable.
72+
test = openpmd_api.override { doCheck = true; };
73+
}
74+
);
11475

11576
};
11677
}

nix/openpmd_api/default.nix

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@
99
, adios2 ? null
1010
, mpi ? null
1111
, python ? null
12+
, doCheck ? false
1213
}:
1314

1415
let
15-
cmake_on_off = dependency: if dependency == null then "OFF" else "ON";
16+
cmake_on_off = dependency: if dependency == null || dependency == false then "OFF" else "ON";
1617
pybind11 = python.pkgs.pybind11 or null;
1718

1819
# for key `format`
@@ -29,16 +30,25 @@ let
2930

3031
in
3132
builder (builder_params // rec {
32-
inherit version;
33+
inherit version doCheck;
3334
pname = "openPMD-api";
3435

3536
src = ../..;
3637

3738
preConfigure = ''
3839
# wont find these three otherwise
39-
export CMAKE_PREFIX_PATH="${maybe_path toml11}${maybe_path nlohmann_json}${maybe_path pybind11}$CMAKE_PREFIX_PATH"
40+
export CMAKE_PREFIX_PATH="${maybe_path catch2}${maybe_path toml11}${maybe_path nlohmann_json}${maybe_path pybind11}$CMAKE_PREFIX_PATH"
41+
${if doCheck then ''
42+
# TODO: download samples
43+
'' else ""}
4044
'';
4145

46+
postBuild =
47+
if doCheck then ''
48+
ctest --output-on-failure
49+
false
50+
'' else "";
51+
4252
postInstall = ''
4353
sed -Ei 's|=.*}/'"$out"'|='"$out"'|' $out/lib/pkgconfig/openPMD.pc
4454
'';
@@ -70,8 +80,8 @@ builder (builder_params // rec {
7080
]);
7181

7282
cmakeFlags = [
73-
"-DopenPMD_BUILD_TESTING=OFF"
74-
"-DopenPMD_BUILD_EXAMPLES=OFF"
83+
"-DopenPMD_BUILD_TESTING=${cmake_on_off doCheck}"
84+
"-DopenPMD_BUILD_EXAMPLES=${cmake_on_off doCheck}"
7585
"-DopenPMD_USE_ADIOS2=${cmake_on_off adios2}"
7686
"-DopenPMD_USE_HDF5=${cmake_on_off hdf5}"
7787
"-DopenPMD_USE_MPI=${cmake_on_off mpi}"
@@ -85,6 +95,8 @@ builder (builder_params // rec {
8595
++ (if mpi != null && python != null then [
8696
"-DCMAKE_C_COMPILER=${mpi.dev}/bin/mpicc"
8797
"-DCMAKE_CXX_COMPILER=${mpi.dev}/bin/mpicxx"
98+
] else [ ]) ++ (if mpi != null && doCheck then [
99+
"-DMPIEXEC_EXECUTABLE=${mpi}/bin/mpiexec"
88100
] else [ ]);
89101

90102
meta = {

0 commit comments

Comments
 (0)