]> git.marmaro.de Git - mmh/commitdiff
Fix tests to run on OpenBSD
authorVasilii Kolobkov <polezaivsani@ko5v.net>
Thu, 19 Jul 2018 16:54:07 +0000 (18:54 +0200)
committermarkus schnalke <meillo@marmaro.de>
Wed, 31 Oct 2018 09:53:52 +0000 (10:53 +0100)
  Use a hardcoded sequence for there's no seq(1) in OpenBSD.

  awk(1) doesn't support interval regular expression syntax ({n,m})
  on some BSDs.

  hostname(1) has no -f flag on OpenBSD and. Try it first and
  fallback to `uname -n`.

  Omit explicit template in mktemp(1) call.

test/common.sh
test/runtest
test/tests/mhsign/test-mhsign
test/tests/mhstore/test-filenames
test/tests/show/test-longlines

index 805afeafcc8e059c54e702b1a1f1b39dd9f71275..1a677335b586eca66a1f9bb2e4768144a0fb9700 100644 (file)
@@ -52,6 +52,12 @@ require_locale()
        test_skip "no suitable locale available"
 }
 
+# Do a best guess at FQDN
+mh_hostname()
+{
+       hostname -f 2>/dev/null || uname -n
+}
+
 # Some stuff for doing silly progress indicators
 progress_update()
 {
index 9f35adea472642eadc302d06122ceb3c13f0cc12..32c82f553115c76655a472a47d12c2660811eb7f 100755 (executable)
@@ -36,7 +36,7 @@ folder -create `mhparam trashfolder` >/dev/null
 folder -create `mhparam draftfolder` >/dev/null
 
 # create 10 basic messages
-for i in `seq 1 10`;
+for i in 1 2 3 4 5 6 7 8 9 10;
 do
        cat >"$MAILDIR/inbox/$i" <<-!
                From: Test$i <test$i@example.com>
index 3c2bb97cf5dbf1fff76ae1fbec34deb4bbe9d762..44e0997ff89b14abb3d35d225c54d15564d15aaf 100755 (executable)
@@ -7,7 +7,6 @@
 
 . "$MH_TEST_COMMON"
 
-
 # setup some aliases
 
 cat >"$MH_TEST_DIR/.mmh/aliases" <<!
@@ -66,9 +65,9 @@ unknownperson@example.org
 !
 
 runandcheck "mhsign -enc $draft" <<!
-Could not find key for <unknownperson@`hostname -f`>
+Could not find key for <unknownperson@`mh_hostname`>
 Could not find key for <unknownperson@example.org>
-Could not find key for <unknownperson@`hostname -f`>
+Could not find key for <unknownperson@`mh_hostname`>
 Could not find key for <unknownperson@example.org>
 Could not find key for <unknownperson@example.org>
 Could not find key for <unknownperson@example.org>
index a1d3c3d04f3528a871087c686b8314feb072bb5c..31946ee097064eef76152f507ca90f2a56532461 100755 (executable)
@@ -11,7 +11,7 @@ require_locale en_US.utf-8 en_US.utf8
 LC_ALL=en_US.UTF-8
 export LC_ALL
 
-tempdir=`TMPDIR=$MH_TEST_DIR mktemp -d -t "XXXXX"`
+tempdir=`TMPDIR=$MH_TEST_DIR mktemp -d`
 cd $tempdir
 
 msgfile=`mhpath b`
index 138c72489cf43301a317dfa98afdfb965deb5387..c15c1cbb83a20f3a453f7c640f92b597e722da34 100644 (file)
@@ -13,13 +13,11 @@ actual=$MH_TEST_DIR/$$.actual
 genlongsubject() {
        len="${1:-998}"
        awk -v len="$len" 'BEGIN {
-               prefix = "Subject: " len
+               prefix = "Subject: " len " "
                while (i++<len) {
                        s = s "x"
                }
-               re = ".{" length(prefix) "}."
-               sub(re, prefix " ", s)
-               print s
+               print prefix substr(s, length(prefix) + 1)
        }'
 }