Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/freebsd/poudriere.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorBryan Drewery <bryan@shatow.net>2021-08-23 22:26:22 +0300
committerBryan Drewery <bryan@shatow.net>2021-08-27 22:46:48 +0300
commit31af28b582e5bfd702dce81c5f33d4e398aa7f93 (patch)
treeb561f2fc2b542a68811c2c95a0b8c42f12920e0d /test
parent9ad8343f9187f3f06396a4cce0a0e0a1c6af05c5 (diff)
Add mapfile_write for reading from stdin
Diffstat (limited to 'test')
-rw-r--r--test/mapfile.sh24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/mapfile.sh b/test/mapfile.sh
index 01800c73..4674cfc7 100644
--- a/test/mapfile.sh
+++ b/test/mapfile.sh
@@ -417,6 +417,30 @@ fi
ps uaxwd > "${TMP}"
+ :>"${TMP2}"
+ assert_ret 0 mapfile handle "${TMP2}" "we"
+ cat "${TMP}" | mapfile_write "${handle}"
+ assert_ret 0 mapfile_close "${handle}"
+ assert_ret 0 diff -u "${TMP}" "${TMP2}"
+
+ rm -f "${TMP2}"
+ :>"${TMP2}"
+ assert_ret 0 mapfile handle "${TMP2}" "we"
+ mapfile_write "${handle}" <<-EOF
+ $(cat "${TMP}")
+ EOF
+ assert_ret 0 mapfile_close "${handle}"
+ assert_ret 0 diff -u "${TMP}" "${TMP2}"
+
+ rm -f "${TMP}" "${TMP2}"
+}
+
+{
+ TMP=$(mktemp -t mapfile)
+ TMP2=$(mktemp -t mapfile)
+
+ ps uaxwd > "${TMP}"
+
{ cat "${TMP}"; rm -f "${TMP2}"; } | write_atomic "${TMP2}"
assert_ret 0 diff -u "${TMP}" "${TMP2}"