From bb251307642242bb9174e9c4d89909ca40926d67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Tue, 12 Jan 2016 16:37:45 +0100 Subject: [PATCH] build: 'make check' errors out if file name limits would be hit. * Makefile.am (SCM_TESTS, SH_TESTS, TESTS, AM_TESTS_ENVIRONMENT) (SCM_LOG_COMPILER, SH_LOG_COMPILER, AM_SCM_LOG_FLAGS) (AM_SH_LOG_FLAGS): Move within 'if CAN_RUN_TESTS'. (check-local) [!CAN_RUN_TESTS]: New target. * daemon.am (AM_TESTS_ENVIRONMENT, TESTS): Ditto. * m4/guix.m4 (GUIX_CHECK_FILE_NAME_LIMITS): Add parameter and set it. --- Makefile.am | 45 ++++++++++++++++++++++++++++++++++----------- configure.ac | 3 ++- daemon.am | 6 +++++- m4/guix.m4 | 7 ++++++- 4 files changed, 47 insertions(+), 14 deletions(-) diff --git a/Makefile.am b/Makefile.am index 760caed859..6e9deeb3d8 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès # Copyright © 2013 Andreas Enge # Copyright © 2015 Alex Kost # @@ -135,6 +135,18 @@ MODULES = \ guix.scm \ $(GNU_SYSTEM_MODULES) +if HAVE_GUILE_JSON + +MODULES += \ + guix/import/json.scm \ + guix/import/pypi.scm \ + guix/scripts/import/pypi.scm \ + guix/import/cpan.scm \ + guix/scripts/import/gem.scm \ + guix/import/gem.scm + +endif + if BUILD_SYSCALLS_MODULE MODULES += \ @@ -191,6 +203,11 @@ clean-go: -$(RM) -f $(GOBJECTS) +# Test extensions; has to be unconditional. +TEST_EXTENSIONS = .scm .sh + +if CAN_RUN_TESTS + SCM_TESTS = \ tests/base32.scm \ tests/base64.scm \ @@ -233,14 +250,6 @@ SCM_TESTS = \ if HAVE_GUILE_JSON -MODULES += \ - guix/import/json.scm \ - guix/import/pypi.scm \ - guix/scripts/import/pypi.scm \ - guix/import/cpan.scm \ - guix/scripts/import/gem.scm \ - guix/import/gem.scm - SCM_TESTS += \ tests/pypi.scm \ tests/cpan.scm \ @@ -272,8 +281,6 @@ endif BUILD_DAEMON TESTS = $(SCM_TESTS) $(SH_TESTS) -TEST_EXTENSIONS = .scm .sh - AM_TESTS_ENVIRONMENT = abs_top_srcdir="$(abs_top_srcdir)" SCM_LOG_COMPILER = $(top_builddir)/test-env $(GUILE) @@ -289,6 +296,22 @@ tests/guix-gc.log: \ $(patsubst %.sh,%.log,$(filter-out tests/guix-gc.sh,$(SH_TESTS))) \ $(SCM_TESTS:%.scm=%.log) +else !CAN_RUN_TESTS + +TESTS = +SH_TESTS = +SCM_TESTS = + +# Automake always generates a 'check' target, so better not override it. +check-local: + @echo + @echo "Cannot run tests because file name limits would be exceeded." >&2 + @echo "Look for 'length' in the 'config.log' file for details." >&2 + @echo + @exit 1 + +endif !CAN_RUN_TESTS + # Public key used to sign substitutes from hydra.gnu.org. dist_pkgdata_DATA = hydra.gnu.org.pub diff --git a/configure.ac b/configure.ac index 0d06592b53..f61c04cac8 100644 --- a/configure.ac +++ b/configure.ac @@ -60,7 +60,8 @@ AC_SUBST([guix_localstatedir]) AC_SUBST([guix_sysconfdir]) AC_SUBST([guix_sbindir]) -GUIX_CHECK_FILE_NAME_LIMITS +GUIX_CHECK_FILE_NAME_LIMITS([can_run_tests]) +AM_CONDITIONAL([CAN_RUN_TESTS], [test "x$can_run_tests" = "xyes"]) dnl We require pkg.m4 (from pkg-config) and guile.m4 (from Guile.) dnl Make sure they are available. diff --git a/daemon.am b/daemon.am index 324164359c..ba4be50068 100644 --- a/daemon.am +++ b/daemon.am @@ -1,5 +1,5 @@ # GNU Guix --- Functional package management for GNU -# Copyright © 2012, 2013, 2014, 2015 Ludovic Courtès +# Copyright © 2012, 2013, 2014, 2015, 2016 Ludovic Courtès # # This file is part of GNU Guix. # @@ -208,12 +208,16 @@ EXTRA_DIST += \ etc/guix-daemon.service.in \ etc/guix-daemon.conf.in +if CAN_RUN_TESTS + AM_TESTS_ENVIRONMENT += \ top_builddir="$(abs_top_builddir)" TESTS += \ tests/guix-daemon.sh +endif CAN_RUN_TESTS + clean-local: -if test -d "$(GUIX_TEST_ROOT)"; then \ find "$(GUIX_TEST_ROOT)" | xargs chmod +w; \ diff --git a/m4/guix.m4 b/m4/guix.m4 index 96319b2c14..563ce51699 100644 --- a/m4/guix.m4 +++ b/m4/guix.m4 @@ -215,7 +215,8 @@ AC_DEFUN([GUIX_TEST_HASH_BANG_LENGTH], [ dnl GUIX_CHECK_FILE_NAME_LIMITS dnl dnl GNU/Linux has a couple of silly limits that we can easily run into. -dnl Make sure everything is fine with the current settings. +dnl Make sure everything is fine with the current settings. Set $1 to +dnl 'yes' if tests can run, 'no' otherwise. AC_DEFUN([GUIX_CHECK_FILE_NAME_LIMITS], [ AC_REQUIRE([GUIX_SOCKET_FILE_NAME_LENGTH]) AC_REQUIRE([GUIX_TEST_SOCKET_FILE_NAME_LENGTH]) @@ -228,10 +229,14 @@ AC_DEFUN([GUIX_CHECK_FILE_NAME_LIMITS], [ if test "$ac_cv_guix_test_socket_file_name_length" -ge ]SOCKET_FILE_NAME_LIMIT[; then AC_MSG_WARN([socket file name limit may be exceeded when running tests]) fi + + $1=yes if test "$ac_cv_guix_hash_bang_length" -ge ]LINUX_HASH_BANG_LIMIT[; then + $1=no AC_MSG_ERROR([store directory '$storedir' would lead to overly long hash-bang lines]) fi if test "$ac_cv_guix_test_hash_bang_length" -ge ]LINUX_HASH_BANG_LIMIT[; then + $1=no AC_MSG_WARN([test directory '$ac_cv_guix_test_root' may lead to overly long hash-bang lines]) fi ])