about summary refs log tree commit diff
path: root/third_party/nix/src/CMakeLists.txt
diff options
context:
space:
mode:
authorVincent Ambo <mail@tazj.in>2020-07-17T01·19+0100
committertazjin <mail@tazj.in>2020-07-18T00·01+0000
commitf4f72bcf21127a1f75baa988b765317e80a7486e (patch)
tree138eb7710d8ab361c7a2f9ff51677ed91431ba9e /third_party/nix/src/CMakeLists.txt
parente4b7d6d5925208214927a9e8c8fd72c246bc70ff (diff)
test(3p/nix): Set up scaffolding & fix up tests for value-to-{json|xml} r/1369
Configures the CMake build to load & run the GoogleTest tests.

I (grfn) also updated this to get the tests running as part of the nix
derivation, which required defining our own manual configurePhase and
installCheckPhase, rather than depending on the one provided by stdenv.
Not doing this would cause cmake to attempt to *run* the tests as part
of the buildPhase, which wouldn't work because the dynamic libraries
hadn't been put into a place where the test executables knew where to
find them. We're not sure *why* this fixes it, and for some reason
fixing this also breaks the automatic behavior of nixpkgs of passing
-j$NIX_BUILD_CORES -l$NIX_BUILD_CORES to make, but that's eaasy enough
to fix manually in a preBuild

Paired-With: Griffin Smith <grfn@gws.fyi>
Change-Id: I79d61854a3ff47301cdce8a40c76820a97bdf901
Reviewed-on: https://cl.tvl.fyi/c/depot/+/1240
Tested-by: BuildkiteCI
Reviewed-by: glittershark <grfn@gws.fyi>
Diffstat (limited to 'third_party/nix/src/CMakeLists.txt')
-rw-r--r--third_party/nix/src/CMakeLists.txt4
1 files changed, 4 insertions, 0 deletions
diff --git a/third_party/nix/src/CMakeLists.txt b/third_party/nix/src/CMakeLists.txt
index 05386fa2dd..3775333ee3 100644
--- a/third_party/nix/src/CMakeLists.txt
+++ b/third_party/nix/src/CMakeLists.txt
@@ -11,6 +11,10 @@ add_subdirectory(libstore)
 add_subdirectory(libmain)
 add_subdirectory(libexpr)
 
+if (PACKAGE_TESTS)
+  add_subdirectory(tests)
+endif()
+
 add_executable(nix)
 set_property(TARGET nix PROPERTY CXX_STANDARD 17)
 include_directories(${PROJECT_BINARY_DIR})