From 1f2ca24bf78e6355cd76ec078954af99466a24de Mon Sep 17 00:00:00 2001 From: Damien Lallement Date: Tue, 13 Dec 2011 15:24:33 +0000 Subject: - update wiki link - add 'network' detection - update/clean test available files - update 'check badwords' - update 'display info' --- README.txt | 2 +- Tools.pm | 2 +- t/000_test_env.t | 29 +++++++++++++++++++++++++---- t/001_check_file.t | 8 -------- t_install_iso/014_check_bad_words.t | 21 ++++++++++++++------- test_iso.pl | 8 ++++---- 6 files changed, 45 insertions(+), 25 deletions(-) diff --git a/README.txt b/README.txt index 6dfeb3c..ffb36ec 100644 --- a/README.txt +++ b/README.txt @@ -7,7 +7,7 @@ All ISOs should pass this test suite after being built, before being released. License: GPL-2+ Code: svn://svn.mageia.org/svn/soft/isocheck http://svnweb.mageia.org/soft/isocheck -Doc: https://wiki.mageia.org/Isocheck +Doc: https://wiki.mageia.org/en/Isocheck Requirements ------------ diff --git a/Tools.pm b/Tools.pm index 2342992..b94ac20 100644 --- a/Tools.pm +++ b/Tools.pm @@ -41,7 +41,7 @@ sub parse_mageia_iso_name { my %info; if ($name =~ m/^(Mageia)-(\d+)(-((nightly|alpha|beta|RC)\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BR))?(-(build_\w+))?\.(.*)$/) { - $info{full} = $name; + $info{full} = split(/./, $name); $info{name} = $1 if defined $1; $info{version} = $2 if defined $2; $info{release} = $4 if defined $4; diff --git a/t/000_test_env.t b/t/000_test_env.t index cf7abc2..2b5b0d1 100644 --- a/t/000_test_env.t +++ b/t/000_test_env.t @@ -1,7 +1,7 @@ -# This file is part of the Mageia project -# Copyright (C) 2011 Damien Lallement -# (C) 2011 Romain D'Alverny -# +# This file is part of the Mageia project +# Copyright (C) 2011 Damien Lallement +# (C) 2011 Romain D'Alverny +# # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either @@ -27,6 +27,7 @@ bail_on_fail; my ($image_path) = @ARGV; +# root is needed for mount/umount of the ISO is($ENV{USERNAME}, 'root', "Current user is root."); # TODO move this elsewhere maybe? @@ -38,4 +39,24 @@ foreach my $p (@packages) { is(pkg_check($p), 0, sprintf("%s is installed.", $p)); } +# check if all necessary files are available +ok -r $image_path . '.md5', 'MD5 checksum is available.'; +ok -r $image_path . '.sha1', 'SHA1 checkum is available.'; +ok -r $image_path . '.md5.gpg', 'MD5.gpg is available.'; +ok -r $image_path . '.sha1.gpg', 'SHA1.gpg is available.'; +ok -r $image_path . '.idx', 'IDX is available.'; +# TODO check if LiveCD or not, so .idx or .lst +#ok -r $image_path . '.lst', 'LST is available.'; + +# is ISO mount point readable? +ok -r $image_path, 'ISO mount point is readable.' + or diag("$image_path: $!"); + +# is network available? +# will be needed in a near future. +my $nb_packet = 2; +my $server = "google.com"; +my $result = `ping -c $nb_packet $server | grep received | sed 's/ //g' | cut -d, -f 2 | cut -c 1 | tr -d '\n'`; +is ($result, $nb_packet, "Network available"); + done_testing(); diff --git a/t/001_check_file.t b/t/001_check_file.t index 022a8d7..edbf7ba 100644 --- a/t/001_check_file.t +++ b/t/001_check_file.t @@ -41,10 +41,6 @@ if (scalar %info) { diag 'See https://wiki.mageia.org/en/Product_naming for more information.'; } -# are files available? -ok(-r $image_path, 'ISO file is readable.') - or diag("$image_path: $!"); - # is file size correct? my $du = `du --apparent-size --block-size=MB $image_path`; my @size_name = split(/\t/, $du); @@ -56,10 +52,6 @@ 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}})); -# -ok(-r $image_path . '.md5', 'MD5 checksum is available.'); -ok(-r $image_path . '.sha1', 'SHA1 checkum is available.'); - TODO: { local $TODO = ".idx & .lst" if 1; diff --git a/t_install_iso/014_check_bad_words.t b/t_install_iso/014_check_bad_words.t index 00a8c98..260f323 100644 --- a/t_install_iso/014_check_bad_words.t +++ b/t_install_iso/014_check_bad_words.t @@ -21,26 +21,33 @@ # This function search if there is any temporary files ( .file.swp and file~) # or file with "bad" words. # -use Test::Most tests => 2; +use Test::Most tests => 3; -bail_on_fail; +#bail_on_fail; -# +# check for temp/hidden files my $res = `find /media/iso_check/ -name '*~' -or -iname '*.swp' -or -iname '.svn' -or -iname '.git*'`; if ($res) { fail('Has no swap temp or hiden RCS files (*~, *.swp, .svn or .git*).'); note $res; } else { - pass('Has no swap temp or hiden RDC files (*~, *.swp, .svn or .git*).'); + pass('Has no swap temp or hiden RCS files (*~, *.swp, .svn or .git*).'); } -# +# check for bad words in file name or inside files $res = `find /media/iso_check/ -iname '*roxx*' -or -iname '*sucks*' -or -iname 'ubuntu*' -or -iname 'microsoft*' -or -iname 'mandrake*' -or -iname 'mandriva' -or -iname 'todo' -or -iname 'delete*'`; if ($res) { - fail('Has no blacklisted words.'); + fail('Has no blacklisted words in files names.'); note $res; } else { - pass('Has no blacklisted words.'); + $res = `grep -c -r -l --exclude-dir=media --exclude-dir=dosutils --exclude=release* --exclude=pci.ids --exclude=memtest -i -e mandriva -e ubuntu -e roxx -e sucks -e microsoft -e mandrake -e trash -e delete /media/iso_check/`; + if ($res) { + fail('Has no blacklisted words inside files.'); + note $res; + } else { + pass('Has no blacklisted words inside files.'); + } + pass('Has no blacklisted words in files names.'); } done_testing(); diff --git a/test_iso.pl b/test_iso.pl index 3a5e424..21a15f7 100644 --- a/test_iso.pl +++ b/test_iso.pl @@ -47,9 +47,9 @@ my $harness = TAP::Harness->new({ my $ts0 = time(); -print "# Date: ", `date --rfc-3339='ns' -u`; -print "# Testing: $image_path\n"; -print "# Host: ", `uname -n`; +print "# Date\t\t: ", `date --rfc-3339='ns' -u`; +print "# Testing\t: $image_path\n"; +print "# Host\t\t: ", `uname -n`; my $aggregator = TAP::Parser::Aggregator->new; $aggregator->start; @@ -83,4 +83,4 @@ $harness->summary($aggregator); my $tdiff = time() - $ts0; print "# Tested $name in $tdiff seconds.\n"; -print $aggregator->all_passed, "\n", $aggregator->get_status, "\n"; \ No newline at end of file +print $aggregator->all_passed, "\n", $aggregator->get_status, "\n"; -- cgit v1.2.1