summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJeremy Harris <jgh146exb@wizmail.org>2022-03-06 14:25:13 +0000
committerJeremy Harris <jgh146exb@wizmail.org>2022-03-06 16:45:03 +0000
commit42ed39da5af85552a35626348bb77e5576e18aa4 (patch)
tree4c3a5b225dc5ac4b4fc7dc3af971da9685499549 /test
parent80dceaeced16838c894429d5c15d8699ddec5542 (diff)
Utilities: fix exiqgrep perl syntax, add testcases. Bug 2821
Broken-by: df618101a5
Diffstat (limited to 'test')
-rw-r--r--test/README6
-rwxr-xr-xtest/runtest15
-rw-r--r--test/scripts/0000-Basic/06116
-rw-r--r--test/stdout/061162
4 files changed, 87 insertions, 2 deletions
diff --git a/test/README b/test/README
index bca17eb18..ab9fb6496 100644
--- a/test/README
+++ b/test/README
@@ -747,6 +747,12 @@ This command runs the exigrep utility with the given data (the search pattern)
on the current mainlog file.
+ exiqgrep <data>
+
+This command runs the exiqgrep utility with the given options
+on the current spool directory.
+
+
gnutls
This command is present at the start of all but one of the tests that use
diff --git a/test/runtest b/test/runtest
index 2ac6198eb..f0fc25f75 100755
--- a/test/runtest
+++ b/test/runtest
@@ -2416,6 +2416,17 @@ if (/^exigrep\s+(.*)/)
}
+# The "exiqgrep" command runs exiqgrep on the current spool
+
+if (/^exiqgrep(\s+.*)?/)
+ {
+ run_system("(./eximdir/exiqgrep -E ./eximdir/exim -C $parm_cwd/test-config" . ($1 || '') . ";" .
+ "echo exiqgrep exit code = \$?)" .
+ ">>test-stdout");
+ return 1;
+ }
+
+
# The "eximstats" command runs eximstats on the current mainlog
if (/^eximstats\s+(.*)/)
@@ -3798,7 +3809,7 @@ if (defined $parm_lookups{dbm} && not cp("$parm_exim_dir/exim_dbmbuild", "eximdi
$dbm_build_deleted = 1;
}
-foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) {
+foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats exiqgrep)) {
cp("$parm_exim_dir/$tool" => "eximdir/$tool")
or tests_exit(-1, "Failed to make a copy of $tool: $!");
}
@@ -3806,7 +3817,7 @@ foreach my $tool (qw(exim_dumpdb exim_lock exinext exigrep eximstats)) {
# Collect some version information
print '-' x 78, "\n";
print "Perl version for runtest: $]\n";
-foreach (map { "./eximdir/$_" } qw(exigrep exinext eximstats)) {
+foreach (map { "./eximdir/$_" } qw(exigrep exinext eximstats exiqgrep)) {
# fold (or unfold?) multiline output into a one-liner
print join(', ', map { chomp; $_ } `$_ --version`), "\n";
}
diff --git a/test/scripts/0000-Basic/0611 b/test/scripts/0000-Basic/0611
index c35284147..40d08fcf1 100644
--- a/test/scripts/0000-Basic/0611
+++ b/test/scripts/0000-Basic/0611
@@ -6,6 +6,12 @@ need_ipv4
exim -odq a b c
.
****
+# Check that exiqgrep does not fall over, refuses no selectors, and can count.
+exiqgrep -h
+exiqgrep -r '[bc]'
+exiqgrep
+exiqgrep -c -r a
+exiqgrep -c
#
# a slow server as a test target
exim -DSERVER=server -bd -oX PORT_D
diff --git a/test/stdout/0611 b/test/stdout/0611
new file mode 100644
index 000000000..11867c03a
--- /dev/null
+++ b/test/stdout/0611
@@ -0,0 +1,62 @@
+Exim message queue display utility.
+
+ -h This help message.
+ -C Specify which exim.conf to use.
+ -E Specify exim binary to use.
+
+Selection criteria:
+ -f <regexp> Match sender address sender (field is "< >" wrapped)
+ -r <regexp> Match recipient address
+ -s <regexp> Match against the size field from long output
+ -y <seconds> Message younger than
+ -o <seconds> Message older than
+ -z Frozen messages only (exclude non-frozen)
+ -x Non-frozen messages only (exclude frozen)
+ -G <queuename> Match in given queue only
+
+[ NB: for regexps, provided string sits in /<string>/ ]
+
+Display options:
+ -c Display match count
+ -l Long Format [Default]
+ -i Message IDs only
+ -b Brief Format
+ -R Reverse order
+ -a All recipients (including delivered)
+exiqgrep exit code = 0
+ 0m sss 10HmaX-0005vi-00 <CALLER@test.ex>
+ a@test.ex
+ b@test.ex
+ c@test.ex
+
+exiqgrep exit code = 0
+Exim message queue display utility.
+
+ -h This help message.
+ -C Specify which exim.conf to use.
+ -E Specify exim binary to use.
+
+Selection criteria:
+ -f <regexp> Match sender address sender (field is "< >" wrapped)
+ -r <regexp> Match recipient address
+ -s <regexp> Match against the size field from long output
+ -y <seconds> Message younger than
+ -o <seconds> Message older than
+ -z Frozen messages only (exclude non-frozen)
+ -x Non-frozen messages only (exclude frozen)
+ -G <queuename> Match in given queue only
+
+[ NB: for regexps, provided string sits in /<string>/ ]
+
+Display options:
+ -c Display match count
+ -l Long Format [Default]
+ -i Message IDs only
+ -b Brief Format
+ -R Reverse order
+ -a All recipients (including delivered)
+exiqgrep exit code = 1
+1 matches out of 1 messages
+exiqgrep exit code = 0
+1 matches out of 1 messages
+exiqgrep exit code = 0