From 76322bff6b4de1c0fe810506f451de733c60683a Mon Sep 17 00:00:00 2001
From: Eric Bavier
Date: Fri, 15 Jan 2016 14:46:26 -0600
Subject: [PATCH] gnu: boost: Enable tests.
* gnu/packages/boost.scm (boost)[arguments]: Replace 'check' phase.
---
gnu/packages/boost.scm | 122 ++++++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 121 insertions(+), 1 deletion(-)
diff --git a/gnu/packages/boost.scm b/gnu/packages/boost.scm
index 0a644e8..a69ebc2 100644
--- a/gnu/packages/boost.scm
+++ b/gnu/packages/boost.scm
@@ -66,7 +66,11 @@
'("--without-context"
"--without-coroutine" "--without-coroutine2")
'()))))
- `(#:tests? #f
+ `(#:modules ((ice-9 rdelim)
+ (ice-9 regex)
+ (srfi srfi-1)
+ (guix build gnu-build-system)
+ (guix build utils))
#:phases
(modify-phases %standard-phases
(replace
@@ -92,6 +96,122 @@
(lambda* (#:key outputs #:allow-other-keys)
(zero? (system* "./b2" ,@build-flags))))
(replace
+ 'check
+ ;; The provided method for running all tests (executing b2 in the
+ ;; "status" directory) requires a large amount of disk space
+ ;; (>20G) because it does not clean up build artifacts after
+ ;; successfully running a test suite. So instead we run each test
+ ;; individually, which only requires ~7.7G.
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let ((b2 (string-append (getcwd) "/b2"))
+ (test-dirs
+ ;; The instructions at
+ ;; http://www.boost.org/development/running_regression_tests.html
+ ;; to run b2 in each libs//test is not entirely
+ ;; accurate. Some tests are in subdirectories and others
+ ;; in top-level directories. So instead we read the list
+ ;; of test directories from status/Jamfile.v2
+ (let ((port (open-input-file "status/Jamfile.v2"))
+ (start-rx (make-regexp "^run-tests libs :"))
+ (end-rx (make-regexp "^[[:space:]]*;"))
+ (dir-rx (make-regexp "^[[:space:]]*([a-z0-9/_]+)")))
+ (let loop ((collecting #f)
+ (dirs '()))
+ (let* ((line (read-line port))
+ (start (regexp-exec start-rx line))
+ (end (regexp-exec end-rx line)))
+ (cond
+ (start (loop #t dirs))
+ ((and collecting end)
+ (begin
+ (close-port port)
+ (reverse! dirs)))
+ (collecting
+ (loop #t (cons (match:substring
+ (regexp-exec dir-rx line)
+ 1)
+ dirs)))
+ (else (loop #f dirs)))))))
+ ;; Several libraries have known-failing test cases, so
+ ;; skip those.
+ (skip '(;; Some tests have not been updated for changes in
+ ;; Boost.Random,
+ ;; e.g. weighted_p_square_cumul_dist.cpp
+ "accumulators"
+ ;; Some tests fail with 'Network is unreachable'
+ "asio"
+ ;; ptr_list_inserter fails with 'check
+ ;; typeid(*--a_set.end()) == typeid(FooBar) has
+ ;; failed'
+ "assign"
+ ;; stl_concept_covering: error: no match for
+ ;; 'operator=='
+ "concept_check"
+ ;; bench_alloc.test: error: 'assert' was not
+ ;; declared in this scope.
+ "container/bench"
+ ;; Compilation failures: member_ccs,
+ ;; member_ccs_exact, nonmember_ccs,
+ ;; nonmember_ccs_exact.
+ "function_types"
+ ;; 10 compilation failures: adj_matrix_cc,
+ ;; adjacency_matrix_test,
+ ;; boykob_kolmahorov_max_flow_test,
+ ;; bundled_properties, csr_graph_test,
+ ;; cycle_ratio_tests, floy_warshall_test,
+ ;; matching_test, metric_tsp_approx, and
+ ;; test_graphs.
+ "graph"
+ ;; Compilation failure in concept_tests
+ "iterator"
+ ;; Compilation errors when boost is built with
+ ;; both shared and static libraries?
+ "lockfree"
+ ;; Loss of precision in test
+ ;; test_cpp_bin_float_io_1
+ "multiprecision"
+ ;; Compilation issues
+ "proto"
+ ;; error: 'BOOST_MESSAGE' was not declared in this
+ ;; scope.
+ "ptr_container"
+ ;; Compilation failures, e.g. voidptr - "error:
+ ;; no matching call to 'registry_lookup2'"
+ "python"
+ ;; error: expected initializer before ânamespaceâ
+ "rational"
+ ;; error "lambda functions required"
+ "scope_exit"
+ ;; Compilation failures: karma_repo_subrule and
+ ;; qi_repo_subrule
+ "spirit/repository"
+ ;; error: inappropriate use of sizeof on
+ ;; incomplete type.
+ "statechart"
+ ;; fails Boost Inspection Report test
+ "timer"
+ ;; fail: run_random
+ "tr1"
+ ;; Executation fail: compressed_pair_test
+ "utility"
+ ;; Execution failures: "no variadic macro support
+ ;; in function ..."
+ "vmd"
+ ;; testwave test t_9_024.cpp fails
+ "wave")))
+ (every ;stop immediately if any test fails
+ (lambda (dir)
+ (with-directory-excursion (string-append "libs/" dir)
+ (and (zero? (system* b2 ,@build-flags)) ;run tests
+ ;; Clean each test directory after successful run in
+ ;; order to minimize disk space requirements.
+ (zero? (system* b2 ,@build-flags "clean")))))
+ (remove (lambda (d)
+ (any (lambda (s)
+ (string-prefix? s d))
+ skip))
+ test-dirs)))))
+ (replace
'install
(lambda* (#:key outputs #:allow-other-keys)
(zero? (system* "./b2" "install" ,@build-flags))))))))
--
2.5.0