$OpenBSD$

Index: test/T240-dump-restore.sh
--- test/T240-dump-restore.sh.orig
+++ test/T240-dump-restore.sh
@@ -7,12 +7,12 @@ test_begin_subtest "dump header"
 cat <<EOF > EXPECTED
 #notmuch-dump batch-tag:3 config,properties,tags
 EOF
-notmuch dump > OUTPUT
+notmuch dump | zcat > OUTPUT
 test_expect_equal_file EXPECTED OUTPUT
 add_email_corpus
 
 test_begin_subtest "Dumping all tags"
-test_expect_success 'generate_message && notmuch new && notmuch dump > dump.expected'
+test_expect_success 'generate_message && notmuch new && notmuch dump | zcat > dump.expected'
 
 # The use of from:cworth is rather arbitrary: it matches some of the
 # email corpus' messages, but not all of them.
@@ -20,52 +20,52 @@ test_expect_success 'generate_message && notmuch new &
 test_begin_subtest "Dumping all tags II"
 test_expect_success \
   'notmuch tag +ABC +DEF -- from:cworth &&
-  notmuch dump > dump-ABC_DEF.expected &&
+  notmuch dump | zcat > dump-ABC_DEF.expected &&
   ! cmp dump.expected dump-ABC_DEF.expected'
 
 test_begin_subtest "Clearing all tags"
 test_expect_success \
   'sed -e "s/(\([^(]*\))$/()/" < dump.expected > clear.expected &&
   notmuch restore --input=clear.expected &&
-  notmuch dump > clear.actual &&
+  notmuch dump | zcat > clear.actual &&
   test_cmp clear.expected clear.actual'
 
 test_begin_subtest "Clearing all tags"
 test_expect_success \
   'notmuch tag +ABC +DEF -- from:cworth &&
   notmuch restore --accumulate < dump.expected &&
-  notmuch dump > dump.actual &&
+  notmuch dump | zcat > dump.actual &&
   test_cmp dump-ABC_DEF.expected dump.actual'
 
 test_begin_subtest "Restoring original tags"
 test_expect_success \
   'notmuch restore --input=dump.expected &&
-  notmuch dump > dump.actual &&
+  notmuch dump | zcat > dump.actual &&
   test_cmp dump.expected dump.actual'
 
 test_begin_subtest "Restore with nothing to do"
 test_expect_success \
   'notmuch restore < dump.expected &&
-  notmuch dump > dump.actual &&
+  notmuch dump | zcat > dump.actual &&
   test_cmp dump.expected dump.actual'
 
 test_begin_subtest "Accumulate with existing tags"
 test_expect_success \
   'notmuch restore --accumulate --input=dump.expected &&
-  notmuch dump > dump.actual &&
+  notmuch dump | zcat > dump.actual &&
   test_cmp dump.expected dump.actual'
 
 test_begin_subtest "Accumulate with no tags"
 test_expect_success \
   'notmuch restore --accumulate < clear.expected &&
-  notmuch dump > dump.actual &&
+  notmuch dump | zcat > dump.actual &&
   test_cmp dump.expected dump.actual'
 
 test_begin_subtest "Accumulate with new tags"
 test_expect_success \
   'notmuch restore --input=dump.expected &&
   notmuch restore --accumulate --input=dump-ABC_DEF.expected &&
-  notmuch dump >  OUTPUT.$test_count &&
+  notmuch dump | zcat >  OUTPUT.$test_count &&
   notmuch restore --input=dump.expected &&
   test_cmp dump-ABC_DEF.expected OUTPUT.$test_count'
 
@@ -75,11 +75,13 @@ test_expect_success \
   'test_must_fail notmuch restore --input=dump.expected another_one'
 
 test_begin_subtest "dump --output=outfile"
-notmuch dump --output=dump-outfile.actual
+notmuch dump --output=dump-outfile.actual.gz
+gunzip dump-outfile.actual.gz
 test_expect_equal_file dump.expected dump-outfile.actual
 
 test_begin_subtest "dump --output=outfile --"
