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 => 166;
24 use lib "@amperldir@";
27 use Installcheck::Run qw( run run_get run_err );
28 use Installcheck::Catalogs;
30 use Amanda::Constants;
31 use Amanda::Util qw( slurp burp );
33 use Amanda::Config qw ( :init :getconf );
35 # easy knob to twiddle to check amreport_new instead
36 my $amreport = "amreport";
38 Amanda::Debug::dbopen("installcheck");
39 Installcheck::log_test_output();
41 # we use Text::Diff for diagnostics if it's installed
44 eval "use Text::Diff;";
52 # set up a fake "printer" for postscript output
53 my $printer_output = "$Installcheck::TMP/postscript-output";
54 $ENV{'INSTALLCHECK_MOCK_LPR_OUTPUT'} = $printer_output;
55 $ENV{'INSTALLCHECK_MOCK_LPR'} = abs_path("mock") . "/lpr";
58 my $ps_template = "$Installcheck::TMP/postscript-template";
59 burp($ps_template, "--PS-TEMPLATE--\n");
61 # and a fake "mail" for email output
62 my $mail_output = "$Installcheck::TMP/mail-output";
63 $ENV{'INSTALLCHECK_MOCK_MAIL_OUTPUT'} = $mail_output;
64 my $mail_mock = abs_path("mock") . "/mail";
67 my $alternate_log_filename="$Installcheck::TMP/installcheck-log";
68 my $current_log_filename="$Installcheck::CONFIG_DIR/TESTCONF/log/log";
69 my $out_filename="$Installcheck::TMP/installcheck-amreport-output";
73 my $testconf = Installcheck::Run::setup();
78 $params{want_mailer} ? "\"$mail_mock\""
79 : $params{bogus_mailer} ? "\"$mail_mock.bogus\""
82 $testconf->add_param('mailer', $mailer);
83 $testconf->add_param('mailto',
84 $params{want_mailto} ? '"nobody\@localhost"' : '""');
86 $testconf->add_tapetype('TEST-TAPE-TEMPLATE', [
87 'length' => '30 mbytes',
88 'filemark' => '4 kbytes',
89 $params{'want_template'}? ('lbl_templ' => "\"$ps_template\""):(),
91 $testconf->add_param('tapetype', "\"TEST-TAPE-TEMPLATE\"");
93 $testconf->remove_param('send_amreport_on');
94 $testconf->add_param('send_amreport_on',
95 exists $params{send_amreport} ? uc($params{send_amreport}) : "ALL"
98 if (defined $params{'runtapes'}) {
99 $testconf->remove_param('runtapes');
100 $testconf->add_param('runtapes', $params{'runtapes'});
102 if (defined $params{'tapecycle'}) {
103 $testconf->remove_param('tapecycle');
104 $testconf->add_param('tapecycle', $params{'tapecycle'});
110 if ($params{'catalog'}) {
111 $cat = Installcheck::Catalogs::load($params{'catalog'});
117 unlink $out_filename;
119 unlink $printer_output;
120 unlink $alternate_log_filename;
123 # compare two multiline strings, giving a diff if they do not match
126 my ( $a_filename, $b, $msg ) = @_;
128 if ($a_filename eq 'stdout') {
129 $a = $Installcheck::Run::stdout;
131 diag("stdout is empty");
136 if (!-f $a_filename) {
137 diag("'$a_filename' does not exist");
141 $a = slurp($a_filename);
144 my $is_ps = ($b =~ m/^--PS-TEMPLATE--/);
150 # strip out special characters
154 # old amreport underquotes the postscript strings
155 $str =~ s{\\\(}{(}mgx;
156 $str =~ s{\\\)}{)}mgx;
158 # make human report insensitive to whitespace differences
159 $str =~ s{[\t ]+}{ }mgx;
160 $str =~ s{\s*\n[\n ]*\s*}{\n}mgx;
163 # chomp the version lines
164 $str =~ s{\n\(brought to you by Amanda version .*$}{\n<versioninfo>}g;
165 $str =~ s{\(Amanda Version .*\) DrawVers}{(Amanda Version x.y.z) DrawVers}g;
177 if ($have_text_diff) {
178 $diff = diff( \$a, \$b, { 'STYLE' => "Unified" } );
180 $diff = "---- GOT: ----\n$a\n---- EXPECTED: ----\n$b\n---- ----";
187 # convert a regular report into what we expect to see in a mail
189 my ($report, $config, $error, $date, $addr) = @_;
191 $error_msg = " FAIL:" if $error;
192 return <<EOF . $report;
193 \$ARGS = ['-s','$config${error_msg} AMANDA MAIL REPORT FOR $date','$addr'];
197 ## try a few various options with a pretty normal logfile. Note that
198 ## these tests all use amreport's script mode
200 setup_config(catalog => 'normal',
201 want_mailer => 1, want_mailto => 1, want_template => 1);
203 like(run_err($amreport, 'TESTCONF-NOSUCH'),
204 qr/could not open conf/,
205 "amreport with bogus config exits with error status and error message");
207 ok(!run($amreport, 'TESTCONF-NOSUCH', '--help'),
208 "amreport --help exits with status 1");
209 like($Installcheck::Run::stdout,
210 qr/Usage: amreport \[--version\]/,
211 "..and prints usage message");
213 like(run_get($amreport, 'TESTCONF-NOSUCH', '--version'),
215 "amreport --version gives version");
217 ok(run($amreport, 'TESTCONF', '--from-amdump'),
218 "amreport, as run from amdump, with mailer, mailto, and a template")
219 or diag($Installcheck::Run::stderr);
221 is($Installcheck::Run::stdout, "", "..produces no output");
222 results_match($mail_output,
223 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
226 results_match($printer_output,
227 $cat->get_text('postscript'),
228 "..printer output matches");
230 ok(run($amreport, 'TESTCONF', '--from-amdump', '/garbage/directory/'),
231 "amreport, as run from amdump, with mailer, mailto, and a template, and bogus option")
232 or diag($Installcheck::Run::stderr);
233 is($Installcheck::Run::stdout, "", "..produces no output");
234 results_match($mail_output,
235 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
237 results_match($printer_output,
238 $cat->get_text('postscript'),
239 "..printer output matches");
243 ok(run($amreport, 'TESTCONF', '-M', 'somebody@localhost'),
244 "amreport -M, with mailer, mailto, and a template")
245 or diag($Installcheck::Run::stderr);
246 is($Installcheck::Run::stdout, "", "..produces no output");
247 results_match($mail_output,
248 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "somebody\@localhost"),
250 results_match($printer_output,
251 $cat->get_text('postscript'),
252 "..printer output matches");
256 ok(run($amreport, 'TESTCONF', '-i'),
257 "amreport -i, with mailer, mailto, and a template => no error");
258 ok(! -f $mail_output,
260 ok(! -f $printer_output,
265 ok(run($amreport, 'TESTCONF', '-p', $out_filename),
266 "amreport -p, with mailer, mailto, and a template")
267 or diag($Installcheck::Run::stderr);
268 is($Installcheck::Run::stdout, "", "..produces no output");
269 results_match($mail_output,
270 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
272 ok(! -f $printer_output,
274 results_match($out_filename, $cat->get_text('postscript'), "..postscript file matches");
276 # test a bare 'amreport', which should now output to stdout
279 ok(run($amreport, 'TESTCONF'),
280 "amreport with no other options outputs to stdout for user convenience")
281 or diag($Installcheck::Run::stderr);
282 results_match('stdout', $cat->get_text('rpt1'),
284 ok(!-f $printer_output, "..no printer output")
285 or diag("error: printer output!:\n" . burp($printer_output));
286 ok(!-f $mail_output, "..no mail output")
287 or diag("error: mail output!:\n" . burp($printer_output));
289 # test long-form file option
292 ok(run($amreport, 'TESTCONF', "--text=$out_filename"),
293 "amreport --text=foo, no other options")
294 or diag($Installcheck::Run::stderr);
295 results_match($out_filename, $cat->get_text('rpt1'),
297 ok(!-f $printer_output, "..no printer output")
298 or diag("error: printer output!:\n" . burp($printer_output));
299 ok(!-f $mail_output, "..no mail output")
300 or diag("error: mail output!:\n" . burp($printer_output));
302 # test long form postscript option
306 run($amreport, 'TESTCONF', '--ps', $out_filename),
307 "amreport --ps foo, no other options"
309 results_match($out_filename, $cat->get_text('postscript'), '..results match');
310 ok(!-f $printer_output, "..no printer output");
311 ok(!-f $mail_output, "..no mail output");
315 # test new mail option, using config mailto
316 setup_config(catalog => 'normal',
317 want_mailer => 1, want_mailto => 1, want_template => 1);
319 ok(run($amreport, 'TESTCONF', '--mail-text'),
320 "amreport --mail-text, no other options, built-in mailto");
324 $cat->get_text('rpt1'), "DailySet1", 0,
325 "February 25, 2009", "nobody\@localhost"
329 ok(!-f $printer_output, "..no printer output");
330 ok(!-f $out_filename, "..no file output");
334 # test new mail option, using passed mailto
335 ok(run($amreport, 'TESTCONF', '--mail-text=somebody@localhost',),
336 'amreport --mail-text=somebody\@localhost, no other options');
340 $cat->get_text('rpt1'), "DailySet1", 0,
341 "February 25, 2009", "somebody\@localhost"
345 ok(!-f $printer_output, "..no printer output");
346 ok(!-f $out_filename, "..no file output");
350 # test long-form log option
351 burp($alternate_log_filename, $cat->get_file('log/log'));
353 run($amreport, 'TESTCONF', '--log', $alternate_log_filename),
354 "amreport --log with old log, no other config options"
356 results_match('stdout', $cat->get_text('rpt1'),
357 '..stdout output matches');
358 ok(!-f $mail_output, "..no mail output");
359 ok(!-f $out_filename, "..no file output");
360 ok(!-f $printer_output, "..no printer output");
364 # test long-form print option, without specified printer
365 setup_config(catalog => 'normal', want_template => 1);
366 ok(run($amreport, 'TESTCONF', '--print'),
367 'amreport --print, no other options');
370 $cat->get_text('postscript'),
371 "..printer output matches"
373 ok(!-f $mail_output, "..no mail output");
374 ok(!-f $out_filename, "..no file output");
378 setup_config(catalog => 'normal',
379 want_mailer => 1, want_mailto => 1, want_template => 1);
380 ok(run($amreport, 'TESTCONF', '-i', '-p', $out_filename),
381 "amreport -i -p, with mailer, mailto, and a template")
382 or diag($Installcheck::Run::stderr);
383 is($Installcheck::Run::stdout, "", "..produces no output");
384 ok(! -f $mail_output,
385 "..produces no mail");
386 ok(! -f $printer_output,
388 results_match($out_filename,
389 $cat->get_text('postscript'),
390 "..postscript output in -p file matches");
394 ok(run($amreport, 'TESTCONF', '-i', '-f', $out_filename),
395 "amreport -i -f, with mailer, mailto, and a template")
396 or diag($Installcheck::Run::stderr);
397 is($Installcheck::Run::stdout, "", "..produces no output");
398 ok(! -f $mail_output,
399 "..produces no mail");
400 results_match($printer_output,
401 $cat->get_text('postscript'),
402 "..printer output matches");
403 results_match($out_filename,
404 $cat->get_text('rpt1'),
405 "..report output in -f file matches");
409 burp($alternate_log_filename, $cat->get_file('log/log'));
410 ok(run($amreport, 'TESTCONF', '-l', $alternate_log_filename),
411 "amreport -l, with mailer, mailto, and a template")
412 or diag($Installcheck::Run::stderr);
413 is($Installcheck::Run::stdout, "", "..produces no output");
414 results_match($mail_output,
415 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
417 results_match($printer_output,
418 $cat->get_text('postscript'),
419 "..printer output matches");
421 setup_config(catalog => 'normal',
424 ok(run($amreport, 'TESTCONF', '--from-amdump'),
425 "amreport --from-amdump, with mailer but no mailto and no template => exit==0");
426 ok(! -f $mail_output, "..doesn't mail");
427 ok(! -f $printer_output, "..doesn't print");
431 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=hello'),
432 "amreport -o to set mailto, with mailer but no mailto and no template")
433 or diag($Installcheck::Run::stderr);
434 is($Installcheck::Run::stdout, "", "..produces no output");
435 results_match($mail_output,
436 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "hello"),
438 ok(! -f $printer_output,
443 like(run_err($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=ill\egal'),
444 qr/mail addresses have invalid characters/,
445 "amreport with illegal email in -o, with mailer but no mailto and no template, errors out");
447 setup_config(catalog => 'normal',
448 want_mailer => 1, want_template => 1);
450 ok(run($amreport, 'TESTCONF', '--from-amdump'),
451 "no-args amreport with mailer, no mailto, and a template does nothing even though it could "
452 . "print a label"); # arguably a bug, but we'll keep it for now
453 ok(! -f $mail_output, "..doesn't mail");
454 ok(! -f $printer_output, "..doesn't print");
458 ok(run($amreport, 'TESTCONF', '--from-amdump', '-o', 'mailto=dustin'),
459 "amreport with mailer, no mailto, and a template, but mailto in config override works")
460 or diag($Installcheck::Run::stderr);
461 is($Installcheck::Run::stdout, "", "..produces no output");
462 results_match($mail_output,
463 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "dustin"),
465 results_match($printer_output,
466 $cat->get_text('postscript'),
467 "..printer output matches");
469 ok(run($amreport, 'TESTCONF', '-M', 'pcmantz'),
470 "amreport with mailer, no mailto, and a template, but mailto in -M works")
471 or diag($Installcheck::Run::stderr);
472 is($Installcheck::Run::stdout, "", "..produces no output");
473 results_match($mail_output,
474 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "pcmantz"),
476 results_match($printer_output,
477 $cat->get_text('postscript'),
478 "..printer output matches");
480 setup_config(catalog => 'normal', want_template => 1);
482 like(run_get($amreport, 'TESTCONF', '-M', 'martineau'),
483 qr/Warning: a mailer is not defined/,
484 "amreport with no mailer, no mailto, and a template, but mailto in -M fails with "
485 . "warning, but exit==0");
486 ok(! -f $mail_output, "..doesn't mail");
487 ok(! -f $printer_output, "..doesn't print");
489 setup_config(catalog => 'normal',
490 want_mailer => 1, want_mailto => 1);
492 ok(run($amreport, 'TESTCONF', '-p', $out_filename), # XXX another probable bug
493 "amreport with mailer, mailto, but no template, ignores -p option ")
494 or diag($Installcheck::Run::stderr);
495 is($Installcheck::Run::stdout, "", "..produces no output");
496 results_match($mail_output,
497 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
499 ok(! -f $printer_output,
504 ok(run($amreport, 'TESTCONF', '-o', "tapetype:TEST-TAPE-TEMPLATE:lbl_templ=$ps_template",
505 '-p', $out_filename),
506 "amreport with mailer, mailto, but no template, minds -p option if template given via -o")
507 or diag($Installcheck::Run::stderr);
508 is($Installcheck::Run::stdout, "", "..produces no output");
509 results_match($mail_output,
510 make_mail($cat->get_text('rpt1'), "DailySet1", 0, "February 25, 2009", "nobody\@localhost"),
512 results_match($out_filename,
513 $cat->get_text('postscript'),
514 "..printer output matches");
516 setup_config(catalog => 'normal',
517 bogus_mailer => 1, want_mailto => 1, want_template => 1);
519 ok(run($amreport, 'TESTCONF', '--from-amdump'),
520 "amreport with bogus mailer; doesn't mail, still prints")
521 or diag($Installcheck::Run::stderr);
522 ok(!-f $mail_output, "..produces no mail output");
523 is($Installcheck::Run::stdout, "", "..produces no stdout output");
526 $cat->get_text('postscript'),
527 "..printer output matches"
535 send_amreport => 'error'
539 run($amreport, 'TESTCONF', '--from-amdump'),
540 "amreport with CNF_SEND_AMREPORT_ON set to errors only, no mail, still prints"
541 ) or diag($Installcheck::Run::stderr);
542 ok(!-f $mail_output, "..produces no mail output") or diag(slurp $mail_output);
543 is($Installcheck::Run::stdout, "", "..produces no stdout output")
544 or diag($Installcheck::Run::stdout);
547 $cat->get_text('postscript'),
548 "..printer output matches"
551 ## test columnspec adjustments, etc.
553 setup_config(catalog => 'normal');
555 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=::2'),
556 "amreport with OrigKB=::2");
557 results_match($out_filename, $cat->get_text('rpt2'),
560 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5'),
561 "amreport with OrigKB=:5");
562 results_match($out_filename, $cat->get_text('rpt3'),
565 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'columnspec=OrigKB=:5:6'),
566 "amreport with OrigKB=:5:6");
567 results_match($out_filename, $cat->get_text('rpt4'),
570 ok(run($amreport, 'TESTCONF', '-f', $out_filename, '-o', 'displayunit=m'),
571 "amreport with displayunit=m");
572 results_match($out_filename, $cat->get_text('rpt5'),
575 setup_config(catalog => 'doublefailure',
576 want_mailer => 1, want_template => 1);
578 ok(!run($amreport, 'TESTCONF', '-M', 'dustin'),
579 "amreport with log in error")
580 or diag($Installcheck::Run::stderr);
581 is($Installcheck::Run::stdout, "", "..produces no output");
582 results_match($mail_output,
583 make_mail($cat->get_text('report'), "DailySet1", 1, "March 26, 2009", "dustin"),
586 ## some (anonymized) real logfiles, for regression testing
588 setup_config(catalog => 'strontium', want_template => 1);
590 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
591 "amreport with strontium logfile (simple example with multiple levels)");
592 results_match($out_filename, $cat->get_text('report'),
594 results_match($printer_output,
595 $cat->get_text('postscript'),
596 "..printer output matches");
598 setup_config(catalog => 'amflush', want_template => 1);
600 ok(run($amreport, 'TESTCONF', '-f', $out_filename),
601 "amreport with amflush logfile (regression check for flush-related DUMP STATUS)");
602 results_match($out_filename, $cat->get_text('report'),
604 results_match($printer_output,
605 $cat->get_text('postscript'),
606 "..printer output matches");
608 setup_config(catalog => 'resultsmissing', want_template => 1);
610 run($amreport, 'TESTCONF', '-f', $out_filename);
611 is($Installcheck::Run::exit_code, 12,
612 "amreport with resultsmissing logfile ('RESULTS MISSING') exit==12");
613 results_match($out_filename, $cat->get_text('report'),
615 results_match($printer_output,
616 $cat->get_text('postscript'),
617 "..printer output matches");
619 setup_config(catalog => 'shortstrange', want_template => 1);
621 run($amreport, 'TESTCONF', '-f', $out_filename);
622 is($Installcheck::Run::exit_code, 2,
623 "amreport with shortstrange logfile exit==2");
624 results_match($out_filename, $cat->get_text('report'),
626 results_match($printer_output,
627 $cat->get_text('postscript'),
628 "..printer output matches");
630 setup_config(catalog => 'longstrange', want_template => 1);
632 run($amreport, 'TESTCONF', '-f', $out_filename);
633 is($Installcheck::Run::exit_code, 2,
634 "amreport with longstrange logfile exit==2");
635 results_match($out_filename, $cat->get_text('report'),
638 setup_config(catalog => 'doublefailure', want_template => 1);
640 run($amreport, 'TESTCONF', '-f', $out_filename);
641 is($Installcheck::Run::exit_code, 4,
642 "amreport with doublefailure logfile exit==4");
643 results_match($out_filename, $cat->get_text('report'),
645 results_match($printer_output,
646 $cat->get_text('postscript'),
647 "..printer output matches");
649 setup_config(catalog => 'bigestimate', want_template => 1);
651 run($amreport, 'TESTCONF', '-f', $out_filename);
652 is($Installcheck::Run::exit_code, 0,
653 "amreport with bigestimate logfile exit==0");
654 results_match($out_filename, $cat->get_text('report'),
656 results_match($printer_output,
657 $cat->get_text('postscript'),
658 "..printer output matches");
660 setup_config(catalog => 'retried', want_template => 1);
662 run($amreport, 'TESTCONF', '-f', $out_filename);
663 is($Installcheck::Run::exit_code, 4,
664 "amreport with retried logfile exit==4");
665 results_match($out_filename, $cat->get_text('report'),
667 results_match($printer_output,
668 $cat->get_text('postscript'),
669 "..printer output matches");
671 setup_config(catalog => 'retried-strange');
673 run($amreport, 'TESTCONF', '-f', $out_filename);
674 is($Installcheck::Run::exit_code, 6,
675 "amreport with retried logfile, with strange exit==6");
676 results_match($out_filename, $cat->get_text('report'),
679 setup_config(catalog => 'retried-nofinish', want_template => 1);
681 run($amreport, 'TESTCONF', '-f', $out_filename);
682 is($Installcheck::Run::exit_code, 4,
683 "amreport with retried logfile where driver did not finish exit==4");
684 results_match($out_filename, $cat->get_text('report'),
687 setup_config(catalog => 'taperr', want_template => 1);
689 run($amreport, 'TESTCONF', '-f', $out_filename);
690 is($Installcheck::Run::exit_code, 16,
691 "amreport with taperr logfile exit==16");
692 results_match($out_filename, $cat->get_text('report-holding'),
694 ok((-f $printer_output and -z $printer_output),
695 "..printer output exists but is empty");
697 burp($alternate_log_filename, $cat->get_file('log/log'));
699 # use an explicit -l here so amreport doesn't try to look at the holding disk
700 run($amreport, 'TESTCONF', '-f', $out_filename, '-l', $alternate_log_filename);
701 is($Installcheck::Run::exit_code, 16,
702 "amreport with taperr logfile specified explicitly exit==16");
703 results_match($out_filename, $cat->get_text('report-noholding'),
706 setup_config(catalog => 'spanned', want_template => 1);
708 run($amreport, 'TESTCONF', '-f', $out_filename);
709 is($Installcheck::Run::exit_code, 0,
710 "amreport with spanned logfile");
711 results_match($out_filename, $cat->get_text('report'),
713 results_match($printer_output,
714 $cat->get_text('postscript'),
715 "..printer output matches");
717 setup_config(catalog => 'fatal', want_template => 1);
719 run($amreport, 'TESTCONF', '-f', $out_filename);
720 is($Installcheck::Run::exit_code, 5,
721 "amreport with fatal logfile");
722 results_match($out_filename, $cat->get_text('report'),
724 ok(-f $printer_output && -z $printer_output,
725 "..printer output is empty (no dumps, no tapes)");
727 setup_config(catalog => 'flush-origsize', want_template => 1);
729 run($amreport, 'TESTCONF', '-f', $out_filename);
730 is($Installcheck::Run::exit_code, 0,
731 "amreport with flush-origsize");
732 results_match($out_filename, $cat->get_text('report'),
735 setup_config(catalog => 'flush-noorigsize', want_template => 1);
737 run($amreport, 'TESTCONF', '-f', $out_filename);
738 is($Installcheck::Run::exit_code, 0,
739 "amreport with flush-noorigsize");
740 results_match($out_filename, $cat->get_text('report'),
743 setup_config(catalog => 'plannerfail', want_template => 1);
745 run($amreport, 'TESTCONF', '-f', $out_filename);
746 is($Installcheck::Run::exit_code, 4,
747 "amreport with a planner failure (failed)");
748 results_match($out_filename, $cat->get_text('report'),
751 setup_config(catalog => 'skipped', want_template => 1);
753 run($amreport, 'TESTCONF', '-f', $out_filename);
754 is($Installcheck::Run::exit_code, 0,
755 "amreport with a planner skipped dump (success)");
756 results_match($out_filename, $cat->get_text('report'),
759 setup_config(catalog => 'filesystemstaped', want_template => 1, runtapes => 3, tapecycle => 5);
761 run($amreport, 'TESTCONF', '-f', $out_filename);
762 is($Installcheck::Run::exit_code, 0,
763 "amreport correctly report filesystem taped (success)");
764 results_match($out_filename, $cat->get_text('report'),
767 setup_config(catalog => 'multi-taper', want_template => 0);
769 config_init($CONFIG_INIT_EXPLICIT_NAME, "TESTCONF");
770 my $logdir = getconf($CNF_LOGDIR);
771 my $logfile = $logdir . "/log.20100908110856.0";
772 run($amreport, 'TESTCONF', '-l', $logfile, '-f', $out_filename, '-o', 'TAPETYPE:TEST-TAPE-TEMPLATE:length=41m');
773 is($Installcheck::Run::exit_code, 0,
774 "amreport correctly report multi-taper (success)");
775 results_match($out_filename, $cat->get_text('report'),