aboutsummaryrefslogtreecommitdiffstats
path: root/test_iso.pl
blob: 2a650eb699d26bfe74add3033f6ffc356f3f5bb9 (plain)
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
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/perl -w 
#

use 5.010;
use MDK::Common;
use TAP::Harness;
use Tools;

my ($image_path) = @ARGV;

if (!defined $image_path) {
    print "Usage: ./test_iso.pl [ISO file]\nTry `./test_iso.pl --help' for more information.\n";
    exit;
}

my $harness = TAP::Harness->new({
    formatter_class => 'TAP::Formatter::Console',
    merge           => 1,
    verbosity       => 1,
    normalize       => 1,
    color           => 1,
    test_args       => [
        $image_path,
        "Testing"
    ]
});

print "# Date:    ", `date --rfc-3339='ns' -u`;
print "# Testing: $image_path\n";
print "# Host:    ", `uname -n`;

$harness->runtests(<./t/*.t>);

# Mounting the ISO
print "# Mounting ISO in /media/iso_check";
-r "/media/iso_check" or system 'mkdir /media/iso_check';
system "mount -r " . if_(!-b $image_path, "-o loop ") . "$image_path /media/iso_check/";
print "... ok\n";

my $name = basename($image_path);
my %info = Tools::parse_mageia_iso_name($name);

# FIXME the difference is actually regular versus LiveCD
if ($info{"medium"} eq "DVD") {
    $harness->runtests(<./t_install_iso/*.t>);
} elsif ($info{"medium"} eq "CD") {
    # LiveCD specific
    # CD specific
}

# Umounting the ISO
print "# Umounting ISO\n";
# FIXME this fails sometimes; no idea why. Force umount?
system 'umount /media/iso_check';
system 'rm -r /media/iso_check';
print "... ok\n";
print "# Date: ", `date --rfc-3339='ns' -u`;
print "# Test is over.\n";