-notmuch dump --output=dump-1-arg-dash.actual --
+notmuch dump --output=dump-1-arg-dash.actual.gz --
+gunzip dump-1-arg-dash.actual.gz
 test_expect_equal_file dump.expected dump-1-arg-dash.actual
 
 # gzipped output
@@ -98,14 +100,14 @@ test_begin_subtest "restoring gzipped stdin"
 notmuch dump --gzip --output=backup.gz
 notmuch tag +new_tag '*'
 notmuch restore < backup.gz
-notmuch dump --output=dump.actual
+notmuch dump | zcat >dump.actual
 test_expect_equal_file dump.expected dump.actual
 
 test_begin_subtest "restoring gzipped file"
 notmuch dump --gzip --output=backup.gz
 notmuch tag +new_tag '*'
 notmuch restore --input=backup.gz
-notmuch dump --output=dump.actual
+notmuch dump | zcat >dump.actual
 test_expect_equal_file dump.expected dump.actual
 
 # Note, we assume all messages from cworth have a message-id
@@ -114,15 +116,17 @@ test_expect_equal_file dump.expected dump.actual
 { head -1 dump.expected ; grep 'cworth[.]org' dump.expected; } > dump-cworth.expected
 
 test_begin_subtest "dump -- from:cworth"
-notmuch dump -- from:cworth > dump-dash-cworth.actual
+notmuch dump -- from:cworth | zcat > dump-dash-cworth.actual
 test_expect_equal_file dump-cworth.expected dump-dash-cworth.actual
 
 test_begin_subtest "dump --output=outfile from:cworth"
-notmuch dump --output=dump-outfile-cworth.actual from:cworth
+notmuch dump --output=dump-outfile-cworth.actual.gz from:cworth
+gunzip dump-outfile-cworth.actual.gz
 test_expect_equal_file dump-cworth.expected dump-outfile-cworth.actual
 
 test_begin_subtest "dump --output=outfile -- from:cworth"
-notmuch dump --output=dump-outfile-dash-inbox.actual -- from:cworth
+notmuch dump --output=dump-outfile-dash-inbox.actual.gz -- from:cworth
+gunzip dump-outfile-dash-inbox.actual.gz
 test_expect_equal_file dump-cworth.expected dump-outfile-dash-inbox.actual
 
 test_begin_subtest "Check for a safe set of message-ids"
@@ -148,21 +152,21 @@ EOF
 test_expect_equal_file EXPECTED OUT
 
 test_begin_subtest "format=batch-tag, # round-trip"
-notmuch dump --format=sup | sort > EXPECTED.$test_count
-notmuch dump --format=batch-tag > DUMPFILE
+notmuch dump --format=sup | zcat | sort > EXPECTED.$test_count
+notmuch dump --format=batch-tag | zcat > DUMPFILE
 notmuch restore --format=batch-tag < DUMPFILE
-notmuch dump --format=sup | sort > OUTPUT.$test_count
+notmuch dump --format=sup | zcat | sort > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest "format=batch-tag, # blank lines and comments"
-notmuch dump --format=batch-tag| sort > EXPECTED.$test_count
+notmuch dump --format=batch-tag | zcat | sort > EXPECTED.$test_count
 notmuch restore <<EOF
 # this line is a comment; the next has only white space
  	 
 
 # the previous line is empty
 EOF
