[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#72547: [PATCH 5/9] tests: Skip mkdtemp test for invalid template on
From: |
Tomas Volf |
Subject: |
bug#72547: [PATCH 5/9] tests: Skip mkdtemp test for invalid template on Darwin. |
Date: |
Sat, 10 Aug 2024 00:54:31 +0200 |
Darwin accepts any template, as demonstrated here:
#include <stdio.h>
#include <unistd.h>
int
main(void)
{
char template[] = {'T', '-', 'A', 'A', 'A', 'A', 'A', 'A', '\0'};
char *res = mkdtemp(template);
puts(res ? res : "(null)");
perror("mkdtemp");
}
Outputs:
T-AAAAAA
mkdtemp: Undefined error: 0
This does not match prescribed POSIX behavior, but it is what it is.
* test-suite/tests/filesys.test (skip-on-darwin): New procedure.
("mkdtemp")["invalid template"]: Skip on Darwin.
---
test-suite/tests/filesys.test | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/test-suite/tests/filesys.test b/test-suite/tests/filesys.test
index fa8d6f797..72d778145 100644
--- a/test-suite/tests/filesys.test
+++ b/test-suite/tests/filesys.test
@@ -34,6 +34,9 @@
(define (test-directory2)
(data-file-name "filesys-test-dir2.tmp"))
+(define (skip-on-darwin)
+ (when (string-ci=? "darwin" (vector-ref (uname) 0))
+ (throw 'untested)))
;;;
;;; copy-file
@@ -345,6 +348,8 @@
(= (string-length name) 8)))))
(pass-if-exception "invalid template" exception:system-error
+ ;; MacOS accepts any template and just does no replacements.
+ (skip-on-darwin)
(if (not (defined? 'mkdtemp))
(throw 'unresolved)
(mkdtemp "T-AAAAAA")))
--
2.45.2
- bug#72547: [PATCH 0/9] Make test suite pass on macOS., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 1/9] tests: Check TCP_NODELAY for non-zero instead of 1., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 3/9] tests: Skip hole-related port tests on Darwin., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 2/9] tests: Skip tests of abstract Unix sockets on Darwin., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 5/9] tests: Skip mkdtemp test for invalid template on Darwin.,
Tomas Volf <=
- bug#72547: [PATCH 4/9] filesys.c: Fix readlink for ports on Darwin., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 7/9] tests: Fix spawn if file not found with Gnulib., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 6/9] tests: Fix spawn with #:environment on MacOS., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 8/9] Do not depend on tmpnam in posix.test., Tomas Volf, 2024/08/09
- bug#72547: [PATCH 9/9] posix.c: Set errno when pipe2 is not available and flags provided., Tomas Volf, 2024/08/09