From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id +Ne7Hq3qVmL0swAAgWs5BA (envelope-from ) for ; Wed, 13 Apr 2022 17:22:21 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id EHKKG63qVmLIxAAAauVa8A (envelope-from ) for ; Wed, 13 Apr 2022 17:22:21 +0200 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 8EC2D1627C for ; Wed, 13 Apr 2022 17:22:20 +0200 (CEST) Received: from localhost ([::1]:36140 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1neep1-0005eh-OT for larch@yhetil.org; Wed, 13 Apr 2022 11:22:19 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:36286) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1neeok-0005ZO-TF for guix-patches@gnu.org; Wed, 13 Apr 2022 11:22:02 -0400 Received: from debbugs.gnu.org ([209.51.188.43]:59734) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1neeok-0006Rl-KS for guix-patches@gnu.org; Wed, 13 Apr 2022 11:22:02 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1neeok-0006Dt-Gg for guix-patches@gnu.org; Wed, 13 Apr 2022 11:22:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#54892] [PATCH] gnu: nomad-optimizer: Fix some tests. References: <20220412185712.67292-3-paul@apatience.com> In-Reply-To: <20220412185712.67292-3-paul@apatience.com> Resent-From: "Paul A. Patience" Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Wed, 13 Apr 2022 15:22:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 54892 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 54892@debbugs.gnu.org Cc: "Paul A. Patience" Received: via spool by 54892-submit@debbugs.gnu.org id=B54892.164986329023876 (code B ref 54892); Wed, 13 Apr 2022 15:22:02 +0000 Received: (at 54892) by debbugs.gnu.org; 13 Apr 2022 15:21:30 +0000 Received: from localhost ([127.0.0.1]:53631 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1neeoD-0006D1-KW for submit@debbugs.gnu.org; Wed, 13 Apr 2022 11:21:30 -0400 Received: from mail-4323.proton.ch ([185.70.43.23]:23855) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1neeoB-0006Cl-Jj for 54892@debbugs.gnu.org; Wed, 13 Apr 2022 11:21:29 -0400 Date: Wed, 13 Apr 2022 15:21:15 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=apatience.com; s=protonmail2; t=1649863279; bh=v8VARXaiSluwgufdgdWLGqRaVXSFtVBEDrD1HsoHDA4=; h=Date:To:From:Cc:Reply-To:Subject:Message-ID:From:To:Cc:Date: Subject:Reply-To:Feedback-ID:Message-ID; b=dVID/eZI1KNWojiQiI4rY9e9alHfX+tM/oBNeZ9FYnN1CA+zDkrHk9hPAyJxoOOtH JgHEkdjaDFlMqPmWxqqovXNzhbXB+aUpeErIP9/hRB4RWpgUcDbc/EN83xd6e1mb2+ RR3u5E97H/ipSQ0OkJx9pI15fH8VSsxaD9t8MipoRomyvKLl1Z/OYEjSKF/vSzFtyP rNbUR+0PEmz/YFMg/4xvivppJjPJVANwPTvJ1Lwihr0JWnpnIMa7UezpKb4cvkyqmP 9CQKSM8C1E5G+23QRC7CkiHc/bHHcVu6K/hqEFvsBLvME7IkSS1J2FgHelt0bdfl6k F2clqlOV0IE8Q== From: "Paul A. Patience" Message-ID: <20220413152104.126202-1-paul@apatience.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: "Paul A. Patience" Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: "Guix-patches" X-Migadu-Flow: FLOW_IN X-Migadu-To: larch@yhetil.org X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1649863341; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=v8VARXaiSluwgufdgdWLGqRaVXSFtVBEDrD1HsoHDA4=; b=KHHmA2rMxfJ2JEXg0G90W7lcnZXAdqAtJ6qTKLcAIPwAjZRDTF4Wn+xQeRbjyLQu7myCKo CkB70SS+4AOj71o1uFzqDNDd8nbm9wPvCAm78wOX/XAgugXYJM0nFHWj7fparT2aH6MS7X vBQ5TAn4Kh9+SLpjSublpaz8M+9qNCHbkaDG6IlmHATYeXeaxCxTBYThUYIQLFYgL4YUmx Jnm46os9AAy4T4LeJgRaXfytpibMdgi4S2Uis35GwfkHbETG4gH0LD6/GaziWqiC6/Rh1f M/V/jbnU3lfr3+OYlIBz21ve4aXl9AWPX8EItN65Zq/BX9Z9RsTuzGwW5fJ/2g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1649863341; a=rsa-sha256; cv=none; b=L+6tQJmhwZU+S1tKumDnzVLzrBPAbT0low1OO8TaFcVhX7LhgwDpWvA5HmCgZx+b4swsiC 9tTUqZC33MUf9u5rFXkGj0thempd3Qe6RP3ew/1n6RKgqQ69L1mIQFqowxfFE0vK1BdVgS eZqyBlD0x3iJjlSAPOYQPJ2IoMfxpKiJqbZEeobJtqLgghlN8CmXsoNqnsR9SWR+LMFhYC njPTb8AyROQpYt5+qwgI8dqZRMKaKZiSpnVK93vm/9feO96EwuY/mn6Fd/u/OsxPq3fckO aL+2rOWkc3TiwGJJG1Qq0z/ik0K6QJnAXLfJhHe8T1pOMQ2ni3ArEOj8PzlN/Q== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=apatience.com header.s=protonmail2 header.b="dVID/eZI"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: 1.95 Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=apatience.com header.s=protonmail2 header.b="dVID/eZI"; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 8EC2D1627C X-Spam-Score: 1.95 X-Migadu-Scanner: scn0.migadu.com X-TUID: PnLRIvTJ8rBb * gnu/packages/maths.scm (nomad-optimizer)[arguments]<#:phases> [fix-sources-for-tests]: Enable the pipefail option in the (generated) script that runs tests. Enable the basic batch example3 test. Fix the advanced library FixedVariable test (and seemingly the neighbor PSDMads test). Expand some comments. --- To be applied after the patch updating nomad-optimizer to 4.2.0. gnu/packages/maths.scm | 126 +++++++++++++++++++++++++++-------------- 1 file changed, 83 insertions(+), 43 deletions(-) diff --git a/gnu/packages/maths.scm b/gnu/packages/maths.scm index 8ebfb87480..a18f656e0e 100644 --- a/gnu/packages/maths.scm +++ b/gnu/packages/maths.scm @@ -2001,8 +2001,27 @@ (define-public nomad-optimizer ""))))) ;; Fix the tests so they run in out-of-source builds. + ;; + ;; TODO: Add support for examples/basic/batch/single_obj_MPIparal= lel, + ;; by adding openmpi to native-inputs and adjusting the example's + ;; BB_EXE parameter. (add-after 'fix-sources-for-build 'fix-sources-for-tests (lambda _ + (substitute* "examples/CMakeLists.txt" + ;; examples/basic/batch/example3 is accidentally omitted. + (("^(add_subdirectory\\(\\$\\{CMAKE_CURRENT_SOURCE_DIR\\}/b= asic/batch/example)2(\\)\n)" + _ prefix suffix) + (string-append prefix "2" suffix + prefix "3" suffix)) + + ;; The generated runExampleTest.sh script runs the test as = part + ;; of a pipeline and incorrectly (because pipefail is unset= ) + ;; relies on the value of the exit status immediately after= the + ;; pipeline. + ;; (The patch-shebangs phase runs later than this one, so n= o + ;; need to update the path to bash here.) + (("#!/bin/bash") "#!/bin/bash\nset -o pipefail")) + (substitute* (map (lambda (d) (string-append "examples/" d "/CMakeList= s.txt")) (append @@ -2013,57 +2032,78 @@ (define-public nomad-optimizer '("FixedVariable" "NMonly" "PSDMads" "Restart" "c_api/example1" "c_api/example2" "exampleSuggestAndObserve")))) - ;; The built examples are assumed to be in the source tree - ;; (which isn't the case here). + ;; The runExampleTest.sh script is run with WORKING_DIRECTO= RY + ;; set to CMAKE_CURRENT_SOURCE_DIR. + ;; Other scripts invoked by that script (for example + ;; examples/advanced/batch/SuggestAndObserve/loopSuggestAnd= Observe.sh) + ;; are in that same directory, but compiled examples are + ;; located in CMAKE_CURRENT_BINARY_DIR. (("(COMMAND \\$\\{CMAKE_BINARY_DIR\\}/examples/runExampleTe= st\\.sh )\\.(/.*)" _ command test) (string-append command "${CMAKE_CURRENT_BINARY_DIR}" test)= )) + + ;; The examples/basic/batch/example3 executable is already na= med + ;; bb3.exe. + (substitute* "examples/basic/batch/single_obj_parallel/CMakeL= ists.txt" + (("bb3.exe") "bb_parallel.exe")) + ;; (Unrelated to support for out-of-source testing.) (make-file-writable "examples/advanced/library/exampleSuggestAndObserve/cache0.t= xt") - (let* ((builddir (string-append (getcwd) "/../build")) - ;; The BB_EXE and SURROGATE_EXE paths are interpreted - ;; relative to the configuration file provided to NOMA= D. - ;; However, the configuration files are all in the sou= rce - ;; tree rather than in the build tree (unlike the comp= iled - ;; executables). - (fix-exe-path (lambda* (dir #:optional - (file "param.txt") - (exe-opt "BB_EXE")) - (substitute* (string-append dir "/" fi= le) - (((string-append "^" exe-opt " +")) - ;; The $ prevents NOMAD from prefix= ing - ;; the executable with the path of = the - ;; parent directory of the configur= ation - ;; file NOMAD was provided with as - ;; argument (param.txt or some such= ). - (string-append exe-opt " $" - builddir "/" dir "/"= )))))) - (for-each - (lambda (dir) - (let ((dir (string-append "examples/" dir))) - (substitute* (string-append dir "/CMakeLists.txt") - ;; The install phase has not yet run. - (("COMMAND \\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad "= ) - "COMMAND ${CMAKE_BINARY_DIR}/src/nomad ")) - (fix-exe-path dir) - (when (equal? dir "examples/basic/batch/surrogate_sort= ") - (fix-exe-path dir "param.txt" "SURROGATE_EXE")))) - (append (map (lambda (d) (string-append "basic/batch/" d)) - '("example1" "example2" - "single_obj" "single_obj_parallel" - "surrogate_sort")) - '("advanced/batch/LHonly"))) - - (let ((dir "examples/advanced/batch/FixedVariable")) - (substitute* (string-append dir "/runFixed.sh") - ;; Hardcoded path to NOMAD executable. - (("^\\.\\./\\.\\./\\.\\./\\.\\./bin/nomad ") - (string-append builddir "/src/nomad "))) + (let ((builddir (string-append (getcwd) "/../build"))) + ;; For some reason, omitting this fix causes the + ;; examples/advanced/library/PSDMads test to fail, even tho= ugh + ;; it doesn't seem to reference any part of the FixedVariab= le + ;; test. + (let ((dir "examples/advanced/library/FixedVariable")) + (substitute* (string-append dir "/fixedVariable.cpp") + (("^( +std::string sExe =3D ).*" _ prefix) + (string-append prefix "\"" builddir "/" dir "/ufl.exe"= "\";\n")))) + + ;; The BB_EXE and SURROGATE_EXE paths are interpreted relat= ive + ;; to the configuration file provided to NOMAD. + ;; However, the configuration files are all in the source t= ree + ;; rather than in the build tree (unlike the compiled + ;; executables). + (let ((fix-exe-path (lambda* (dir #:optional + (file "param.txt") + (exe-opt "BB_EXE")) + (substitute* (string-append dir "/" f= ile) + (((string-append "^" exe-opt " +")) + ;; The $ prevents NOMAD from prefi= xing + ;; the executable with the path of= the + ;; parent directory of the configu= ration + ;; file NOMAD was provided with as + ;; argument (param.txt or some suc= h). + (string-append exe-opt " $" + builddir "/" dir "/= ")))))) (for-each - (lambda (f) (fix-exe-path dir f)) - '("param1.txt" "param2.txt" "param3.txt" "param10.txt"))= )))) + (lambda (dir) + (let ((dir (string-append "examples/" dir))) + (substitute* (string-append dir "/CMakeLists.txt") + ;; The install phase has not yet run. + (("COMMAND \\$\\{CMAKE_INSTALL_PREFIX\\}/bin/nomad= ") + "COMMAND ${CMAKE_BINARY_DIR}/src/nomad ")) + (fix-exe-path dir) + (when (equal? dir "examples/basic/batch/surrogate_so= rt") + (fix-exe-path dir "param.txt" "SURROGATE_EXE")))) + (append (map (lambda (d) (string-append "basic/batch/" d= )) + '("example1" "example2" "example3" + "single_obj" + "single_obj_parallel" + ;; "single_obj_MPIparallel" + "surrogate_sort")) + '("advanced/batch/LHonly"))) + + (let ((dir "examples/advanced/batch/FixedVariable")) + (substitute* (string-append dir "/runFixed.sh") + ;; Hardcoded path to NOMAD executable. + (("^\\.\\./\\.\\./\\.\\./\\.\\./bin/nomad ") + (string-append builddir "/src/nomad "))) + (for-each + (lambda (f) (fix-exe-path dir f)) + '("param1.txt" "param2.txt" "param3.txt" "param10.txt"= ))))))) ;; The information in the .egg-info file is not kept up to date. (add-after 'install 'delete-superfluous-egg-info -- 2.35.1