-notmuch dump --format=batch-tag | sort > OUTPUT.$test_count
+notmuch dump --format=batch-tag | zcat | sort > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest "format=batch-tag, # reverse-round-trip empty tag"
@@ -182,7 +186,7 @@ enc2=$($TEST_DIRECTORY/hex-xcode --direction=encode "$
 enc3='%c3%91%c3%a5%c3%b0%c3%a3%c3%a5%c3%a9-%c3%8f%c3%8a'
 tag3=$($TEST_DIRECTORY/hex-xcode --direction=decode $enc3)
 
-notmuch dump --format=batch-tag > BACKUP
+notmuch dump --format=batch-tag | zcat > BACKUP
 
 notmuch tag +"$tag1" +"$tag2" +"$tag3" -inbox -unread "*"
 
@@ -226,10 +230,10 @@ echo "another_tag" > EXPECTED
 test_expect_equal_file EXPECTED OUTPUT.$test_count
 
 test_begin_subtest 'format=batch-tag, round trip with strange tags'
-notmuch dump --format=batch-tag > EXPECTED.$test_count
-notmuch dump --format=batch-tag > DUMPFILE
+notmuch dump --format=batch-tag | zcat > EXPECTED.$test_count
+notmuch dump --format=batch-tag | zcat > DUMPFILE
 notmuch restore --format=batch-tag < DUMPFILE
-notmuch dump --format=batch-tag > OUTPUT.$test_count
+notmuch dump --format=batch-tag | zcat > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest 'format=batch-tag, checking encoded output'
@@ -240,35 +244,35 @@ test_expect_equal_file EXPECTED.$test_count OUTPUT.$te
 
 test_begin_subtest 'restoring sane tags'
 notmuch restore --format=batch-tag < BACKUP
-notmuch dump --format=batch-tag > OUTPUT.$test_count
+notmuch dump --format=batch-tag | zcat > OUTPUT.$test_count
 test_expect_equal_file BACKUP OUTPUT.$test_count
 
 test_begin_subtest 'format=batch-tag, restore=auto'
-notmuch dump --format=batch-tag > EXPECTED.$test_count
+notmuch dump --format=batch-tag | zcat > EXPECTED.$test_count
 notmuch tag -inbox -unread "*"
 notmuch restore --format=auto < EXPECTED.$test_count
-notmuch dump --format=batch-tag > OUTPUT.$test_count
+notmuch dump --format=batch-tag | zcat > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest 'format=sup, restore=auto'
-notmuch dump --format=sup > EXPECTED.$test_count
+notmuch dump --format=sup | zcat > EXPECTED.$test_count
 notmuch tag -inbox -unread "*"
 notmuch restore --format=auto < EXPECTED.$test_count
-notmuch dump --format=sup > OUTPUT.$test_count
+notmuch dump --format=sup | zcat > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest 'format=batch-tag, restore=default'
-notmuch dump --format=batch-tag > EXPECTED.$test_count
+notmuch dump --format=batch-tag | zcat > EXPECTED.$test_count
 notmuch tag -inbox -unread "*"
 notmuch restore < EXPECTED.$test_count
-notmuch dump --format=batch-tag > OUTPUT.$test_count
+notmuch dump --format=batch-tag | zcat > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest 'format=sup, restore=default'
-notmuch dump --format=sup > EXPECTED.$test_count
+notmuch dump --format=sup | zcat > EXPECTED.$test_count
 notmuch tag -inbox -unread "*"
 notmuch restore < EXPECTED.$test_count
-notmuch dump --format=sup > OUTPUT.$test_count
+notmuch dump --format=sup | zcat > OUTPUT.$test_count
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
 
 test_begin_subtest 'restore: checking error messages'
@@ -327,14 +331,14 @@ test_begin_subtest 'roundtripping random message-ids a
     ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
 			--num-messages=100
 
-     notmuch dump --format=batch-tag| \
+     notmuch dump --format=batch-tag | zcat | \
 	 sort > EXPECTED.$test_count
 
      notmuch tag +this_tag_is_very_unlikely_to_be_random '*'
 
      notmuch restore --format=batch-tag < EXPECTED.$test_count
 
-     notmuch dump --format=batch-tag| \
+     notmuch dump --format=batch-tag | zcat | \
 	 sort > OUTPUT.$test_count
 
 test_expect_equal_file EXPECTED.$test_count OUTPUT.$test_count
