From c1389c4f36dc7d71ac441114976c2267d76afdab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Thu, 13 Mar 2008 14:18:29 +0000 Subject: [PATCH] Guile: Run the test suite. Warning: This makes `nix-worker' hang at the very end of the process, once "make install" has completed and all installed files have been scanned for references. svn path=/nixpkgs/trunk/; revision=11099 --- .../interpreters/guile/default.nix | 7 +- .../interpreters/guile/test-tmpdir.patch | 148 ++++++++++++++++++ pkgs/top-level/all-packages.nix | 2 +- 3 files changed, 155 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/interpreters/guile/test-tmpdir.patch diff --git a/pkgs/development/interpreters/guile/default.nix b/pkgs/development/interpreters/guile/default.nix index 9aaa796d6b2e..10ef8f798422 100644 --- a/pkgs/development/interpreters/guile/default.nix +++ b/pkgs/development/interpreters/guile/default.nix @@ -1,4 +1,5 @@ -args: with args; +{ fetchurl, stdenv, libtool, readline, gmp +, gawk, makeWrapper }: stdenv.mkDerivation rec { name = "guile-1.8.4"; @@ -7,6 +8,8 @@ stdenv.mkDerivation rec { sha256 = "1cz1d4n6vzw0lfsvplsiarwqk675f12j596dzfv0h5r9cljpc0ya"; }; + patches = [ ./test-tmpdir.patch ]; + buildInputs = [ makeWrapper ]; propagatedBuildInputs = [readline libtool gmp gawk]; @@ -14,6 +17,8 @@ stdenv.mkDerivation rec { wrapProgram $out/bin/guile-snarf --prefix PATH : "${gawk}/bin" ''; + doCheck = true; + setupHook = ./setup-hook.sh; meta = { diff --git a/pkgs/development/interpreters/guile/test-tmpdir.patch b/pkgs/development/interpreters/guile/test-tmpdir.patch new file mode 100644 index 000000000000..0fbad9a862c9 --- /dev/null +++ b/pkgs/development/interpreters/guile/test-tmpdir.patch @@ -0,0 +1,148 @@ +--- guile/test-suite/standalone/test-unwind.c 2006-01-29 01:23:27.000000000 +0100 ++++ guile/test-suite/standalone/test-unwind.c 2008-03-13 14:11:20.000000000 +0100 +@@ -1,8 +1,55 @@ ++/* Copyright (C) 2004, 2005, 2008 Free Software Foundation, Inc. ++ * ++ * This library is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU Lesser General Public ++ * License as published by the Free Software Foundation; either ++ * version 2.1 of the License, or (at your option) any later version. ++ * ++ * This library is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU ++ * Lesser General Public License for more details. ++ * ++ * You should have received a copy of the GNU Lesser General Public ++ * License along with this library; if not, write to the Free Software ++ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA ++ */ ++ ++#if HAVE_CONFIG_H ++# include ++#endif ++ ++/* This blob per the Autoconf manual (under "Particular Functions"), updated ++ to match that of Gnulib. */ ++#ifndef alloca ++# if HAVE_ALLOCA_H ++# include ++# elif defined __GNUC__ ++# define alloca __builtin_alloca ++# elif defined _AIX ++# define alloca __alloca ++# elif defined _MSC_VER ++# include ++# define alloca _alloca ++# else ++# include ++# ifdef __cplusplus ++extern "C" ++# endif ++void *alloca (size_t); ++# endif ++#endif ++ + #include + #include + #include + #include + ++#ifdef HAVE_STRING_H ++# include ++#endif ++ ++ + void set_flag (void *data); + void func1 (void); + void func2 (void); +@@ -170,7 +217,17 @@ delete_file (void *data) + void + check_ports () + { +- char filename[] = "/tmp/check-ports.XXXXXX"; ++#define FILENAME_TEMPLATE "/check-ports.XXXXXX" ++ char *filename; ++ const char *tmpdir = getenv ("TMPDIR"); ++ ++ if (tmpdir == NULL) ++ tmpdir = "/tmp"; ++ ++ filename = (char *) alloca (strlen (tmpdir) + ++ sizeof (FILENAME_TEMPLATE) + 1); ++ strcpy (filename, tmpdir); ++ strcat (filename, FILENAME_TEMPLATE); + + if (mktemp (filename) == NULL) + exit (1); +@@ -205,6 +262,7 @@ check_ports () + } + } + scm_dynwind_end (); ++#undef FILENAME_TEMPLATE + } + + void +--- guile/test-suite/tests/socket.test 2007-06-26 00:36:43.000000000 +0200 ++++ guile/test-suite/tests/socket.test 2008-03-13 14:44:29.000000000 +0100 +@@ -1,6 +1,6 @@ + ;;;; socket.test --- test socket functions -*- scheme -*- + ;;;; +-;;;; Copyright (C) 2004, 2005, 2006, 2007 Free Software Foundation, Inc. ++;;;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + ;;;; + ;;;; This library is free software; you can redistribute it and/or + ;;;; modify it under the terms of the GNU Lesser General Public +@@ -174,6 +174,15 @@ + ;;; AF_UNIX sockets and `make-socket-address' + ;;; + ++(define (temp-file-path) ++ ;; Return a temporary file path that honors `$TMPDIR', which `tmpnam' ++ ;; doesn't do. ++ (let ((dir (or (getenv "TMPDIR") "/tmp"))) ++ (string-append dir "/guile-test-socket-" ++ (number->string (current-time)) "-" ++ (number->string (random 100000))))) ++ ++ + (if (defined? 'AF_UNIX) + (with-test-prefix "AF_UNIX/SOCK_DGRAM" + +@@ -181,7 +190,7 @@ + + (let ((server-socket (socket AF_UNIX SOCK_DGRAM 0)) + (server-bound? #f) +- (path (tmpnam))) ++ (path (temp-file-path))) + + (pass-if "bind" + (catch 'system-error +@@ -196,7 +205,7 @@ + + (pass-if "bind/sockaddr" + (let* ((sock (socket AF_UNIX SOCK_STREAM 0)) +- (path (tmpnam)) ++ (path (temp-file-path)) + (sockaddr (make-socket-address AF_UNIX path))) + (catch 'system-error + (lambda () +@@ -233,7 +242,7 @@ + (server-bound? #f) + (server-listening? #f) + (server-pid #f) +- (path (tmpnam))) ++ (path (temp-file-path))) + + (pass-if "bind" + (catch 'system-error +@@ -248,7 +257,7 @@ + + (pass-if "bind/sockaddr" + (let* ((sock (socket AF_UNIX SOCK_STREAM 0)) +- (path (tmpnam)) ++ (path (temp-file-path)) + (sockaddr (make-socket-address AF_UNIX path))) + (catch 'system-error + (lambda () + diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index a455daba25c5..9d10dc1412e9 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -1634,7 +1634,7 @@ rec { }; guile = import ../development/interpreters/guile { - inherit fetchurl stdenv ncurses readline libtool gmp gawk makeWrapper; + inherit fetchurl stdenv readline libtool gmp gawk makeWrapper; }; kaffe = import ../development/interpreters/kaffe {