From 9e4bd485b397e7ff07d9023ef49dc977f97b2b12 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Fri, 17 Feb 2012 17:58:35 +0000 Subject: rename to isocheck.pl + updated TODO + obsolete Tools.pm --- README.txt | 8 ++++++ Tools.pm | 58 ---------------------------------------- isocheck.pl | 88 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ test_iso.pl | 88 ------------------------------------------------------------- 4 files changed, 96 insertions(+), 146 deletions(-) delete mode 100644 Tools.pm create mode 100644 isocheck.pl delete mode 100644 test_iso.pl diff --git a/README.txt b/README.txt index 103acc3..b95f635 100644 --- a/README.txt +++ b/README.txt @@ -62,6 +62,14 @@ TODO * separate tests that are generic from those that are Mageia-specific * move specific tests into t/{name}/*.t - script should be run by a non-root user that can sudo mount + - check all RPM from list are on the ISO + - check all excluded RPMS are not on the ISO + - check pubkey on each media + - check the Theme available on the ISO + - check the mandriva-release version on the ISO + - 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 Style diff --git a/Tools.pm b/Tools.pm deleted file mode 100644 index 43ebeaa..0000000 --- a/Tools.pm +++ /dev/null @@ -1,58 +0,0 @@ -# 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 -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with this library; see the file COPYING.LIB. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# -# -# - -package Tools; - -use strict; -use warnings; - -our $VERSION = '0.1'; - -use base 'Exporter'; - -our @EXPORT = qw(parse_mageia_iso_name); - -# Check image filename if it is valid (see https://wiki.mageia.org/en/Product_naming) -# -# In: filename -# Out: populated hash if valid, empty hash otherwise. -# -sub parse_mageia_iso_name { - my ($name) = @_; - my %info; - - if ($name =~ m/^(Mageia)-(\d+)(-((nightly|alpha|beta|RC)\d*))?(-(.*))?-(i586|x86_64|dual)?(-(CD|DVD|BR))?(-(build_\w+))?\.(.*)$/) { - $info{full} = `echo $name | sed 's/.iso//g' | tr -d '\n'`; - $info{name} = $1 if defined $1; - $info{version} = $2 if defined $2; - $info{release} = $4 if defined $4; - $info{variant} = $7 if defined $7; - $info{arch} = $8 if defined $8; - $info{medium} = $10 if defined $10; - $info{build} = $12 if defined $12; - $info{ext} = $13 if defined $13; - } - - return %info; -} - -1; diff --git a/isocheck.pl b/isocheck.pl new file mode 100644 index 0000000..446b5ad --- /dev/null +++ b/isocheck.pl @@ -0,0 +1,88 @@ +#!/usr/bin/perl -w +# +# 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 +# version 2 of the License, or (at your option) any later version. +# +# This library is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Library General Public License for more details. +# +# You should have received a copy of the GNU Library General Public License +# along with this library; see the file COPYING.LIB. If not, write to +# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +# Boston, MA 02110-1301, USA. +# + +use 5.010; +use MDK::Common; +use TAP::Harness; +use TAP::Parser::Aggregator; +use Isocheck; + +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" + ] +}); + +my $ts0 = time(); + +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; +$harness->aggregate_tests($aggregator, glob('image_tests/*.t')); + +my $name = basename($image_path); +my %info = Isocheck::parse_image_file_name($name); +my @testfiles; + +if ($info{variant} =~ /^LiveCD/) { + @testfiles = glob('image_tests/live_iso/*.t'); +} else { + @testfiles = glob('image_tests/install_iso/*.t'); +} + +if (@testfiles) { + print "# Mounting ISO in /media/iso_check\n"; + -r "/media/iso_check" or mkdir('/media/iso_check'); + system "mount -r " . if_(!-b $image_path, "-o loop ") . "$image_path /media/iso_check/"; + + $harness->aggregate_tests($aggregator, @testfiles); + + print "# Umounting ISO\n"; + system('umount -l', '/media/iso_check'); + rmdir('/media/iso_check'); +} + +$aggregator->stop; +$harness->summary($aggregator); + +my $tdiff = time() - $ts0; +print "# Tested $name in $tdiff seconds.\n"; + +print $aggregator->all_passed, "\n", $aggregator->get_status, "\n"; + +exit($aggregator->all_passed ? 0 : 1); diff --git a/test_iso.pl b/test_iso.pl deleted file mode 100644 index 446b5ad..0000000 --- a/test_iso.pl +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/perl -w -# -# 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 -# version 2 of the License, or (at your option) any later version. -# -# This library is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Library General Public License for more details. -# -# You should have received a copy of the GNU Library General Public License -# along with this library; see the file COPYING.LIB. If not, write to -# the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, -# Boston, MA 02110-1301, USA. -# - -use 5.010; -use MDK::Common; -use TAP::Harness; -use TAP::Parser::Aggregator; -use Isocheck; - -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" - ] -}); - -my $ts0 = time(); - -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; -$harness->aggregate_tests($aggregator, glob('image_tests/*.t')); - -my $name = basename($image_path); -my %info = Isocheck::parse_image_file_name($name); -my @testfiles; - -if ($info{variant} =~ /^LiveCD/) { - @testfiles = glob('image_tests/live_iso/*.t'); -} else { - @testfiles = glob('image_tests/install_iso/*.t'); -} - -if (@testfiles) { - print "# Mounting ISO in /media/iso_check\n"; - -r "/media/iso_check" or mkdir('/media/iso_check'); - system "mount -r " . if_(!-b $image_path, "-o loop ") . "$image_path /media/iso_check/"; - - $harness->aggregate_tests($aggregator, @testfiles); - - print "# Umounting ISO\n"; - system('umount -l', '/media/iso_check'); - rmdir('/media/iso_check'); -} - -$aggregator->stop; -$harness->summary($aggregator); - -my $tdiff = time() - $ts0; -print "# Tested $name in $tdiff seconds.\n"; - -print $aggregator->all_passed, "\n", $aggregator->get_status, "\n"; - -exit($aggregator->all_passed ? 0 : 1); -- cgit v1.2.1