Changeset 3243 in MondoRescue for branches/3.2


Ignore:
Timestamp:
Jan 22, 2014, 8:36:12 PM (10 years ago)
Author:
Bruno Cornec
Message:
  • The test function of MondoRescue is now also working for distros not having natively Test::More and avoid to depend on it
File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/3.2/MondoRescue/t/01-read-all-link.t

    r3228 r3243  
    11#!/usr/bin/perl -w
    2 use Test::More 'no_plan';
    32use File::Temp qw/ tempdir /;
    43use File::Copy;
     
    5857    );
    5958
     59my $more = 1;
     60
     61eval
     62{
     63        require Test::More;
     64        Test::More->import();
     65        no_plan();
     66};
     67# Test::More not found so simpler test
     68if ($@) {
     69        require Test;
     70        Test->import();
     71        $more = 0;
     72        plan(tests => 12);
     73}
    6074    # Got, expected, comment
    61 is(@{$h->{"$bd/usr/bin/toto"}}[0], "$bd/usr/bin/toto", "File link in same dir to itself");
    62 is(@{$h->{"$bd/usr/bin/toto"}}[1], "$bd/usr/bin/perl", "File link in same dir to link");
    63 is(@{$h->{"$bd/var/truc"}}[0], "$bd/var/truc", "File link in another absolute dir to itself");
    64 is(@{$h->{"$bd/var/truc"}}[1], "$bd/usr/bin/perl", "File link in another absolute dir to link");
    65 is(@{$h->{"$bd/var/spool/toto"}}[0], "$bd/var/spool/toto", "File link in another relative dir to itself");
    66 is(@{$h->{"$bd/var/spool/toto"}}[1], "$bd/usr/bin/perl", "File link in another relative dir to link");
    67 is(@{$h->{"$bd/var/spool/titi"}}[0], "$bd/var/spool/titi", "Directory link in same dir to itself");
    68 is(@{$h->{"$bd/var/spool/titi"}}[1], "$bd/var/spool/mail", "Directory link in same dir to link");
    69 is(@{$h->{"$bd/var/lib/titi"}}[0], "$bd/var/lib/titi", "Directory link in another relative dir to itself");
    70 is(@{$h->{"$bd/var/lib/titi"}}[1], "$bd/var/spool/mail", "Directory link in another relative dir to link");
    71 is(@{$h->{"$bd/var/tutu"}}[0], "$bd/var/tutu", "Directory link in another absolute dir to itself");
    72 is(@{$h->{"$bd/var/tutu"}}[1], "$bd/var/spool/mail", "Directory link in another absolute dir to link");
     75myis(@{$h->{"$bd/usr/bin/toto"}}[0], "$bd/usr/bin/toto", "File link in same dir to itself");
     76myis(@{$h->{"$bd/usr/bin/toto"}}[1], "$bd/usr/bin/perl", "File link in same dir to link");
     77myis(@{$h->{"$bd/var/truc"}}[0], "$bd/var/truc", "File link in another absolute dir to itself");
     78myis(@{$h->{"$bd/var/truc"}}[1], "$bd/usr/bin/perl", "File link in another absolute dir to link");
     79myis(@{$h->{"$bd/var/spool/toto"}}[0], "$bd/var/spool/toto", "File link in another relative dir to itself");
     80myis(@{$h->{"$bd/var/spool/toto"}}[1], "$bd/usr/bin/perl", "File link in another relative dir to link");
     81myis(@{$h->{"$bd/var/spool/titi"}}[0], "$bd/var/spool/titi", "Directory link in same dir to itself");
     82myis(@{$h->{"$bd/var/spool/titi"}}[1], "$bd/var/spool/mail", "Directory link in same dir to link");
     83myis(@{$h->{"$bd/var/lib/titi"}}[0], "$bd/var/lib/titi", "Directory link in another relative dir to itself");
     84myis(@{$h->{"$bd/var/lib/titi"}}[1], "$bd/var/spool/mail", "Directory link in another relative dir to link");
     85myis(@{$h->{"$bd/var/tutu"}}[0], "$bd/var/tutu", "Directory link in another absolute dir to itself");
     86myis(@{$h->{"$bd/var/tutu"}}[1], "$bd/var/spool/mail", "Directory link in another absolute dir to link");
    7387chdir "/tmp";
    7488exit(0);
     89
     90sub myis {
     91
     92if ($more eq 1) {
     93    return(is(@_));
     94} else {
     95    my $p1 = shift;
     96    my $p2 = shift;
     97    my $p3 = shift;
     98    print "# test $p3\n";
     99    return(ok($p1,$p2));
     100}
     101}
     102
Note: See TracChangeset for help on using the changeset viewer.