1 # Copyright (c) 2009, 2010 Zmanda, Inc. All Rights Reserved.
3 # This program is free software; you can redistribute it and/or modify it
4 # under the terms of the GNU General Public License version 2 as published
5 # by the Free Software Foundation.
7 # This program is distributed in the hope that it will be useful, but
8 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
9 # or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 # You should have received a copy of the GNU General Public License along
13 # with this program; if not, write to the Free Software Foundation, Inc.,
14 # 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 # Contact information: Zmanda Inc, 465 S. Mathilda Ave., Suite 300
17 # Sunnyvale, CA 94086, USA, or: http://www.zmanda.com
19 use Test::More tests => 167;
25 use lib "@amperldir@";
28 use Installcheck::Run qw( run run_get run_err );
29 use Installcheck::Catalogs;
31 use Amanda::Constants;
32 use Amanda::Util qw( slurp burp );
34 use Amanda::Config qw ( :init :getconf );
36 # easy knob to twiddle to check amreport_new instead
37 my $amreport = "amreport";
39 Amanda::Debug::dbopen("installcheck");
40 Installcheck::log_test_output();
42 # we use Text::Diff for diagnostics if it's installed
45 eval "use Text::Diff;";
53 # set up a fake "printer" for postscript output
54 my $printer_output = "$Installcheck::TMP/postscript-output";
55 $ENV{'INSTALLCHECK_MOCK_LPR_OUTPUT'} = $printer_output;
56 $ENV{'INSTALLCHECK_MOCK_LPR'} = abs_path("mock") . "/lpr";
59 my $ps_template = "$Installcheck::TMP/postscript-template";
60 burp($ps_template, "--PS-TEMPLATE--\n");
62 # and a fake "mail" for email output
63 my $mail_output = "$Installcheck::TMP/mail-output";
64 $ENV{'INSTALLCHECK_MOCK_MAIL_OUTPUT'} = $mail_output;
65 my $mail_mock = abs_path("mock") . "/mail";
68 my $alternate_log_filename="$Installcheck::TMP/installcheck-log";
69 my $current_log_filename="$Installcheck::CONFIG_DIR/TESTCONF/log/log";
70 my $out_filename="$Installcheck::TMP/installcheck-amreport-output";
74 my $testconf = Installcheck::Run::setup();
79 $params{want_mailer} ? "\"$mail_mock\""
80 : $params{bogus_mailer} ? "\"$mail_mock.bogus\""
83 $testconf->add_param('mailer', $mailer);
84 $testconf->add_param('mailto',
85 $params{want_mailto} ? '"nobody\@localhost"' : '""');
87 $testconf->add_tapetype('TEST-TAPE-TEMPLATE', [
88 'length' => '30 mbytes',
89 'filemark' => '4 kbytes',
90 $params{'want_template'}? ('lbl_templ' => "\"$ps_template\""):(),
92 $testconf->add_param('tapetype', "\"TEST-TAPE-TEMPLATE\"");
94 $testconf->remove_param('send_amreport_on');
95 $testconf->add_param('send_amreport_on',
96 exists $params{send_amreport} ? uc($params{send_amreport}) : "ALL"
99 if (defined $params{'runtapes'}) {
100 $testconf->remove_param('runtapes');
101 $testconf->add_param('runtapes', $params{'runtapes'});
103 if (defined $params{'tapecycle'}) {
104 $testconf->remove_param('tapecycle');
105 $testconf->add_param('tapecycle', $params{'tapecycle'});
111 if ($params{'catalog'}) {
112 $cat = Installcheck::Catalogs::load($params{'catalog'});
118 unlink $out_filename;
120 unlink $printer_output;
121 unlink $alternate_log_filename;
124 # compare two multiline strings, giving a diff if they do not match
127 my ( $a_filename, $b, $msg ) = @_;
129 if ($a_filename eq 'stdout') {
130 $a = $Installcheck::Run::stdout;
132 diag("stdout is empty");
137 if (!-f $a_filename) {
138 diag("'$a_filename' does not exist");
142 $a = slurp($a_filename);
145 my $is_ps = ($b =~ m/^--PS-TEMPLATE--/);
151 # strip out special characters
155 # old amreport underquotes the postscript strings
156 $str =~ s{\\\(}{(}mgx;
157 $str =~ s{\\\)}{)}mgx;
159 # make human report insensitive to whitespace differences
160 $str =~ s{[\t ]+}{ }mgx;
161 $str =~ s{\s*\n[\n ]*\s*}{\n}mgx;
164 # chomp the version lines
165 $str =~ s{\n\(brought to you by Amanda version .*$}{\n<versioninfo>}g;
166 $str =~ s{\(Amanda Version .*\) DrawVers}{(Amanda Version x.y.z) DrawVers}g;
178 if ($have_text_diff) {
179 $diff = diff( \$a, \$b, { 'STYLE' => "Unified" } );
181 $diff = "---- GOT: ----\n$a\n---- EXPECTED: ----\n$b\n---- ----";
188 # convert a regular report into what we expect to see in a mail
190 my ($report, $config, $error, $date, $addr) = @_;
192 $error_msg = " FAIL:" if $error;
193 return <<EOF . $report;
194 \$ARGS = ['-s','$config${error_msg} AMANDA MAIL REPORT FOR $date','$addr'];
198 ## try a few various options with a pretty normal logfile. Note that
199 ## these tests all use amreport's script mode
201 setup_config(catalog => 'normal',
202 want_mailer => 1, want_mailto => 1, want_template => 1);
204 like(run_err($amreport, 'TESTCONF-NOSUCH'),
205 qr/could not open conf/,
206 "amreport with bogus config exits with error status and error message");
208 ok(!run($amreport, 'TESTCONF-NOSUCH', '--help'),
209 "amreport --help exits with status 1");
210 like($Installcheck::Run::stdout,
211 qr/Usage: amreport \[--version\]/,
212 "..and prints usage message");
214 like(run_get($amreport, 'TESTCONF-NOSUCH', '--version'),
216 "amreport --version gives version");
218 ok(run($amreport, 'TESTCONF', '--from-amdump'),
219 "amreport, as run from amdump, with mailer, mailto, and a template")
220 or diag($Installcheck::Run::stderr);
222 is($Installcheck::Run::stdout, "", "..produces no output");
223 results_match($mail_output,
224 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
227 results_match($printer_output,
228 $cat->get_text('postscript'),
229 "..printer output matches");
231 ok(run($amreport, 'TESTCONF', '--from-amdump', '/garbage/directory/'),
232 "amreport, as run from amdump, with mailer, mailto, and a template, and bogus option")
233 or diag($Installcheck::Run::stderr);
234 is($Installcheck::Run::stdout, "", "..produces no output");
235 results_match($mail_output,
236 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
238 results_match($printer_output,
239 $cat->get_text('postscript'),
240 "..printer output matches");
244 ok(run($amreport, 'TESTCONF', '-M', 'somebody@localhost'),
245 "amreport -M, with mailer, mailto, and a template")
246 or diag($Installcheck::Run::stderr);
247 is($Installcheck::Run::stdout, "", "..produces no output");
248 results_match($mail_output,
249 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "somebody\@localhost"),
251 results_match($printer_output,
252 $cat->get_text('postscript'),
253 "..printer output matches");
257 ok(run($amreport, 'TESTCONF', '-i'),
258 "amreport -i, with mailer, mailto, and a template => no error");
259 ok(! -f $mail_output,
261 ok(! -f $printer_output,
266 ok(run($amreport, 'TESTCONF', '-p', $out_filename),
267 "amreport -p, with mailer, mailto, and a template")
268 or diag($Installcheck::Run::stderr);
269 is($Installcheck::Run::stdout, "", "..produces no output");
270 results_match($mail_output,
271 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
273 ok(! -f $printer_output,
275 results_match($out_filename, $cat->get_text('postscript'), "..postscript file matches");
277 # test a bare 'amreport', which should now output to stdout
280 ok(run($amreport, 'TESTCONF'),
281 "amreport with no other options outputs to stdout for user convenience")
282 or diag($Installcheck::Run::stderr);
283 results_match('stdout', $cat->get_text('rpt1'),
285 ok(!-f $printer_output, "..no printer output")
286 or diag("error: printer output!:\n" . burp($printer_output));
287 ok(!-f $mail_output, "..no mail output")
288 or diag("error: mail output!:\n" . burp($printer_output));
290 # test long-form file option
293 ok(run($amreport, 'TESTCONF', "--text=$out_filename"),
294 "amreport --text=foo, no other options")
295 or diag($Installcheck::Run::stderr);
296 results_match($out_filename, $cat->get_text('rpt1'),
298 ok(!-f $printer_output, "..no printer output")
299 or diag("error: printer output!:\n" . burp($printer_output));
300 ok(!-f $mail_output, "..no mail output")
301 or diag("error: mail output!:\n" . burp($printer_output));
303 # test long form postscript option
307 run($amreport, 'TESTCONF', '--ps', $out_filename),
308 "amreport --ps foo, no other options"
310 results_match($out_filename, $cat->get_text('postscript'), '..results match');
311 ok(!-f $printer_output, "..no printer output");
312 ok(!-f $mail_output, "..no mail output");
316 # test new mail option, using config mailto
317 setup_config(catalog => 'normal',
318 want_mailer => 1, want_mailto => 1, want_template => 1);
320 ok(run($amreport, 'TESTCONF', '--mail-text'),
321 "amreport --mail-text, no other options, built-in mailto");
325 $cat->get_text('rpt1'), "DailySet1", 0,
326 "February 25, 2009", "nobody\@localhost"
330 ok(!-f $printer_output, "..no printer output");
331 ok(!-f $out_filename, "..no file output");
335 # test new mail option, using passed mailto
336 ok(run($amreport, 'TESTCONF', '--mail-text=somebody@localhost',),
337 'amreport --mail-text=somebody\@localhost, no other options');
341 $cat->get_text('rpt1'), "DailySet1", 0,
342 "February 25, 2009", "somebody\@localhost"
346 ok(!-f $printer_output, "..no printer output");
347 ok(!-f $out_filename, "..no file output");
351 # test long-form log option
352 burp($alternate_log_filename, $cat->get_file('log/log'));
354 run($amreport, 'TESTCONF', '--log', $alternate_log_filename),
355 "amreport --log with old log, no other config options"
357 results_match('stdout', $cat->get_text('rpt1'),
358 '..stdout output matches');
359 ok(!-f $mail_output, "..no mail output");
360 ok(!-f $out_filename, "..no file output");
361 ok(!-f $printer_output, "..no printer output");
365 # test long-form print option, without specified printer
366 setup_config(catalog => 'normal', want_template => 1);
367 ok(run($amreport, 'TESTCONF', '--print'),
368 'amreport --print, no other options');
371 $cat->get_text('postscript'),
372 "..printer output matches"
374 ok(!-f $mail_output, "..no mail output");
375 ok(!-f $out_filename, "..no file output");
379 setup_config(catalog => 'normal',
380 want_mailer => 1, want_mailto => 1, want_template => 1);
381 ok(run($amreport, 'TESTCONF', '-i', '-p', $out_filename),
382 "amreport -i -p, with mailer, mailto, and a template")
383 or diag($Installcheck::Run::stderr);
384 is($Installcheck::Run::stdout, "", "..produces no output");
385 ok(! -f $mail_output,
386 "..produces no mail");
387 ok(! -f $printer_output,
389 results_match($out_filename,
390 $cat->get_text('postscript'),
391 "..postscript output in -p file matches");
395 ok(run($amreport, 'TESTCONF', '-i', '-f', $out_filename),
396 "amreport -i -f, with mailer, mailto, and a template")
397 or diag($Installcheck::Run::stderr);
398 is($Installcheck::Run::stdout, "", "..produces no output");
399 ok(! -f $mail_output,
400 "..produces no mail");
401 results_match($printer_output,
402 $cat->get_text('postscript'),
403 "..printer output matches");
404 results_match($out_filename,
405 $cat->get_text('rpt1'),
406 "..report output in -f file matches");
410 burp($alternate_log_filename, $cat->get_file('log/log'));
411 ok(run($amreport, 'TESTCONF', '-l', $alternate_log_filename),
412 "amreport -l, with mailer, mailto, and a template")
413 or diag($Installcheck::Run::stderr);
414 is($Installcheck::Run::stdout, "", "..produces no output");
415 results_match($mail_output,
416 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
418 results_match($printer_output,
419 $cat->get_text('postscript'),
420 "..printer output matches");
422 setup_config(catalog => 'normal',
425 ok(run($amreport, 'TESTCONF', '--from-amdump'),
426 "amreport --from-amdump, with mailer but no mailto and no template => exit==0");
427 ok(! -f $mail_output, "..doesn't mail");
428 ok(! -f $printer_output, "..doesn't print");
432 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=hello'),
433 "amreport -o to set mailto, with mailer but no mailto and no template")
434 or diag($Installcheck::Run::stderr);
435 is($Installcheck::Run::stdout, "", "..produces no output");
436 results_match($mail_output,
437 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "hello"),
439 ok(! -f $printer_output,
444 like(run_err($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=ill\egal'),
445 qr/mail addresses have invalid characters/,
446 "amreport with illegal email in -o, with mailer but no mailto and no template, errors out");
448 setup_config(catalog => 'normal',
449 want_mailer => 1, want_template => 1);
451 ok(run($amreport, 'TESTCONF', '--from-amdump'),
452 "no-args amreport with mailer, no mailto, and a template does nothing even though it could "
453 . "print a label"); # arguably a bug, but we'll keep it for now
454 ok(! -f $mail_output, "..doesn't mail");
455 ok(! -f $printer_output, "..doesn't print");
459 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=dustin'),
460 "amreport with mailer, no mailto, and a template, but mailto in config override works")
461 or diag($Installcheck::Run::stderr);
462 is($Installcheck::Run::stdout, "", "..produces no output");
463 results_match($mail_output,
464 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "dustin"),
466 results_match($printer_output,
467 $cat->get_text('postscript'),
468 "..printer output matches");
470 ok(run($amreport, 'TESTCONF', '-M', 'pcmantz'),
471 "amreport with mailer, no mailto, and a template, but mailto in -M works")
472 or diag($Installcheck::Run::stderr);
473 is($Installcheck::Run::stdout, "", "..produces no output");
474 results_match($mail_output,
475 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "pcmantz"),
477 results_match($printer_output,
478 $cat->get_text('postscript'),
479 "..printer output matches");
481 setup_config(catalog => 'normal', want_template => 1);
483 like(run_get($amreport, 'TESTCONF', '-M', 'martineau'),
484 qr/Warning: a mailer is not defined/,
485 "amreport with no mailer, no mailto, and a template, but mailto in -M fails with "
486 . "warning, but exit==0");
487 ok(! -f $mail_output, "..doesn't mail");
488 ok(! -f $printer_output, "..doesn't print");
490 setup_config(catalog => 'normal',
491 want_mailer => 1, want_mailto => 1);
493 ok(run($amreport, 'TESTCONF', '-p', $out_filename), # XXX another probable bug
494 "amreport with mailer, mailto, but no template, ignores -p option ")
495 or diag($Installcheck::Run::stderr);
496 is($Installcheck::Run::stdout, "", "..produces no output");
497 results_match($mail_output,
498 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
500 ok(! -f $printer_output,
505 ok(run($amreport, 'TESTCONF', '-o', "tapetype:TEST-TAPE-TEMPLATE:lbl_templ=$ps_template",
506 '-p', $out_filename),
507 "amreport with mailer, mailto, but no template, minds -p option if template given via -o")
508 or diag($Installcheck::Run::stderr);
509 is($Installcheck::Run::stdout, "", "..produces no output");
510 results_match($mail_output,
511 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
513 results_match($out_filename,
514 $cat->get_text('postscript'),
515 "..printer output matches");
517 setup_config(catalog => 'normal',
518 bogus_mailer => 1, want_mailto => 1, want_template => 1);
520 ok(run($amreport, 'TESTCONF', '--from-amdump'),
521 "amreport with bogus mailer; doesn't mail, still prints")
522 or diag($Installcheck::Run::stderr);
523 ok(!-f $mail_output, "..produces no mail output");
524 is($Installcheck::Run::stdout, "", "..produces no stdout output");
527 like($Installcheck::Run::stderr,
528 qr/^error: the mailer '.*' is not an executable program\.$/,
529 "..produces correct stderr output");
532 $cat->get_text('postscript'),
533 "..printer output matches"
541 send_amreport => 'error'
545 run($amreport, 'TESTCONF', '--from-amdump'),
546 "amreport with CNF_SEND_AMREPORT_ON set to errors only, no mail, still prints"
547 ) or diag($Installcheck::Run::stderr);
548 ok(!-f $mail_output, "..produces no mail output") or diag(slurp $mail_output);
549 is($Installcheck::Run::stdout, "", "..produces no stdout output")
550 or diag($Installcheck::Run::stdout);
553 $cat->get_text('postscript'),
554 "..printer output matches"
557 ## test columnspec adjustments, etc.
559 setup_config(catalog => 'normal');
561 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=::2'),
562 "amreport with OrigKB=::2");
563 results_match($out_filename, $cat->get_text('rpt2'),
566 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5'),
567 "amreport with OrigKB=:5");
568 results_match($out_filename, $cat->get_text('rpt3'),
571 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5:6'),
572 "amreport with OrigKB=:5:6");
573 results_match($out_filename, $cat->get_text('rpt4'),
576 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'displayunit=m'),
577 "amreport with displayunit=m");
578 results_match($out_filename, $cat->get_text('rpt5'),
581 setup_config(catalog => 'doublefailure',
582 want_mailer => 1, want_template => 1);
584 ok(!run($amreport, 'TESTCONF', '-M', 'dustin'),
585 "amreport with log in error")
586 or diag($Installcheck::Run::stderr);
587 is($Installcheck::Run::stdout, "", "..produces no output");
588 results_match($mail_output,
589 make_mail($cat->get_text('report'), "DailySet1", 1, "March 26, 2009", "dustin"),
592 ## some (anonymized) real logfiles, for regression testing
594 setup_config(catalog => 'strontium', want_template => 1);
596 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
597 "amreport with strontium logfile (simple example with multiple levels)");
598 results_match($out_filename, $cat->get_text('report'),
600 results_match($printer_output,
601 $cat->get_text('postscript'),
602 "..printer output matches");
604 setup_config(catalog => 'amflush', want_template => 1);
606 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
607 "amreport with amflush logfile (regression check for flush-related DUMP STATUS)");
608 results_match($out_filename, $cat->get_text('report'),
610 results_match($printer_output,
611 $cat->get_text('postscript'),
612 "..printer output matches");
614 setup_config(catalog => 'resultsmissing', want_template => 1);
616 run($amreport, 'TESTCONF', '-f', $out_filename);
617 is($Installcheck::Run::exit_code, 12,
618 "amreport with resultsmissing logfile ('RESULTS MISSING') exit==12");
619 results_match($out_filename, $cat->get_text('report'),
621 results_match($printer_output,
622 $cat->get_text('postscript'),
623 "..printer output matches");
625 setup_config(catalog => 'shortstrange', want_template => 1);
627 run($amreport, 'TESTCONF', '-f', $out_filename);
628 is($Installcheck::Run::exit_code, 2,
629 "amreport with shortstrange logfile exit==2");
630 results_match($out_filename, $cat->get_text('report'),
632 results_match($printer_output,
633 $cat->get_text('postscript'),
634 "..printer output matches");
636 setup_config(catalog => 'longstrange', want_template => 1);
638 run($amreport, 'TESTCONF', '-f', $out_filename);
639 is($Installcheck::Run::exit_code, 2,
640 "amreport with longstrange logfile exit==2");
641 results_match($out_filename, $cat->get_text('report'),
644 setup_config(catalog => 'doublefailure', want_template => 1);
646 run($amreport, 'TESTCONF', '-f', $out_filename);
647 is($Installcheck::Run::exit_code, 4,
648 "amreport with doublefailure logfile exit==4");
649 results_match($out_filename, $cat->get_text('report'),
651 results_match($printer_output,
652 $cat->get_text('postscript'),
653 "..printer output matches");
655 setup_config(catalog => 'bigestimate', want_template => 1);
657 run($amreport, 'TESTCONF', '-f', $out_filename);
658 is($Installcheck::Run::exit_code, 0,
659 "amreport with bigestimate logfile exit==0");
660 results_match($out_filename, $cat->get_text('report'),
662 results_match($printer_output,
663 $cat->get_text('postscript'),
664 "..printer output matches");
666 setup_config(catalog => 'retried', want_template => 1);
668 run($amreport, 'TESTCONF', '-f', $out_filename);
669 is($Installcheck::Run::exit_code, 4,
670 "amreport with retried logfile exit==4");
671 results_match($out_filename, $cat->get_text('report'),
673 results_match($printer_output,
674 $cat->get_text('postscript'),
675 "..printer output matches");
677 setup_config(catalog => 'retried-strange');
679 run($amreport, 'TESTCONF', '-f', $out_filename);
680 is($Installcheck::Run::exit_code, 6,
681 "amreport with retried logfile, with strange exit==6");
682 results_match($out_filename, $cat->get_text('report'),
685 setup_config(catalog => 'retried-nofinish', want_template => 1);
687 run($amreport, 'TESTCONF', '-f', $out_filename);
688 is($Installcheck::Run::exit_code, 4,
689 "amreport with retried logfile where driver did not finish exit==4");
690 results_match($out_filename, $cat->get_text('report'),
693 setup_config(catalog => 'taperr', want_template => 1);
695 run($amreport, 'TESTCONF', '-f', $out_filename);
696 is($Installcheck::Run::exit_code, 16,
697 "amreport with taperr logfile exit==16");
698 results_match($out_filename, $cat->get_text('report-holding'),
700 ok((-f $printer_output and -z $printer_output),
701 "..printer output exists but is empty");
703 burp($alternate_log_filename, $cat->get_file('log/log'));
705 # use an explicit -l here so amreport doesn't try to look at the holding disk
706 run($amreport, 'TESTCONF', '-f', $out_filename, '-l', $alternate_log_filename);
707 is($Installcheck::Run::exit_code, 16,
708 "amreport with taperr logfile specified explicitly exit==16");
709 results_match($out_filename, $cat->get_text('report-noholding'),
712 setup_config(catalog => 'spanned', want_template => 1);
714 run($amreport, 'TESTCONF', '-f', $out_filename);
715 is($Installcheck::Run::exit_code, 0,
716 "amreport with spanned logfile");
717 results_match($out_filename, $cat->get_text('report'),
719 results_match($printer_output,
720 $cat->get_text('postscript'),
721 "..printer output matches");
723 setup_config(catalog => 'fatal', want_template => 1);
725 run($amreport, 'TESTCONF', '-f', $out_filename);
726 is($Installcheck::Run::exit_code, 5,
727 "amreport with fatal logfile");
728 results_match($out_filename, $cat->get_text('report'),
730 ok(-f $printer_output && -z $printer_output,
731 "..printer output is empty (no dumps, no tapes)");
733 setup_config(catalog => 'flush-origsize', want_template => 1);
735 run($amreport, 'TESTCONF', '-f', $out_filename);
736 is($Installcheck::Run::exit_code, 0,
737 "amreport with flush-origsize");
738 results_match($out_filename, $cat->get_text('report'),
741 setup_config(catalog => 'flush-noorigsize', want_template => 1);
743 run($amreport, 'TESTCONF', '-f', $out_filename);
744 is($Installcheck::Run::exit_code, 0,
745 "amreport with flush-noorigsize");
746 results_match($out_filename, $cat->get_text('report'),
749 setup_config(catalog => 'plannerfail', want_template => 1);
751 run($amreport, 'TESTCONF', '-f', $out_filename);
752 is($Installcheck::Run::exit_code, 4,
753 "amreport with a planner failure (failed)");
754 results_match($out_filename, $cat->get_text('report'),
757 setup_config(catalog => 'skipped', want_template => 1);
759 run($amreport, 'TESTCONF', '-f', $out_filename);
760 is($Installcheck::Run::exit_code, 0,
761 "amreport with a planner skipped dump (success)");
762 results_match($out_filename, $cat->get_text('report'),
765 setup_config(catalog => 'filesystemstaped', want_template => 1, runtapes => 3, tapecycle => 5);
767 run($amreport, 'TESTCONF', '-f', $out_filename);
768 is($Installcheck::Run::exit_code, 0,
769 "amreport correctly report filesystem taped (success)");
770 results_match($out_filename, $cat->get_text('report'),
773 setup_config(catalog => 'multi-taper', want_template => 0);
775 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
776 my $logdir = getconf($CNF_LOGDIR);
777 my $logfile = $logdir . "/log.20100908110856.0";
778 run($amreport, 'TESTCONF', '-l', $logfile, '-f', $out_filename, '-o', 'TAPETYPE:TEST-TAPE-TEMPLATE:length=41m');
779 is($Installcheck::Run::exit_code, 0,
780 "amreport correctly report multi-taper (success)");
781 results_match($out_filename, $cat->get_text('report'),