From 1e56d4d23b16c9ab51315b9e492f8ee0c57cad90 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Fri, 17 Feb 2012 19:14:29 +0000 Subject: reorganize bits - typos - check idx/lst only for LiveCDs - check .{md5,sha1}.gpg only with final releases - update isoinfo expected headers --- README.txt | 5 +-- image_tests/001_check_file.t | 49 ++++++++++++++++-------------- image_tests/install_iso/016_check_pubkey.t | 2 +- image_tests/live_iso/000_files_lists.t | 8 +++++ isocheck.pl | 2 +- 5 files changed, 40 insertions(+), 26 deletions(-) create mode 100644 image_tests/live_iso/000_files_lists.t diff --git a/README.txt b/README.txt index b95f635..b32f970 100644 --- a/README.txt +++ b/README.txt @@ -15,7 +15,7 @@ Usage ----- $ su - # perl ./test_iso.pl path/to/your/Mageia-x-i586.iso + # perl ./isocheck.pl path/to/your/Mageia-x-i586.iso ... logs ... Returns 0 in case of success (and last line of log starts with "PASS"). @@ -70,7 +70,8 @@ TODO - check DKMS are sync with kernel on ISO - check product.id on the ISO (vendor=Mandriva,distribution=Mandriva Linux,type=basic,version=Mandriva,branch=official,release=0.1,arch=x86_64,product=public - check releases_notes on the ISO - + - package it + - wrap it to produce automatic reports after BCD Style ----- diff --git a/image_tests/001_check_file.t b/image_tests/001_check_file.t index 26e331a..b853059 100644 --- a/image_tests/001_check_file.t +++ b/image_tests/001_check_file.t @@ -32,12 +32,12 @@ bail_on_fail; %info = Isocheck::parse_image_file_name($name); if (scalar %info) { - pass 'ISO has valid filename.'; + pass 'Image has a valid filename.'; while (my ($k, $v) = each %info) { note uc($k), "=$v\n" if defined $v; } } else { - fail 'ISO has valid filename.'; + fail 'Image has a valid filename.'; diag 'See https://wiki.mageia.org/en/Product_naming for more information.'; } @@ -46,21 +46,14 @@ my $du = `du --apparent-size --block-size=MB $image_path`; 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}}, - sprintf("File has a working size (%s) for its medium type (%s, max %s).", - $size, $info{medium}, $max_sizes{$info{medium}})); - -TODO: { - local $TODO = ".idx & .lst" if 1; - - ok(-r $image_path, '.idx list file is available.'); - ok(-r $image_path, '.lst list file is available.'); -} - +ok($size le $max_sizes{$info{medium}}, "File has a valid size."); +diag(sprintf("File is %s. Max size for %s is %s.", $size, $info{medium}, $max_sizes{$info{medium}})); # verify checksums +ok -r $image_path . '.md5', 'MD5 checksum is available.'; +ok -r $image_path . '.sha1', 'SHA1 checkum is available.'; + my $md5file = $image_path . '.md5'; my $sha1file = $image_path . '.sha1'; @@ -76,18 +69,30 @@ my $sha1 = $ts[0]; $sha1file = $ts[0]; is($sha1, $sha1file, 'SHA1/.sha1 checksums match.'); +if (!defined $info{'release'}) { + ok -r $image_path . '.md5.gpg', 'MD5.gpg is available.'; + ok -r $image_path . '.sha1.gpg', 'SHA1.gpg is available.'; + # TODO check signature are valid! +} # 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", "", # ? - "Copyright File id", "http://www.mageia.org/2/license/", - "Abstract File id", "http://www.mageia.org/2/" + "System id", 'LINUX', + "Volume id", sprintf('%s %s %s', + $info{name}, $info{version}, + (defined $info{release}) ? $info{release} : ''), + "Volume set id", sprintf('%s %s %s %s %s %s', + $info{name}, $info{version}, + (defined $info{release}) ? $info{release} : '', + $info{variant}, $info{arch}, $info{medium}), + "Publisher id", 'Mageia.org', + "Data preparer id", 'Mageia BCD', + "Copyright File id", sprintf('http://www.mageia.org/%s/license/', + $info{version}), + "Abstract File id", sprintf('http://www.mageia.org/%s/', + $info{version}) ); my $testval; @@ -96,7 +101,7 @@ while (my ($k, $v) = each(%isoValues)) { # not testing right now, all expected values are not sure yet. # is $testval, "$k: $v", "$k is correct. Found $testval."; - note "Found: $testval - expecting: $k: $v"; + note "Found: $testval \nExpected: $k: $v"; } diff --git a/image_tests/install_iso/016_check_pubkey.t b/image_tests/install_iso/016_check_pubkey.t index 587e7c6..5fa1e9b 100644 --- a/image_tests/install_iso/016_check_pubkey.t +++ b/image_tests/install_iso/016_check_pubkey.t @@ -28,7 +28,7 @@ use Isocheck; my ($image_path) = @ARGV; my $name = basename($image_path); -my %info = Tools::parse_image_file_name($name); +my %info = Isocheck::parse_image_file_name($name); bail_on_fail; diff --git a/image_tests/live_iso/000_files_lists.t b/image_tests/live_iso/000_files_lists.t new file mode 100644 index 0000000..e683823 --- /dev/null +++ b/image_tests/live_iso/000_files_lists.t @@ -0,0 +1,8 @@ +use Test::Most; + +my ($image_path) = @ARGV; + +bail_on_fail; + +ok(-r $image_path, '.idx list file is available.'); +ok(-r $image_path, '.lst list file is available.'); \ No newline at end of file diff --git a/isocheck.pl b/isocheck.pl index 446b5ad..df94cb9 100644 --- a/isocheck.pl +++ b/isocheck.pl @@ -59,7 +59,7 @@ my $name = basename($image_path); my %info = Isocheck::parse_image_file_name($name); my @testfiles; -if ($info{variant} =~ /^LiveCD/) { +if (defined $info{variant} && $info{variant} =~ /^LiveCD/) { @testfiles = glob('image_tests/live_iso/*.t'); } else { @testfiles = glob('image_tests/install_iso/*.t'); -- cgit v1.2.1