From 42354876de823f52a431eac900d360c074c6198d Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Thu, 15 Jul 2021 14:56:58 -0300 Subject: aux/lib.sh: Add mkstemp and mkdtemp, and copy uuid over The tests were relying on the unspecified and non-standartized behaviour of "mktemp". Now they use "mkstemp()", a shim sh function to provide the expected behaviour, and an accompanying "mkdtemp()" function is also defined. To further decouple from specific implementations and OS-behaviours and quirks, a aux/lib.sh file containing both those functions was added. Its purpose is to also allow code under aux/ to not depend on specific behaviour. "mkdtemp()" had to be replicated in aux/ci/ci-build.sh, since it runs outside the repository. --- tests/remotes.sh | 56 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 28 insertions(+), 28 deletions(-) (limited to 'tests/remotes.sh') diff --git a/tests/remotes.sh b/tests/remotes.sh index 829f61d..7b1ba92 100755 --- a/tests/remotes.sh +++ b/tests/remotes.sh @@ -32,8 +32,8 @@ test_supported_remotes() { testing 'supported remotes' N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo git://euandreh.xyz/remembering LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -44,8 +44,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://git.sr.ht/~sircmpwn/ctools git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -55,8 +55,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://git.kernel.org/pub/scm/git/git.git LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -67,8 +67,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://git.savannah.gnu.org/guix.git git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -78,8 +78,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://notabug.org/cwebber/guile-gcrypt LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -90,8 +90,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://codeberg.org/dnkl/yambar git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -101,8 +101,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://bitbucket.org/uprojects/jsmn LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -113,8 +113,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://pagure.io/aquedoc git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -124,8 +124,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://gitlab.com/nonguix/nonguix LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -136,8 +136,8 @@ test_supported_remotes() { cd - > /dev/null || exit 1 N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://github.com/skeeto/elfeed git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -153,8 +153,8 @@ test_unsupported_remote() { testing 'unsupported remotes' N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" new_repo https://example.com/a/b LANG=POSIX git permalink README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -163,8 +163,8 @@ test_unsupported_remote() { assert_fgrep_stderr 'Unsupported origin: https://example.com' N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" git config git-permalink.template-commit-file 'before %s middle %s after' git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? @@ -173,8 +173,8 @@ test_unsupported_remote() { assert_empty_stderr N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" git config --unset git-permalink.template-commit-file git config git-permalink.template-file-commit 'before %s middle %s after' git permalink -p README.md 123 1>"$OUT" 2>"$ERR" @@ -184,8 +184,8 @@ test_unsupported_remote() { assert_empty_stderr N="$LINENO" - OUT="$(mktemp)" - ERR="$(mktemp)" + OUT="$(mkstemp)" + ERR="$(mkstemp)" git config --unset git-permalink.template-file-commit LANG=POSIX git permalink -p README.md 123 1>"$OUT" 2>"$ERR" STATUS=$? -- cgit v1.2.3