mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-22 05:56:15 +02:00
Add support for ‘make installcheck’
This commit is contained in:
parent
9285f0aa2b
commit
0202ce6b94
11 changed files with 52 additions and 28 deletions
9
.gitignore
vendored
9
.gitignore
vendored
|
@ -85,10 +85,6 @@ Makefile.config
|
||||||
|
|
||||||
# /src/nix-log2xml/
|
# /src/nix-log2xml/
|
||||||
/src/nix-log2xml/nix-log2xml
|
/src/nix-log2xml/nix-log2xml
|
||||||
/src/nix-log2xml/test*.*
|
|
||||||
/src/nix-log2xml/*.log
|
|
||||||
/src/nix-log2xml/*.xml
|
|
||||||
/src/nix-log2xml/*.html
|
|
||||||
|
|
||||||
# /src/nix-store/
|
# /src/nix-store/
|
||||||
/src/nix-store/nix-store
|
/src/nix-store/nix-store
|
||||||
|
@ -98,7 +94,6 @@ Makefile.config
|
||||||
|
|
||||||
# /tests/
|
# /tests/
|
||||||
/tests/test-tmp
|
/tests/test-tmp
|
||||||
/tests/config.nix
|
|
||||||
/tests/common.sh
|
/tests/common.sh
|
||||||
/tests/dummy
|
/tests/dummy
|
||||||
/tests/result*
|
/tests/result*
|
||||||
|
@ -111,11 +106,7 @@ Makefile.config
|
||||||
/perl/lib/Nix/Config.pm
|
/perl/lib/Nix/Config.pm
|
||||||
/perl/lib/Nix/Store.cc
|
/perl/lib/Nix/Store.cc
|
||||||
|
|
||||||
.deps
|
|
||||||
.libs
|
|
||||||
*.a
|
*.a
|
||||||
*.lo
|
|
||||||
*.la
|
|
||||||
*.o
|
*.o
|
||||||
*.so
|
*.so
|
||||||
*.dep
|
*.dep
|
||||||
|
|
3
Makefile
3
Makefile
|
@ -13,7 +13,8 @@ SUBS = \
|
||||||
src/bsdiff-4.3/Makefile \
|
src/bsdiff-4.3/Makefile \
|
||||||
perl/Makefile \
|
perl/Makefile \
|
||||||
scripts/Makefile \
|
scripts/Makefile \
|
||||||
corepkgs/Makefile
|
corepkgs/Makefile \
|
||||||
|
tests/Makefile
|
||||||
|
|
||||||
GLOBAL_CXXFLAGS = -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr
|
GLOBAL_CXXFLAGS = -I . -I src -I src/libutil -I src/libstore -I src/libmain -I src/libexpr
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
BDW_GC_LIBS = @BDW_GC_LIBS@
|
BDW_GC_LIBS = @BDW_GC_LIBS@
|
||||||
BUILD_DEBUG = 1
|
|
||||||
CC = @CC@
|
CC = @CC@
|
||||||
CFLAGS = @CFLAGS@
|
CFLAGS = @CFLAGS@
|
||||||
CXX = @CXX@
|
CXX = @CXX@
|
||||||
|
@ -8,6 +7,7 @@ HAVE_OPENSSL = @HAVE_OPENSSL@
|
||||||
OPENSSL_LIBS = @OPENSSL_LIBS@
|
OPENSSL_LIBS = @OPENSSL_LIBS@
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
PACKAGE_NAME = @PACKAGE_NAME@
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
PACKAGE_VERSION = @PACKAGE_VERSION@
|
||||||
|
bash = @bash@
|
||||||
bindir = @bindir@
|
bindir = @bindir@
|
||||||
bsddiff_compat_include = @bsddiff_compat_include@
|
bsddiff_compat_include = @bsddiff_compat_include@
|
||||||
datadir = @datadir@
|
datadir = @datadir@
|
||||||
|
|
|
@ -4,7 +4,7 @@ let
|
||||||
if val != "" then val else def;
|
if val != "" then val else def;
|
||||||
in {
|
in {
|
||||||
perl = "@perl@";
|
perl = "@perl@";
|
||||||
shell = "@shell@";
|
shell = "@bash@";
|
||||||
coreutils = "@coreutils@";
|
coreutils = "@coreutils@";
|
||||||
bzip2 = "@bzip2@";
|
bzip2 = "@bzip2@";
|
||||||
gzip = "@gzip@";
|
gzip = "@gzip@";
|
||||||
|
|
|
@ -17,6 +17,8 @@ noinst_SCRIPTS :=
|
||||||
|
|
||||||
|
|
||||||
# Pass -fPIC if we're building dynamic libraries.
|
# Pass -fPIC if we're building dynamic libraries.
|
||||||
|
BUILD_SHARED_LIBS = 1
|
||||||
|
|
||||||
ifeq ($(BUILD_SHARED_LIBS), 1)
|
ifeq ($(BUILD_SHARED_LIBS), 1)
|
||||||
GLOBAL_CFLAGS += -fPIC
|
GLOBAL_CFLAGS += -fPIC
|
||||||
GLOBAL_CXXFLAGS += -fPIC
|
GLOBAL_CXXFLAGS += -fPIC
|
||||||
|
@ -25,6 +27,8 @@ endif
|
||||||
|
|
||||||
|
|
||||||
# Pass -g if we want debug info.
|
# Pass -g if we want debug info.
|
||||||
|
BUILD_DEBUG = 1
|
||||||
|
|
||||||
ifeq ($(BUILD_DEBUG), 1)
|
ifeq ($(BUILD_DEBUG), 1)
|
||||||
GLOBAL_CFLAGS += -g
|
GLOBAL_CFLAGS += -g
|
||||||
GLOBAL_CXXFLAGS += -g
|
GLOBAL_CXXFLAGS += -g
|
||||||
|
@ -38,6 +42,7 @@ include mk/libraries.mk
|
||||||
include mk/programs.mk
|
include mk/programs.mk
|
||||||
include mk/patterns.mk
|
include mk/patterns.mk
|
||||||
include mk/templates.mk
|
include mk/templates.mk
|
||||||
|
include mk/tests.mk
|
||||||
|
|
||||||
|
|
||||||
# Include all sub-Makefiles.
|
# Include all sub-Makefiles.
|
||||||
|
@ -56,6 +61,7 @@ $(foreach script, $(bin_SCRIPTS), $(eval $(call install-program-in,$(script),$(b
|
||||||
$(foreach script, $(bin_SCRIPTS), $(eval programs_list += $(script)))
|
$(foreach script, $(bin_SCRIPTS), $(eval programs_list += $(script)))
|
||||||
$(foreach script, $(noinst_SCRIPTS), $(eval programs_list += $(script)))
|
$(foreach script, $(noinst_SCRIPTS), $(eval programs_list += $(script)))
|
||||||
$(foreach template, $(template_files), $(eval $(call instantiate-template,$(template))))
|
$(foreach template, $(template_files), $(eval $(call instantiate-template,$(template))))
|
||||||
|
$(foreach test, $(INSTALL_TESTS), $(eval $(call run-install-test,$(test))))
|
||||||
|
|
||||||
|
|
||||||
all: $(programs_list) $(libs_list)
|
all: $(programs_list) $(libs_list)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
#! @shell@
|
#! @bash@
|
||||||
|
|
||||||
WORKING_DIRECTORY=$(mktemp -d "${TMPDIR:-/tmp}"/nix-reduce-build-XXXXXX);
|
WORKING_DIRECTORY=$(mktemp -d "${TMPDIR:-/tmp}"/nix-reduce-build-XXXXXX);
|
||||||
cd "$WORKING_DIRECTORY";
|
cd "$WORKING_DIRECTORY";
|
||||||
|
|
|
@ -3,3 +3,6 @@ PROGRAMS += nix-log2xml
|
||||||
nix-log2xml_DIR := $(d)
|
nix-log2xml_DIR := $(d)
|
||||||
|
|
||||||
nix-log2xml_SOURCES = log2xml.cc
|
nix-log2xml_SOURCES = log2xml.cc
|
||||||
|
|
||||||
|
$(foreach file, mark-errors.xsl log2html.xsl treebits.js, \
|
||||||
|
$(eval $(call install-data-in, $(d)/$(file), $(datadir)/nix/log2html)))
|
||||||
|
|
21
tests/Makefile
Normal file
21
tests/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
check:
|
||||||
|
@echo "Warning: Nix has no 'make check'. Please install Nix and run 'make installcheck' instead."
|
||||||
|
|
||||||
|
nix_tests = \
|
||||||
|
init.sh hash.sh lang.sh add.sh simple.sh dependencies.sh \
|
||||||
|
parallel.sh build-hook.sh substitutes.sh substitutes2.sh \
|
||||||
|
fallback.sh nix-push.sh gc.sh gc-concurrent.sh verify.sh nix-pull.sh \
|
||||||
|
referrers.sh user-envs.sh logging.sh nix-build.sh misc.sh fixed.sh \
|
||||||
|
gc-runtime.sh install-package.sh check-refs.sh filter-source.sh \
|
||||||
|
remote-store.sh export.sh export-graph.sh negative-caching.sh \
|
||||||
|
binary-patching.sh timeout.sh secure-drv-outputs.sh nix-channel.sh \
|
||||||
|
multiple-outputs.sh import-derivation.sh fetchurl.sh optimise-store.sh \
|
||||||
|
binary-cache.sh nix-profile.sh
|
||||||
|
|
||||||
|
INSTALL_TESTS += $(foreach x, $(nix_tests), tests/$(x))
|
||||||
|
|
||||||
|
TESTS_ENVIRONMENT = NIX_REMOTE= $(bash) -e
|
||||||
|
|
||||||
|
clean_files += $(d)/common.sh
|
||||||
|
|
||||||
|
installcheck: $(d)/common.sh
|
|
@ -1,7 +1,7 @@
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
datadir="@datadir@"
|
datadir="@datadir@"
|
||||||
profiledir="@profiledir@"
|
profiledir="@sysconfdir@/profile.d"
|
||||||
|
|
||||||
export TEST_ROOT=$(pwd)/test-tmp
|
export TEST_ROOT=$(pwd)/test-tmp
|
||||||
export NIX_STORE_DIR
|
export NIX_STORE_DIR
|
||||||
|
@ -16,7 +16,7 @@ export NIX_STATE_DIR=$TEST_ROOT/var/nix
|
||||||
export NIX_DB_DIR=$TEST_ROOT/db
|
export NIX_DB_DIR=$TEST_ROOT/db
|
||||||
export NIX_CONF_DIR=$TEST_ROOT/etc
|
export NIX_CONF_DIR=$TEST_ROOT/etc
|
||||||
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
|
export NIX_MANIFESTS_DIR=$TEST_ROOT/var/nix/manifests
|
||||||
export SHARED=$TEST_ROOT/shared
|
export _NIX_TEST_SHARED=$TEST_ROOT/shared
|
||||||
export NIX_REMOTE=$NIX_REMOTE_
|
export NIX_REMOTE=$NIX_REMOTE_
|
||||||
|
|
||||||
export PATH=@bindir@:$PATH
|
export PATH=@bindir@:$PATH
|
||||||
|
@ -26,9 +26,9 @@ export dot=@dot@
|
||||||
export xmllint="@xmllint@"
|
export xmllint="@xmllint@"
|
||||||
export xmlflags="@xmlflags@"
|
export xmlflags="@xmlflags@"
|
||||||
export xsltproc="@xsltproc@"
|
export xsltproc="@xsltproc@"
|
||||||
export SHELL="@shell@"
|
export SHELL="@bash@"
|
||||||
|
|
||||||
export version=@version@
|
export version=@PACKAGE_VERSION@
|
||||||
export system=@system@
|
export system=@system@
|
||||||
|
|
||||||
readLink() {
|
readLink() {
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
|
with import <nix/config.nix>;
|
||||||
|
|
||||||
rec {
|
rec {
|
||||||
shell = "@shell@";
|
inherit shell;
|
||||||
|
|
||||||
path = "@testPath@";
|
path = coreutils;
|
||||||
|
|
||||||
system = "@system@";
|
system = builtins.currentSystem;
|
||||||
|
|
||||||
|
shared = builtins.getEnv "_NIX_TEST_SHARED";
|
||||||
|
|
||||||
shared = "@extra1@";
|
|
||||||
|
|
||||||
mkDerivation = args:
|
mkDerivation = args:
|
||||||
derivation ({
|
derivation ({
|
||||||
inherit system;
|
inherit system;
|
|
@ -6,7 +6,7 @@ echo "testing nix-build -j..."
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
rm -f $SHARED.cur $SHARED.max
|
rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max
|
||||||
|
|
||||||
outPath=$(nix-build -j10000 parallel.nix --no-out-link)
|
outPath=$(nix-build -j10000 parallel.nix --no-out-link)
|
||||||
|
|
||||||
|
@ -15,8 +15,8 @@ echo "output path is $outPath"
|
||||||
text=$(cat "$outPath")
|
text=$(cat "$outPath")
|
||||||
if test "$text" != "abacade"; then exit 1; fi
|
if test "$text" != "abacade"; then exit 1; fi
|
||||||
|
|
||||||
if test "$(cat $SHARED.cur)" != 0; then fail "wrong current process count"; fi
|
if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi
|
||||||
if test "$(cat $SHARED.max)" != 3; then fail "not enough parallelism"; fi
|
if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi
|
||||||
|
|
||||||
|
|
||||||
# Second, test that parallel invocations of nix-build perform builds
|
# Second, test that parallel invocations of nix-build perform builds
|
||||||
|
@ -25,7 +25,7 @@ echo "testing multiple nix-build -j1..."
|
||||||
|
|
||||||
clearStore
|
clearStore
|
||||||
|
|
||||||
rm -f $SHARED.cur $SHARED.max
|
rm -f $_NIX_TEST_SHARED.cur $_NIX_TEST_SHARED.max
|
||||||
|
|
||||||
drvPath=$(nix-instantiate parallel.nix --argstr sleepTime 15)
|
drvPath=$(nix-instantiate parallel.nix --argstr sleepTime 15)
|
||||||
|
|
||||||
|
@ -52,5 +52,5 @@ wait $pid2 || fail "instance 2 failed: $?"
|
||||||
wait $pid3 || fail "instance 3 failed: $?"
|
wait $pid3 || fail "instance 3 failed: $?"
|
||||||
wait $pid4 || fail "instance 4 failed: $?"
|
wait $pid4 || fail "instance 4 failed: $?"
|
||||||
|
|
||||||
if test "$(cat $SHARED.cur)" != 0; then fail "wrong current process count"; fi
|
if test "$(cat $_NIX_TEST_SHARED.cur)" != 0; then fail "wrong current process count"; fi
|
||||||
if test "$(cat $SHARED.max)" != 3; then fail "not enough parallelism"; fi
|
if test "$(cat $_NIX_TEST_SHARED.max)" != 3; then fail "not enough parallelism"; fi
|
||||||
|
|
Loading…
Reference in a new issue