From: Omar Polo <op@omarpolo.com>
To: guile-devel@gnu.org
Subject: [PATCH] posix.test: portability tweaks
Date: Sat, 28 Jan 2023 10:58:01 +0100 [thread overview]
Message-ID: <2S0UUERIWWWAK.2XDNUWSYIE9RI@venera> (raw)
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 <op@omarpolo.com>
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
reply other threads:[~2023-01-28 9:58 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/guile/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2S0UUERIWWWAK.2XDNUWSYIE9RI@venera \
--to=op@omarpolo.com \
--cc=guile-devel@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).