aboutsummaryrefslogtreecommitdiffstats
path: root/t
diff options
context:
space:
mode:
authorRomain d'Alverny <rda@mageia.org>2011-12-10 17:15:07 +0000
committerRomain d'Alverny <rda@mageia.org>2011-12-10 17:15:07 +0000
commit55986d1758d7ae948c0bed1645ae49ca7103f96e (patch)
tree38624eb4a45e361d04ab8c33deedd2157a6e065a /t
parent0444424cedca29eeb827211445e5221d8879f2fd (diff)
downloadisocheck-55986d1758d7ae948c0bed1645ae49ca7103f96e.tar
isocheck-55986d1758d7ae948c0bed1645ae49ca7103f96e.tar.gz
isocheck-55986d1758d7ae948c0bed1645ae49ca7103f96e.tar.bz2
isocheck-55986d1758d7ae948c0bed1645ae49ca7103f96e.tar.xz
isocheck-55986d1758d7ae948c0bed1645ae49ca7103f96e.zip
add isoinfo check infra - need proper definitions yet
Diffstat (limited to 't')
-rw-r--r--t/001_check_file.t43
1 files changed, 27 insertions, 16 deletions
diff --git a/t/001_check_file.t b/t/001_check_file.t
index e521eee..bd4a000 100644
--- a/t/001_check_file.t
+++ b/t/001_check_file.t
@@ -26,7 +26,7 @@ use Tools;
my ($image_path) = @ARGV;
my $name = basename($image_path);
-my %info = ();
+my %info;
bail_on_fail;
@@ -54,10 +54,10 @@ my @size_name = split(/\t/, $du);
my $size = $size_name[0];
# Correct sizes: CD == 700MB & DVD == 4,700.373MB
-my %max_sizes = ( "CD" => "700MB", "DVD" => "4700MB" );
-ok ($size le $max_sizes{$info{"medium"}},
+my %max_sizes = ("CD" => "700MB", "DVD" => "4700MB");
+ok $size le $max_sizes{$info{medium}},
sprintf("File has a working size (%s) for its medium type (%s, max %s).",
- $size, $info{"medium"}, $max_sizes{$info{"medium"}}));
+ $size, $info{medium}, $max_sizes{$info{medium}});
#
ok -r $image_path . '.md5', 'MD5 checksum is available.';
@@ -79,25 +79,36 @@ my @ts = split(/ /, `md5sum $image_path`);
my $md5 = $ts[0];
@ts = split(/ /, `cat $md5file`);
$md5file = $ts[0];
-is ($md5, $md5file, 'MD5/.md5 checksums match.');
+is($md5, $md5file, 'MD5/.md5 checksums match.');
@ts = split(/ /, `sha1sum $image_path`);
my $sha1 = $ts[0];
@ts = split(/ /, `cat $sha1file`);
$sha1file = $ts[0];
-is ($sha1, $sha1file, 'SHA1/.sha1 checksums match.');
-
-
-# inspect iso definition
-my $volume_id = `isoinfo -d -i $image_path | grep "Volume id"`;
-my @info = (0, 0, 0, 0);
-my @temp = split(/ /, $volume_id);
-
-note ('TODO, test to check here!');
+is $sha1, $sha1file, 'SHA1/.sha1 checksums match.';
+
+
+# check ISO header info
+# Check (see http://wiki.mandriva.com/en/Product_id)
+my $isoinfo = `isoinfo -d -i $image_path`;
+my %isoValues = (
+ "System id", "LINUX",
+ "Volume id", "$info{name} $info{version} $info{release}", # TODO not defined for sure yet
+ "Volume set id", "$info{name} $info{version} $info{release} $info{variant} $info{arch} $info{medium}", # TODO $info{'build'} ?
+ "Publisher id", "Mageia.Org",
+ "Data preparer id", "?",
+ "Application id", "http://code.mageia.org/bcd/",
+ "Copyright file id", "http://www.mageia.org/2/license/",
+ "Abstract file id", "http://www.mageia.org/2/"
+);
+
+while (my ($k, $v) = each(%isoValues)) {
+ is `printf "%s\n" "$info" | grep -i "$k:"`, "$k: $v", "$k is correct.";
+}
# bootable?
-ok (`isoinfo -d -i $image_path | grep bootable`, 'ISO is bootable.');
+ok(`isoinfo -d -i $image_path | grep bootable`, 'ISO is bootable.');
# TODO check burnable?
my $burner = "/dev/sr0";
@@ -108,7 +119,7 @@ my $result = `cat is_burnable.log | grep overburn | wc -l | tr -d '\n'`;
-r "is_burnable.log" and system "rm is_burnable.log";
-is ($result, 0, "ISO can be burnt.");
+is $result, 0, "ISO can be burnt.";
done_testing();