From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Omar Polo Newsgroups: gmane.lisp.guile.devel Subject: [PATCH] posix.test: portability tweaks Date: Sat, 28 Jan 2023 10:58:01 +0100 Message-ID: <2S0UUERIWWWAK.2XDNUWSYIE9RI@venera> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="19974"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mblaze/1.2 To: guile-devel@gnu.org Original-X-From: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Sat Jan 28 16:27:24 2023 Return-path: Envelope-to: guile-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pLn6y-00052u-DE for guile-devel@m.gmane-mx.org; Sat, 28 Jan 2023 16:27:24 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pLn6a-0000q9-TD; Sat, 28 Jan 2023 10:27:00 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLhyO-000620-V3 for guile-devel@gnu.org; Sat, 28 Jan 2023 04:58:13 -0500 Original-Received: from mail.omarpolo.com ([144.91.116.244]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pLhyL-0007OP-9V for guile-devel@gnu.org; Sat, 28 Jan 2023 04:58:12 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=omarpolo.com; s=20200327; t=1674899885; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc; bh=o2NsrSaGbAg25qdrRRniolZV9J/ko/MVWQh+3wxmSd0=; b=FZyVx1a7iFsI/k5GYONMpaIINsRfXyvKag68f0JJcAjO47rUBJatieD8YZ3FcQJgFkPWB/ uvSosssWrAD0OLlv8cDk57pxNoq2m9Er9f5aEQo5bfq3xlrRfN/bSQW4e6FpUmvs4cQNbm aKuAttqkklCPhY9ACKCVYOUhEuCob4w= Original-Received: from localhost (host-82-61-20-176.retail.telecomitalia.it [82.61.20.176]) by mail.omarpolo.com (OpenSMTPD) with ESMTPSA id 692e5b9d (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO) for ; Sat, 28 Jan 2023 10:58:05 +0100 (CET) Original-Received: from localhost (localhost [local]) by localhost (OpenSMTPD) with ESMTPA id db97748e for ; Sat, 28 Jan 2023 10:58:01 +0100 (CET) Received-SPF: pass client-ip=144.91.116.244; envelope-from=op@omarpolo.com; helo=mail.omarpolo.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, UNPARSEABLE_RELAY=0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sat, 28 Jan 2023 10:26:58 -0500 X-BeenThere: guile-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Developers list for Guile, the GNU extensibility library" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Original-Sender: guile-devel-bounces+guile-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.lisp.guile.devel:21650 Archived-At: Hello, These are some tweaks for posix.test so that now it fully passes on OpenBSD. In order: - wc(1) may pad its output: % echo ">$(seq 2 | wc -w)<" > 2< - using "seq 3" is more portable than assuming /proc. seq(1) may not be there (on OpenBSD appeared only in 7.1) but it's still better than /proc. Maybe "echo 1 2 3" could be an alternative. - fix the crypt(3) invocation. It failed with EINVAL on OpenBSD, here I'm stoling the example one from the crypt(3) manpage. I've only tested these changes on OpenBSD but, with the exception of the third, I'm sure they still pass (or allow the tests to pass) on other unices as well :) >From b47f74cdb2baee8f6fdf40576a7d5bf9ff90aaee Mon Sep 17 00:00:00 2001 From: Omar Polo Date: Sat, 28 Jan 2023 09:46:02 +0000 Subject: [PATCH] posix.test: portability tweaks - wc(1) may pad the result with blanks so trim its output - use "seq 3" rather than assuming /proc is available - fix nonsensical crypt(3) invocation, use example from OpenBSD manpage --- test-suite/tests/posix.test | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/test-suite/tests/posix.test b/test-suite/tests/posix.test index f20e04453..419bc5086 100644 --- a/test-suite/tests/posix.test +++ b/test-suite/tests/posix.test @@ -416,7 +416,7 @@ (display "Hello world.\n" (cdr a+b)) (close-port (cdr a+b)) - (let ((str (get-string-all (car c+d)))) + (let ((str (string-trim (get-string-all (car c+d))))) (close-port (car c+d)) (waitpid pid) str))) @@ -433,18 +433,16 @@ (waitpid pid) str))) - (pass-if-equal "ls /proc/self/fd" - "0\n1\n2\n3\n" ;fourth FD is for /proc/self/fd - (if (file-exists? "/proc/self/fd") ;Linux - (let* ((input+output (pipe)) - (pid (spawn "ls" '("ls" "/proc/self/fd") - #:output (cdr input+output)))) - (close-port (cdr input+output)) - (let ((str (get-string-all (car input+output)))) - (close-port (car input+output)) - (waitpid pid) - str)) - (throw 'unresolved))) + (pass-if-equal "seq 3" + "1\n2\n3\n" + (let* ((input+output (pipe)) + (pid (spawn "seq" '("seq" "3") + #:output (cdr input+output)))) + (close-port (cdr input+output)) + (let ((str (get-string-all (car input+output)))) + (close-port (car input+output)) + (waitpid pid) + str))) (pass-if-equal "file not found" ENOENT @@ -464,7 +462,8 @@ (pass-if "basic usage" (if (not (defined? 'crypt)) (throw 'unsupported) - (string? (crypt "pass" "abcdefg")))) + (string? (crypt "OrpheanBeholderScryDoubt" + "$2b$12$FPWWO2RJ3CK4FINTw0Hi8OiPKJcX653gzSS.jqltHFMxyDmmQ0Hqq")))) (pass-if "crypt invalid salt on glibc" (begin -- 2.39.0