mirror of
https://github.com/NixOS/nix.git
synced 2024-11-22 06:42:28 +00:00
Merge pull request #7901 from hercules-ci/disable-tests
Add ./configure --disable-tests option
This commit is contained in:
commit
96111ad902
19
Makefile
19
Makefile
@ -2,13 +2,10 @@ makefiles = \
|
|||||||
mk/precompiled-headers.mk \
|
mk/precompiled-headers.mk \
|
||||||
local.mk \
|
local.mk \
|
||||||
src/libutil/local.mk \
|
src/libutil/local.mk \
|
||||||
src/libutil/tests/local.mk \
|
|
||||||
src/libstore/local.mk \
|
src/libstore/local.mk \
|
||||||
src/libstore/tests/local.mk \
|
|
||||||
src/libfetchers/local.mk \
|
src/libfetchers/local.mk \
|
||||||
src/libmain/local.mk \
|
src/libmain/local.mk \
|
||||||
src/libexpr/local.mk \
|
src/libexpr/local.mk \
|
||||||
src/libexpr/tests/local.mk \
|
|
||||||
src/libcmd/local.mk \
|
src/libcmd/local.mk \
|
||||||
src/nix/local.mk \
|
src/nix/local.mk \
|
||||||
src/resolve-system-dependencies/local.mk \
|
src/resolve-system-dependencies/local.mk \
|
||||||
@ -19,12 +16,22 @@ makefiles = \
|
|||||||
misc/systemd/local.mk \
|
misc/systemd/local.mk \
|
||||||
misc/launchd/local.mk \
|
misc/launchd/local.mk \
|
||||||
misc/upstart/local.mk \
|
misc/upstart/local.mk \
|
||||||
doc/manual/local.mk \
|
doc/manual/local.mk
|
||||||
tests/local.mk \
|
|
||||||
tests/plugins/local.mk
|
|
||||||
|
|
||||||
-include Makefile.config
|
-include Makefile.config
|
||||||
|
|
||||||
|
ifeq ($(tests), yes)
|
||||||
|
makefiles += \
|
||||||
|
src/libutil/tests/local.mk \
|
||||||
|
src/libstore/tests/local.mk \
|
||||||
|
src/libexpr/tests/local.mk \
|
||||||
|
tests/local.mk \
|
||||||
|
tests/plugins/local.mk
|
||||||
|
else
|
||||||
|
makefiles += \
|
||||||
|
mk/disable-tests.mk
|
||||||
|
endif
|
||||||
|
|
||||||
OPTIMIZE = 1
|
OPTIMIZE = 1
|
||||||
|
|
||||||
ifeq ($(OPTIMIZE), 1)
|
ifeq ($(OPTIMIZE), 1)
|
||||||
|
@ -45,3 +45,4 @@ sandbox_shell = @sandbox_shell@
|
|||||||
storedir = @storedir@
|
storedir = @storedir@
|
||||||
sysconfdir = @sysconfdir@
|
sysconfdir = @sysconfdir@
|
||||||
system = @system@
|
system = @system@
|
||||||
|
tests = @tests@
|
||||||
|
10
configure.ac
10
configure.ac
@ -145,6 +145,13 @@ if test "x$GCC_ATOMIC_BUILTINS_NEED_LIBATOMIC" = xyes; then
|
|||||||
LDFLAGS="-latomic $LDFLAGS"
|
LDFLAGS="-latomic $LDFLAGS"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Building without tests is useful for bootstrapping with a smaller footprint
|
||||||
|
# or running the tests in a separate derivation. Otherwise, we do compile and
|
||||||
|
# run them.
|
||||||
|
AC_ARG_ENABLE(tests, AS_HELP_STRING([--disable-tests],[Do not build the tests]),
|
||||||
|
tests=$enableval, tests=yes)
|
||||||
|
AC_SUBST(tests)
|
||||||
|
|
||||||
# LTO is currently broken with clang for unknown reasons; ld segfaults in the llvm plugin
|
# LTO is currently broken with clang for unknown reasons; ld segfaults in the llvm plugin
|
||||||
AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto],[Enable LTO (only supported with GCC) [default=no]]),
|
AC_ARG_ENABLE(lto, AS_HELP_STRING([--enable-lto],[Enable LTO (only supported with GCC) [default=no]]),
|
||||||
lto=$enableval, lto=no)
|
lto=$enableval, lto=no)
|
||||||
@ -270,6 +277,8 @@ if test "$gc" = yes; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
if test "$tests" = yes; then
|
||||||
|
|
||||||
# Look for gtest.
|
# Look for gtest.
|
||||||
PKG_CHECK_MODULES([GTEST], [gtest_main])
|
PKG_CHECK_MODULES([GTEST], [gtest_main])
|
||||||
|
|
||||||
@ -282,6 +291,7 @@ dnl No good for C++ libs with mangled symbols
|
|||||||
dnl AC_CHECK_LIB([rapidcheck], [])
|
dnl AC_CHECK_LIB([rapidcheck], [])
|
||||||
AC_LANG_POP(C++)
|
AC_LANG_POP(C++)
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
# Look for nlohmann/json.
|
# Look for nlohmann/json.
|
||||||
PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])
|
PKG_CHECK_MODULES([NLOHMANN_JSON], [nlohmann_json >= 3.9])
|
||||||
|
@ -71,3 +71,8 @@
|
|||||||
<http://libcpuid.sourceforge.net>.
|
<http://libcpuid.sourceforge.net>.
|
||||||
This is an optional dependency and can be disabled
|
This is an optional dependency and can be disabled
|
||||||
by providing a `--disable-cpuid` to the `configure` script.
|
by providing a `--disable-cpuid` to the `configure` script.
|
||||||
|
|
||||||
|
- Unless `./configure --disable-tests` is specified, GoogleTest (GTest) and
|
||||||
|
RapidCheck are required, which are available at
|
||||||
|
<https://google.github.io/googletest/> and
|
||||||
|
<https://github.com/emil-e/rapidcheck> respectively.
|
||||||
|
37
flake.nix
37
flake.nix
@ -89,15 +89,16 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
configureFlags =
|
configureFlags =
|
||||||
[
|
lib.optionals stdenv.isLinux [
|
||||||
"CXXFLAGS=-I${lib.getDev rapidcheck}/extras/gtest/include"
|
|
||||||
] ++ lib.optionals stdenv.isLinux [
|
|
||||||
"--with-boost=${boost}/lib"
|
"--with-boost=${boost}/lib"
|
||||||
"--with-sandbox-shell=${sh}/bin/busybox"
|
"--with-sandbox-shell=${sh}/bin/busybox"
|
||||||
]
|
]
|
||||||
++ lib.optionals (stdenv.isLinux && !(isStatic && stdenv.system == "aarch64-linux")) [
|
++ lib.optionals (stdenv.isLinux && !(isStatic && stdenv.system == "aarch64-linux")) [
|
||||||
"LDFLAGS=-fuse-ld=gold"
|
"LDFLAGS=-fuse-ld=gold"
|
||||||
];
|
];
|
||||||
|
testConfigureFlags = [
|
||||||
|
"CXXFLAGS=-I${lib.getDev rapidcheck}/extras/gtest/include"
|
||||||
|
];
|
||||||
|
|
||||||
nativeBuildDeps =
|
nativeBuildDeps =
|
||||||
[
|
[
|
||||||
@ -124,13 +125,16 @@
|
|||||||
libarchive
|
libarchive
|
||||||
boost
|
boost
|
||||||
lowdown-nix
|
lowdown-nix
|
||||||
gtest
|
|
||||||
rapidcheck
|
|
||||||
]
|
]
|
||||||
++ lib.optionals stdenv.isLinux [libseccomp]
|
++ lib.optionals stdenv.isLinux [libseccomp]
|
||||||
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
|
++ lib.optional (stdenv.isLinux || stdenv.isDarwin) libsodium
|
||||||
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid;
|
++ lib.optional stdenv.hostPlatform.isx86_64 libcpuid;
|
||||||
|
|
||||||
|
checkDeps = [
|
||||||
|
gtest
|
||||||
|
rapidcheck
|
||||||
|
];
|
||||||
|
|
||||||
awsDeps = lib.optional (stdenv.isLinux || stdenv.isDarwin)
|
awsDeps = lib.optional (stdenv.isLinux || stdenv.isDarwin)
|
||||||
(aws-sdk-cpp.override {
|
(aws-sdk-cpp.override {
|
||||||
apis = ["s3" "transfer"];
|
apis = ["s3" "transfer"];
|
||||||
@ -200,7 +204,7 @@
|
|||||||
VERSION_SUFFIX = versionSuffix;
|
VERSION_SUFFIX = versionSuffix;
|
||||||
|
|
||||||
nativeBuildInputs = nativeBuildDeps;
|
nativeBuildInputs = nativeBuildDeps;
|
||||||
buildInputs = buildDeps ++ awsDeps;
|
buildInputs = buildDeps ++ awsDeps ++ checkDeps;
|
||||||
propagatedBuildInputs = propagatedDeps;
|
propagatedBuildInputs = propagatedDeps;
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
@ -305,7 +309,7 @@
|
|||||||
};
|
};
|
||||||
let
|
let
|
||||||
canRunInstalled = currentStdenv.buildPlatform.canExecute currentStdenv.hostPlatform;
|
canRunInstalled = currentStdenv.buildPlatform.canExecute currentStdenv.hostPlatform;
|
||||||
in currentStdenv.mkDerivation {
|
in currentStdenv.mkDerivation (finalAttrs: {
|
||||||
name = "nix-${version}";
|
name = "nix-${version}";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
@ -318,7 +322,8 @@
|
|||||||
nativeBuildInputs = nativeBuildDeps;
|
nativeBuildInputs = nativeBuildDeps;
|
||||||
buildInputs = buildDeps
|
buildInputs = buildDeps
|
||||||
# There have been issues building these dependencies
|
# There have been issues building these dependencies
|
||||||
++ lib.optionals (currentStdenv.hostPlatform == currentStdenv.buildPlatform) awsDeps;
|
++ lib.optionals (currentStdenv.hostPlatform == currentStdenv.buildPlatform) awsDeps
|
||||||
|
++ lib.optionals finalAttrs.doCheck checkDeps;
|
||||||
|
|
||||||
propagatedBuildInputs = propagatedDeps;
|
propagatedBuildInputs = propagatedDeps;
|
||||||
|
|
||||||
@ -348,6 +353,8 @@
|
|||||||
configureFlags = configureFlags ++
|
configureFlags = configureFlags ++
|
||||||
[ "--sysconfdir=/etc" ] ++
|
[ "--sysconfdir=/etc" ] ++
|
||||||
lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell" ++
|
lib.optional stdenv.hostPlatform.isStatic "--enable-embedded-sandbox-shell" ++
|
||||||
|
[ (lib.enableFeature finalAttrs.doCheck "tests") ] ++
|
||||||
|
lib.optionals finalAttrs.doCheck testConfigureFlags ++
|
||||||
lib.optional (!canRunInstalled) "--disable-doc-gen";
|
lib.optional (!canRunInstalled) "--disable-doc-gen";
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
enableParallelBuilding = true;
|
||||||
@ -369,7 +376,7 @@
|
|||||||
''}
|
''}
|
||||||
'';
|
'';
|
||||||
|
|
||||||
doInstallCheck = true;
|
doInstallCheck = finalAttrs.doCheck;
|
||||||
installCheckFlags = "sysconfdir=$(out)/etc";
|
installCheckFlags = "sysconfdir=$(out)/etc";
|
||||||
|
|
||||||
separateDebugInfo = !currentStdenv.hostPlatform.isStatic;
|
separateDebugInfo = !currentStdenv.hostPlatform.isStatic;
|
||||||
@ -411,7 +418,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
meta.platforms = lib.platforms.unix;
|
meta.platforms = lib.platforms.unix;
|
||||||
};
|
});
|
||||||
|
|
||||||
lowdown-nix = with final; currentStdenv.mkDerivation rec {
|
lowdown-nix = with final; currentStdenv.mkDerivation rec {
|
||||||
name = "lowdown-0.9.0";
|
name = "lowdown-0.9.0";
|
||||||
@ -462,6 +469,14 @@
|
|||||||
|
|
||||||
buildNoGc = forAllSystems (system: self.packages.${system}.nix.overrideAttrs (a: { configureFlags = (a.configureFlags or []) ++ ["--enable-gc=no"];}));
|
buildNoGc = forAllSystems (system: self.packages.${system}.nix.overrideAttrs (a: { configureFlags = (a.configureFlags or []) ++ ["--enable-gc=no"];}));
|
||||||
|
|
||||||
|
buildNoTests = forAllSystems (system:
|
||||||
|
self.packages.${system}.nix.overrideAttrs (a: {
|
||||||
|
doCheck =
|
||||||
|
assert ! a?dontCheck;
|
||||||
|
false;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
# Perl bindings for various platforms.
|
# Perl bindings for various platforms.
|
||||||
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nix.perl-bindings);
|
perlBindings = forAllSystems (system: nixpkgsFor.${system}.native.nix.perl-bindings);
|
||||||
|
|
||||||
@ -634,7 +649,7 @@
|
|||||||
nativeBuildInputs = nativeBuildDeps
|
nativeBuildInputs = nativeBuildDeps
|
||||||
++ (lib.optionals stdenv.cc.isClang [ pkgs.bear pkgs.clang-tools ]);
|
++ (lib.optionals stdenv.cc.isClang [ pkgs.bear pkgs.clang-tools ]);
|
||||||
|
|
||||||
buildInputs = buildDeps ++ propagatedDeps ++ awsDeps;
|
buildInputs = buildDeps ++ propagatedDeps ++ awsDeps ++ checkDeps;
|
||||||
|
|
||||||
inherit configureFlags;
|
inherit configureFlags;
|
||||||
|
|
||||||
|
12
mk/disable-tests.mk
Normal file
12
mk/disable-tests.mk
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
# This file is only active for `./configure --disable-tests`.
|
||||||
|
# Running `make check` or `make installcheck` would indicate a mistake in the
|
||||||
|
# caller.
|
||||||
|
|
||||||
|
installcheck:
|
||||||
|
@echo "Tests are disabled. Configure without '--disable-tests', or avoid calling 'make installcheck'."
|
||||||
|
@exit 1
|
||||||
|
|
||||||
|
# This currently has little effect.
|
||||||
|
check:
|
||||||
|
@echo "Tests are disabled. Configure without '--disable-tests', or avoid calling 'make check'."
|
||||||
|
@exit 1
|
Loading…
Reference in New Issue
Block a user