summaryrefslogtreecommitdiffstats
path: root/libtests/qtest/logger.test
blob: 786af4fb269f605c61eb21d12556cd29b4810cec (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/env perl
require 5.008;
use warnings;
use strict;

chdir("logger") or die "chdir testdir failed: $!\n";

require TestDriver;

my $td = new TestDriver('logger');

cleanup();

$td->runtest("logger",
             {$td->COMMAND => "logger >stdout 2>stderr"},
             {$td->STRING => "", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check stdout",
             {$td->FILE => "stdout"},
             {$td->FILE => "exp-stdout"},
             $td->NORMALIZE_NEWLINES);
$td->runtest("check stderr",
             {$td->FILE => "stderr"},
             {$td->FILE => "exp-stderr"},
             $td->NORMALIZE_NEWLINES);

$td->runtest("logger C API",
             {$td->COMMAND => "logger_c >stdout 2>stderr"},
             {$td->STRING => "", $td->EXIT_STATUS => 0},
             $td->NORMALIZE_NEWLINES);
foreach my $f (qw(stdout stderr info warn error save save2))
{
    $td->runtest("check $f (C)",
                 {$td->FILE => "$f"},
                 {$td->FILE => "c-exp-$f"},
                 $td->NORMALIZE_NEWLINES);
}

cleanup();
$td->report(11);

sub cleanup
{
    unlink "stdout", "stderr", "info", "warn", "error", "save", "save2";
}