]> git.donarmstrong.com Git - debbugs.git/commitdiff
add the sendmail test script which is used by 06_mail_handling.t
authorDon Armstrong <don@volo>
Wed, 10 Jan 2007 06:21:54 +0000 (22:21 -0800)
committerDon Armstrong <don@volo>
Wed, 10 Jan 2007 06:21:54 +0000 (22:21 -0800)
t/sendmail_tester [new file with mode: 0755]

diff --git a/t/sendmail_tester b/t/sendmail_tester
new file mode 100755 (executable)
index 0000000..22f1e4c
--- /dev/null
@@ -0,0 +1,21 @@
+#!/usr/bin/perl
+
+# All this script does is write whatever is piped to it to a unique
+# filename, with the first line containing the arguments sent.
+
+use IO::File;
+
+# create a unique filename
+if (not -d $ENV{SENDMAIL_TESTDIR}) {
+     system('mkdir','-p',$ENV{SENDMAIL_TESTDIR});
+}
+
+my $fn = "$ENV{SENDMAIL_TESTDIR}/".time.$$;
+
+my $fh = new IO::File $fn ,'w' or die "Unable to open file $fn for writing: $!";
+
+print {$fh} join(' ',map {"'$_'"} @ARGV) or die "Unable to write to file $fn: $!";
+print {$fh} "\n\n";
+print {$fh} <> or die "Unable to write to file $fn: $!";
+
+close $fh or die "Unable to close file $fn: $!";