From: Bruno Haible <bruno@clisp.org>
Date: Sun, 22 Dec 2024 07:11:59 +0000 (+0100)
Subject: test-framework-sh: Avoid test suite failures on MSYS2.
X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=96549c1c2241b97b01f0c5eaed6a3bb1126afbc4;p=gnulib.git

test-framework-sh: Avoid test suite failures on MSYS2.

* tests/init.sh (mkdir) [MSys]: New function.
---

diff --git a/tests/init.sh b/tests/init.sh
index 3bd1e3b9cd..80931d7c96 100644
--- a/tests/init.sh
+++ b/tests/init.sh
@@ -277,6 +277,19 @@ test -n "$EXEEXT" && test -n "$BASH_VERSION" && shopt -s expand_aliases
 #  - try to create the desired directory.
 #  - make only $MAX_TRIES_ attempts
 
+# mkdir on msys2 does not support the '-m' option.
+case `(uname -o) 2>/dev/null` in
+  Msys)
+    mkdir ()
+    {
+      if test " $1" = " -m"; then
+        shift; shift
+      fi
+      /bin/mkdir "$@"
+    }
+    ;;
+esac
+
 # Helper function.  Print $N pseudo-random bytes from a-zA-Z0-9.
 rand_bytes_ ()
 {