From de97b7594050ca17fc6a9f40741286bc0ebd5fc3 Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 12 Dec 2011 22:46:41 +0000 Subject: reorganize mounted images tests and summary output --- test_iso.pl | 46 ++++++++++++++++++++++++++-------------------- 1 file changed, 26 insertions(+), 20 deletions(-) diff --git a/test_iso.pl b/test_iso.pl index bd3e03d..3a5e424 100644 --- a/test_iso.pl +++ b/test_iso.pl @@ -20,10 +20,10 @@ # Boston, MA 02110-1301, USA. # - use 5.010; use MDK::Common; use TAP::Harness; +use TAP::Parser::Aggregator; use Tools; my ($image_path) = @ARGV; @@ -51,30 +51,36 @@ print "# Date: ", `date --rfc-3339='ns' -u`; print "# Testing: $image_path\n"; print "# Host: ", `uname -n`; -$harness->runtests(glob_('t/*.t')); - -# Mounting the ISO -print "# Mounting ISO in /media/iso_check"; --r "/media/iso_check" or mkdir('/media/iso_check'); -system "mount -r " . if_(!-b $image_path, "-o loop ") . "$image_path /media/iso_check/"; -print "... ok\n"; +my $aggregator = TAP::Parser::Aggregator->new; +$aggregator->start; +$harness->aggregate_tests($aggregator, glob_('t/*.t')); -my $name = basename($image_path); -my %info = Tools::parse_mageia_iso_name($name); +my $name = basename($image_path); +my %info = Tools::parse_mageia_iso_name($name); +my @testfiles; -if ($info{variant} =~ m/^LiveCD/) { - # TODO: LiveCD specific tests +if ($info{variant} =~ /^LiveCD/) { + @testfiles = glob_('t_live_iso/*.t'); } else { - $harness->runtests(glob_('t_install_iso/*.t')); + @testfiles = glob_('t_install_iso/*.t'); } -# Umounting the ISO -print "# Umounting ISO\n"; -# FIXME this fails sometimes (with LiveCDs); 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`; +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"; \ No newline at end of file -- cgit v1.2.1