1 # Copyright (c) 2009-2012 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or
4 # modify it under the terms of the GNU General Public License
5 # as published by the Free Software Foundation; either version 2
6 # of the License, or (at your option) any later version.
8 # This program is distributed in the hope that it will be useful, but
9 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
10 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 # You should have received a copy of the GNU General Public License along
14 # with this program; if not, write to the Free Software Foundation, Inc.,
15 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
18 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
20 use Test::More tests => 167;
26 use lib "@amperldir@";
29 use Installcheck::Run qw( run run_get run_err );
30 use Installcheck::Catalogs;
32 use Amanda::Constants;
33 use Amanda::Util qw( slurp burp );
35 use Amanda::Config qw ( :init :getconf );
37 # easy knob to twiddle to check amreport_new instead
38 my $amreport = "amreport";
40 Amanda::Debug::dbopen("installcheck");
41 Installcheck::log_test_output();
43 # we use Text::Diff for diagnostics if it's installed
46 eval "use Text::Diff;";
54 # set up a fake "printer" for postscript output
55 my $printer_output = "$Installcheck::TMP/postscript-output";
56 $ENV{'INSTALLCHECK_MOCK_LPR_OUTPUT'} = $printer_output;
57 $ENV{'INSTALLCHECK_MOCK_LPR'} = abs_path("mock") . "/lpr";
60 my $ps_template = "$Installcheck::TMP/postscript-template";
61 burp($ps_template, "--PS-TEMPLATE--\n");
63 # and a fake "mail" for email output
64 my $mail_output = "$Installcheck::TMP/mail-output";
65 $ENV{'INSTALLCHECK_MOCK_MAIL_OUTPUT'} = $mail_output;
66 my $mail_mock = abs_path("mock") . "/mail";
69 my $alternate_log_filename="$Installcheck::TMP/installcheck-log";
70 my $current_log_filename="$Installcheck::CONFIG_DIR/TESTCONF/log/log";
71 my $out_filename="$Installcheck::TMP/installcheck-amreport-output";
75 my $testconf = Installcheck::Run::setup();
80 $params{want_mailer} ? "\"$mail_mock\""
81 : $params{bogus_mailer} ? "\"$mail_mock.bogus\""
84 $testconf->add_param('mailer', $mailer);
85 $testconf->add_param('mailto',
86 $params{want_mailto} ? '"nobody\@localhost"' : '""');
88 $testconf->add_tapetype('TEST-TAPE-TEMPLATE', [
89 'length' => '30 mbytes',
90 'filemark' => '4 kbytes',
91 $params{'want_template'}? ('lbl_templ' => "\"$ps_template\""):(),
93 $testconf->add_param('tapetype', "\"TEST-TAPE-TEMPLATE\"");
95 $testconf->remove_param('send_amreport_on');
96 $testconf->add_param('send_amreport_on',
97 exists $params{send_amreport} ? uc($params{send_amreport}) : "ALL"
100 if (defined $params{'runtapes'}) {
101 $testconf->remove_param('runtapes');
102 $testconf->add_param('runtapes', $params{'runtapes'});
104 if (defined $params{'tapecycle'}) {
105 $testconf->remove_param('tapecycle');
106 $testconf->add_param('tapecycle', $params{'tapecycle'});
112 if ($params{'catalog'}) {
113 $cat = Installcheck::Catalogs::load($params{'catalog'});
119 unlink $out_filename;
121 unlink $printer_output;
122 unlink $alternate_log_filename;
125 # compare two multiline strings, giving a diff if they do not match
128 my ( $a_filename, $b, $msg ) = @_;
130 if ($a_filename eq 'stdout') {
131 $a = $Installcheck::Run::stdout;
133 diag("stdout is empty");
138 if (!-f $a_filename) {
139 diag("'$a_filename' does not exist");
143 $a = slurp($a_filename);
146 my $is_ps = ($b =~ m/^--PS-TEMPLATE--/);
152 # strip out special characters
156 # old amreport underquotes the postscript strings
157 $str =~ s{\\\(}{(}mgx;
158 $str =~ s{\\\)}{)}mgx;
160 # make human report insensitive to whitespace differences
161 $str =~ s{[\t ]+}{ }mgx;
162 $str =~ s{\s*\n[\n ]*\s*}{\n}mgx;
165 # chomp the version lines
166 $str =~ s{\n\(brought to you by Amanda version .*$}{\n<versioninfo>}g;
167 $str =~ s{\(Amanda Version .*\) DrawVers}{(Amanda Version x.y.z) DrawVers}g;
179 if ($have_text_diff) {
180 $diff = diff( \$a, \$b, { 'STYLE' => "Unified" } );
182 $diff = "---- GOT: ----\n$a\n---- EXPECTED: ----\n$b\n---- ----";
189 # convert a regular report into what we expect to see in a mail
191 my ($report, $config, $error, $date, $addr) = @_;
193 $error_msg = " FAIL:" if $error;
194 return <<EOF . $report;
195 \$ARGS = ['-s','$config${error_msg} AMANDA MAIL REPORT FOR $date','$addr'];
199 ## try a few various options with a pretty normal logfile. Note that
200 ## these tests all use amreport's script mode
202 setup_config(catalog => 'normal',
203 want_mailer => 1, want_mailto => 1, want_template => 1);
205 like(run_err($amreport, 'TESTCONF-NOSUCH'),
206 qr/could not open conf/,
207 "amreport with bogus config exits with error status and error message");
209 ok(!run($amreport, 'TESTCONF-NOSUCH', '--help'),
210 "amreport --help exits with status 1");
211 like($Installcheck::Run::stdout,
212 qr/Usage: amreport \[--version\]/,
213 "..and prints usage message");
215 like(run_get($amreport, 'TESTCONF-NOSUCH', '--version'),
217 "amreport --version gives version");
219 ok(run($amreport, 'TESTCONF', '--from-amdump'),
220 "amreport, as run from amdump, with mailer, mailto, and a template")
221 or diag($Installcheck::Run::stderr);
223 is($Installcheck::Run::stdout, "", "..produces no output");
224 results_match($mail_output,
225 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
228 results_match($printer_output,
229 $cat->get_text('postscript'),
230 "..printer output matches");
232 ok(run($amreport, 'TESTCONF', '--from-amdump', '/garbage/directory/'),
233 "amreport, as run from amdump, with mailer, mailto, and a template, and bogus option")
234 or diag($Installcheck::Run::stderr);
235 is($Installcheck::Run::stdout, "", "..produces no output");
236 results_match($mail_output,
237 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
239 results_match($printer_output,
240 $cat->get_text('postscript'),
241 "..printer output matches");
245 ok(run($amreport, 'TESTCONF', '-M', 'somebody@localhost'),
246 "amreport -M, with mailer, mailto, and a template")
247 or diag($Installcheck::Run::stderr);
248 is($Installcheck::Run::stdout, "", "..produces no output");
249 results_match($mail_output,
250 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "somebody\@localhost"),
252 results_match($printer_output,
253 $cat->get_text('postscript'),
254 "..printer output matches");
258 ok(run($amreport, 'TESTCONF', '-i'),
259 "amreport -i, with mailer, mailto, and a template => no error");
260 ok(! -f $mail_output,
262 ok(! -f $printer_output,
267 ok(run($amreport, 'TESTCONF', '-p', $out_filename),
268 "amreport -p, with mailer, mailto, and a template")
269 or diag($Installcheck::Run::stderr);
270 is($Installcheck::Run::stdout, "", "..produces no output");
271 results_match($mail_output,
272 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
274 ok(! -f $printer_output,
276 results_match($out_filename, $cat->get_text('postscript'), "..postscript file matches");
278 # test a bare 'amreport', which should now output to stdout
281 ok(run($amreport, 'TESTCONF'),
282 "amreport with no other options outputs to stdout for user convenience")
283 or diag($Installcheck::Run::stderr);
284 results_match('stdout', $cat->get_text('rpt1'),
286 ok(!-f $printer_output, "..no printer output")
287 or diag("error: printer output!:\n" . burp($printer_output));
288 ok(!-f $mail_output, "..no mail output")
289 or diag("error: mail output!:\n" . burp($printer_output));
291 # test long-form file option
294 ok(run($amreport, 'TESTCONF', "--text=$out_filename"),
295 "amreport --text=foo, no other options")
296 or diag($Installcheck::Run::stderr);
297 results_match($out_filename, $cat->get_text('rpt1'),
299 ok(!-f $printer_output, "..no printer output")
300 or diag("error: printer output!:\n" . burp($printer_output));
301 ok(!-f $mail_output, "..no mail output")
302 or diag("error: mail output!:\n" . burp($printer_output));
304 # test long form postscript option
308 run($amreport, 'TESTCONF', '--ps', $out_filename),
309 "amreport --ps foo, no other options"
311 results_match($out_filename, $cat->get_text('postscript'), '..results match');
312 ok(!-f $printer_output, "..no printer output");
313 ok(!-f $mail_output, "..no mail output");
317 # test new mail option, using config mailto
318 setup_config(catalog => 'normal',
319 want_mailer => 1, want_mailto => 1, want_template => 1);
321 ok(run($amreport, 'TESTCONF', '--mail-text'),
322 "amreport --mail-text, no other options, built-in mailto");
326 $cat->get_text('rpt1'), "DailySet1", 0,
327 "February 25, 2009", "nobody\@localhost"
331 ok(!-f $printer_output, "..no printer output");
332 ok(!-f $out_filename, "..no file output");
336 # test new mail option, using passed mailto
337 ok(run($amreport, 'TESTCONF', '--mail-text=somebody@localhost',),
338 'amreport --mail-text=somebody\@localhost, no other options');
342 $cat->get_text('rpt1'), "DailySet1", 0,
343 "February 25, 2009", "somebody\@localhost"
347 ok(!-f $printer_output, "..no printer output");
348 ok(!-f $out_filename, "..no file output");
352 # test long-form log option
353 burp($alternate_log_filename, $cat->get_file('log/log'));
355 run($amreport, 'TESTCONF', '--log', $alternate_log_filename),
356 "amreport --log with old log, no other config options"
358 results_match('stdout', $cat->get_text('rpt1'),
359 '..stdout output matches');
360 ok(!-f $mail_output, "..no mail output");
361 ok(!-f $out_filename, "..no file output");
362 ok(!-f $printer_output, "..no printer output");
366 # test long-form print option, without specified printer
367 setup_config(catalog => 'normal', want_template => 1);
368 ok(run($amreport, 'TESTCONF', '--print'),
369 'amreport --print, no other options');
372 $cat->get_text('postscript'),
373 "..printer output matches"
375 ok(!-f $mail_output, "..no mail output");
376 ok(!-f $out_filename, "..no file output");
380 setup_config(catalog => 'normal',
381 want_mailer => 1, want_mailto => 1, want_template => 1);
382 ok(run($amreport, 'TESTCONF', '-i', '-p', $out_filename),
383 "amreport -i -p, with mailer, mailto, and a template")
384 or diag($Installcheck::Run::stderr);
385 is($Installcheck::Run::stdout, "", "..produces no output");
386 ok(! -f $mail_output,
387 "..produces no mail");
388 ok(! -f $printer_output,
390 results_match($out_filename,
391 $cat->get_text('postscript'),
392 "..postscript output in -p file matches");
396 ok(run($amreport, 'TESTCONF', '-i', '-f', $out_filename),
397 "amreport -i -f, with mailer, mailto, and a template")
398 or diag($Installcheck::Run::stderr);
399 is($Installcheck::Run::stdout, "", "..produces no output");
400 ok(! -f $mail_output,
401 "..produces no mail");
402 results_match($printer_output,
403 $cat->get_text('postscript'),
404 "..printer output matches");
405 results_match($out_filename,
406 $cat->get_text('rpt1'),
407 "..report output in -f file matches");
411 burp($alternate_log_filename, $cat->get_file('log/log'));
412 ok(run($amreport, 'TESTCONF', '-l', $alternate_log_filename),
413 "amreport -l, with mailer, mailto, and a template")
414 or diag($Installcheck::Run::stderr);
415 is($Installcheck::Run::stdout, "", "..produces no output");
416 results_match($mail_output,
417 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
419 results_match($printer_output,
420 $cat->get_text('postscript'),
421 "..printer output matches");
423 setup_config(catalog => 'normal',
426 ok(run($amreport, 'TESTCONF', '--from-amdump'),
427 "amreport --from-amdump, with mailer but no mailto and no template => exit==0");
428 ok(! -f $mail_output, "..doesn't mail");
429 ok(! -f $printer_output, "..doesn't print");
433 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=hello'),
434 "amreport -o to set mailto, with mailer but no mailto and no template")
435 or diag($Installcheck::Run::stderr);
436 is($Installcheck::Run::stdout, "", "..produces no output");
437 results_match($mail_output,
438 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "hello"),
440 ok(! -f $printer_output,
445 like(run_err($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=ill\egal'),
446 qr/mail addresses have invalid characters/,
447 "amreport with illegal email in -o, with mailer but no mailto and no template, errors out");
449 setup_config(catalog => 'normal',
450 want_mailer => 1, want_template => 1);
452 ok(run($amreport, 'TESTCONF', '--from-amdump'),
453 "no-args amreport with mailer, no mailto, and a template does nothing even though it could "
454 . "print a label"); # arguably a bug, but we'll keep it for now
455 ok(! -f $mail_output, "..doesn't mail");
456 ok(! -f $printer_output, "..doesn't print");
460 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=dustin'),
461 "amreport with mailer, no mailto, and a template, but mailto in config override works")
462 or diag($Installcheck::Run::stderr);
463 is($Installcheck::Run::stdout, "", "..produces no output");
464 results_match($mail_output,
465 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "dustin"),
467 results_match($printer_output,
468 $cat->get_text('postscript'),
469 "..printer output matches");
471 ok(run($amreport, 'TESTCONF', '-M', 'pcmantz'),
472 "amreport with mailer, no mailto, and a template, but mailto in -M works")
473 or diag($Installcheck::Run::stderr);
474 is($Installcheck::Run::stdout, "", "..produces no output");
475 results_match($mail_output,
476 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "pcmantz"),
478 results_match($printer_output,
479 $cat->get_text('postscript'),
480 "..printer output matches");
482 setup_config(catalog => 'normal', want_template => 1);
484 like(run_get($amreport, 'TESTCONF', '-M', 'martineau'),
485 qr/Warning: a mailer is not defined/,
486 "amreport with no mailer, no mailto, and a template, but mailto in -M fails with "
487 . "warning, but exit==0");
488 ok(! -f $mail_output, "..doesn't mail");
489 ok(! -f $printer_output, "..doesn't print");
491 setup_config(catalog => 'normal',
492 want_mailer => 1, want_mailto => 1);
494 ok(run($amreport, 'TESTCONF', '-p', $out_filename), # XXX another probable bug
495 "amreport with mailer, mailto, but no template, ignores -p option ")
496 or diag($Installcheck::Run::stderr);
497 is($Installcheck::Run::stdout, "", "..produces no output");
498 results_match($mail_output,
499 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
501 ok(! -f $printer_output,
506 ok(run($amreport, 'TESTCONF', '-o', "tapetype:TEST-TAPE-TEMPLATE:lbl_templ=$ps_template",
507 '-p', $out_filename),
508 "amreport with mailer, mailto, but no template, minds -p option if template given via -o")
509 or diag($Installcheck::Run::stderr);
510 is($Installcheck::Run::stdout, "", "..produces no output");
511 results_match($mail_output,
512 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
514 results_match($out_filename,
515 $cat->get_text('postscript'),
516 "..printer output matches");
518 setup_config(catalog => 'normal',
519 bogus_mailer => 1, want_mailto => 1, want_template => 1);
521 ok(run($amreport, 'TESTCONF', '--from-amdump'),
522 "amreport with bogus mailer; doesn't mail, still prints")
523 or diag($Installcheck::Run::stderr);
524 ok(!-f $mail_output, "..produces no mail output");
525 is($Installcheck::Run::stdout, "", "..produces no stdout output");
528 like($Installcheck::Run::stderr,
529 qr/^error: the mailer '.*' is not an executable program\.$/,
530 "..produces correct stderr output");
533 $cat->get_text('postscript'),
534 "..printer output matches"
542 send_amreport => 'error'
546 run($amreport, 'TESTCONF', '--from-amdump'),
547 "amreport with CNF_SEND_AMREPORT_ON set to errors only, no mail, still prints"
548 ) or diag($Installcheck::Run::stderr);
549 ok(!-f $mail_output, "..produces no mail output") or diag(slurp $mail_output);
550 is($Installcheck::Run::stdout, "", "..produces no stdout output")
551 or diag($Installcheck::Run::stdout);
554 $cat->get_text('postscript'),
555 "..printer output matches"
558 ## test columnspec adjustments, etc.
560 setup_config(catalog => 'normal');
562 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=::2'),
563 "amreport with OrigKB=::2");
564 results_match($out_filename, $cat->get_text('rpt2'),
567 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5'),
568 "amreport with OrigKB=:5");
569 results_match($out_filename, $cat->get_text('rpt3'),
572 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5:6'),
573 "amreport with OrigKB=:5:6");
574 results_match($out_filename, $cat->get_text('rpt4'),
577 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'displayunit=m'),
578 "amreport with displayunit=m");
579 results_match($out_filename, $cat->get_text('rpt5'),
582 setup_config(catalog => 'doublefailure',
583 want_mailer => 1, want_template => 1);
585 ok(!run($amreport, 'TESTCONF', '-M', 'dustin'),
586 "amreport with log in error")
587 or diag($Installcheck::Run::stderr);
588 is($Installcheck::Run::stdout, "", "..produces no output");
589 results_match($mail_output,
590 make_mail($cat->get_text('report'), "DailySet1", 1, "March 26, 2009", "dustin"),
593 ## some (anonymized) real logfiles, for regression testing
595 setup_config(catalog => 'strontium', want_template => 1);
597 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
598 "amreport with strontium logfile (simple example with multiple levels)");
599 results_match($out_filename, $cat->get_text('report'),
601 results_match($printer_output,
602 $cat->get_text('postscript'),
603 "..printer output matches");
605 setup_config(catalog => 'amflush', want_template => 1);
607 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
608 "amreport with amflush logfile (regression check for flush-related DUMP STATUS)");
609 results_match($out_filename, $cat->get_text('report'),
611 results_match($printer_output,
612 $cat->get_text('postscript'),
613 "..printer output matches");
615 setup_config(catalog => 'resultsmissing', want_template => 1);
617 run($amreport, 'TESTCONF', '-f', $out_filename);
618 is($Installcheck::Run::exit_code, 12,
619 "amreport with resultsmissing logfile ('RESULTS MISSING') exit==12");
620 results_match($out_filename, $cat->get_text('report'),
622 results_match($printer_output,
623 $cat->get_text('postscript'),
624 "..printer output matches");
626 setup_config(catalog => 'shortstrange', want_template => 1);
628 run($amreport, 'TESTCONF', '-f', $out_filename);
629 is($Installcheck::Run::exit_code, 2,
630 "amreport with shortstrange logfile exit==2");
631 results_match($out_filename, $cat->get_text('report'),
633 results_match($printer_output,
634 $cat->get_text('postscript'),
635 "..printer output matches");
637 setup_config(catalog => 'longstrange', want_template => 1);
639 run($amreport, 'TESTCONF', '-f', $out_filename);
640 is($Installcheck::Run::exit_code, 2,
641 "amreport with longstrange logfile exit==2");
642 results_match($out_filename, $cat->get_text('report'),
645 setup_config(catalog => 'doublefailure', want_template => 1);
647 run($amreport, 'TESTCONF', '-f', $out_filename);
648 is($Installcheck::Run::exit_code, 4,
649 "amreport with doublefailure logfile exit==4");
650 results_match($out_filename, $cat->get_text('report'),
652 results_match($printer_output,
653 $cat->get_text('postscript'),
654 "..printer output matches");
656 setup_config(catalog => 'bigestimate', want_template => 1);
658 run($amreport, 'TESTCONF', '-f', $out_filename);
659 is($Installcheck::Run::exit_code, 0,
660 "amreport with bigestimate logfile exit==0");
661 results_match($out_filename, $cat->get_text('report'),
663 results_match($printer_output,
664 $cat->get_text('postscript'),
665 "..printer output matches");
667 setup_config(catalog => 'retried', want_template => 1);
669 run($amreport, 'TESTCONF', '-f', $out_filename);
670 is($Installcheck::Run::exit_code, 4,
671 "amreport with retried logfile exit==4");
672 results_match($out_filename, $cat->get_text('report'),
674 results_match($printer_output,
675 $cat->get_text('postscript'),
676 "..printer output matches");
678 setup_config(catalog => 'retried-strange');
680 run($amreport, 'TESTCONF', '-f', $out_filename);
681 is($Installcheck::Run::exit_code, 6,
682 "amreport with retried logfile, with strange exit==6");
683 results_match($out_filename, $cat->get_text('report'),
686 setup_config(catalog => 'retried-nofinish', want_template => 1);
688 run($amreport, 'TESTCONF', '-f', $out_filename);
689 is($Installcheck::Run::exit_code, 4,
690 "amreport with retried logfile where driver did not finish exit==4");
691 results_match($out_filename, $cat->get_text('report'),
694 setup_config(catalog => 'taperr', want_template => 1);
696 run($amreport, 'TESTCONF', '-f', $out_filename);
697 is($Installcheck::Run::exit_code, 16,
698 "amreport with taperr logfile exit==16");
699 results_match($out_filename, $cat->get_text('report-holding'),
701 ok((-f $printer_output and -z $printer_output),
702 "..printer output exists but is empty");
704 burp($alternate_log_filename, $cat->get_file('log/log'));
706 # use an explicit -l here so amreport doesn't try to look at the holding disk
707 run($amreport, 'TESTCONF', '-f', $out_filename, '-l', $alternate_log_filename);
708 is($Installcheck::Run::exit_code, 16,
709 "amreport with taperr logfile specified explicitly exit==16");
710 results_match($out_filename, $cat->get_text('report-noholding'),
713 setup_config(catalog => 'spanned', want_template => 1);
715 run($amreport, 'TESTCONF', '-f', $out_filename);
716 is($Installcheck::Run::exit_code, 0,
717 "amreport with spanned logfile");
718 results_match($out_filename, $cat->get_text('report'),
720 results_match($printer_output,
721 $cat->get_text('postscript'),
722 "..printer output matches");
724 setup_config(catalog => 'fatal', want_template => 1);
726 run($amreport, 'TESTCONF', '-f', $out_filename);
727 is($Installcheck::Run::exit_code, 5,
728 "amreport with fatal logfile");
729 results_match($out_filename, $cat->get_text('report'),
731 ok(-f $printer_output && -z $printer_output,
732 "..printer output is empty (no dumps, no tapes)");
734 setup_config(catalog => 'flush-origsize', want_template => 1);
736 run($amreport, 'TESTCONF', '-f', $out_filename);
737 is($Installcheck::Run::exit_code, 0,
738 "amreport with flush-origsize");
739 results_match($out_filename, $cat->get_text('report'),
742 setup_config(catalog => 'flush-noorigsize', want_template => 1);
744 run($amreport, 'TESTCONF', '-f', $out_filename);
745 is($Installcheck::Run::exit_code, 0,
746 "amreport with flush-noorigsize");
747 results_match($out_filename, $cat->get_text('report'),
750 setup_config(catalog => 'plannerfail', want_template => 1);
752 run($amreport, 'TESTCONF', '-f', $out_filename);
753 is($Installcheck::Run::exit_code, 4,
754 "amreport with a planner failure (failed)");
755 results_match($out_filename, $cat->get_text('report'),
758 setup_config(catalog => 'skipped', want_template => 1);
760 run($amreport, 'TESTCONF', '-f', $out_filename);
761 is($Installcheck::Run::exit_code, 0,
762 "amreport with a planner skipped dump (success)");
763 results_match($out_filename, $cat->get_text('report'),
766 setup_config(catalog => 'filesystemstaped', want_template => 1, runtapes => 3, tapecycle => 5);
768 run($amreport, 'TESTCONF', '-f', $out_filename);
769 is($Installcheck::Run::exit_code, 0,
770 "amreport correctly report filesystem taped (success)");
771 results_match($out_filename, $cat->get_text('report'),
774 setup_config(catalog => 'multi-taper', want_template => 0);
776 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
777 my $logdir = getconf($CNF_LOGDIR);
778 my $logfile = $logdir . "/log.20100908110856.0";
779 run($amreport, 'TESTCONF', '-l', $logfile, '-f', $out_filename, '-o', 'TAPETYPE:TEST-TAPE-TEMPLATE:length=41m');
780 is($Installcheck::Run::exit_code, 0,
781 "amreport correctly report multi-taper (success)");
782 results_match($out_filename, $cat->get_text('report'),