diff options
author | Romain d'Alverny <rda@mageia.org> | 2011-12-05 22:55:33 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2011-12-05 22:55:33 +0000 |
commit | 586a59e00d00f2b1347f015911545b722f2d1f8b (patch) | |
tree | 0410ef511a253d5f94298c7f130527a4672c230f /t_install_iso/010_check_autorun.t | |
parent | 9412e3c3beb6d547f0932d4e1c19a9dfb0cd4378 (diff) | |
download | isocheck-586a59e00d00f2b1347f015911545b722f2d1f8b.tar isocheck-586a59e00d00f2b1347f015911545b722f2d1f8b.tar.gz isocheck-586a59e00d00f2b1347f015911545b722f2d1f8b.tar.bz2 isocheck-586a59e00d00f2b1347f015911545b722f2d1f8b.tar.xz isocheck-586a59e00d00f2b1347f015911545b722f2d1f8b.zip |
First import, test suite attempt for built ISOs
Code heavily taken from previous dams work,
reorganized in a test suite to better separate test cases.
Does basic things already (in t/).
Needs more fixes (esp. in t_install_iso/).
Diffstat (limited to 't_install_iso/010_check_autorun.t')
-rw-r--r-- | t_install_iso/010_check_autorun.t | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/t_install_iso/010_check_autorun.t b/t_install_iso/010_check_autorun.t new file mode 100644 index 0000000..757951e --- /dev/null +++ b/t_install_iso/010_check_autorun.t @@ -0,0 +1,94 @@ +# +# Check autorun +# +use Test::Most tests => 13; +use File::Basename; +use Tools; + +my ($image_path) = @ARGV; + +my $name = basename($image_path); + +bail_on_fail; + +set_failure_handler( sub { + print "umount iso\n"; + system 'umount /media/iso_check; rm -r /media/iso_check'; +}); + +my %info = Tools::parse_mageia_iso_name($name); +skip 'Autorun is only on DVDs.', 13 unless $info{"medium"} eq 'DVD'; + +# +ok (-r "/media/iso_check/autorun.inf", 'autorun.inf is there'); + +BAIL_OUT('Autorun stuff is missing anyway.') if !(-r "/media/iso_check/autorun.inf"); + +# +my $lines = `cat -e /media/iso_check/autorun.inf | wc -l`; +my $num = `cat -e /media/iso_check/autorun.inf | grep "\\^M" | wc -l`; +chomp($num); +chomp($lines); +my $last = `cat -e /media/iso_check/autorun.inf | tail -n 1 | grep "\\^M" | wc -l`; + +# TODO rewrite this +if ( ($lines != $num && $lines - 1 != $num) + || ($lines == 0) + || ($lines -1 == $num && $last == 1)) { + fail('autorun.inf valid EOL chars'); +} else { + pass('autorun.inf valid EOL chars'); +} + +# +my $directory; +$directory = "/media/iso_check/autorun/" if -r "/media/iso_check/autorun"; +$directory = "/media/iso_check/dosutils/autorun/" if -r "/media/iso_check/dosutils/autorun"; +ok -r $directory, 'dosutils directory is there'; + +# +my $exe = $directory . "autorun.exe"; +ok -r $exe, 'autorun.exe is there'; + +BAIL_OUT('autorun.exe is not here.') if !(-r $exe); + +# +my $file = $directory . "autorun.ico"; +$file = $directory . "mageia.ico" if !(-r $file); +ok -r $file, 'autorun.ico is there'; + +# +foreach my $a ("de-DE/", "es-ES/", "fr-FR/", "it-IT/", "pt-BR/", "ru-RU/", "zh-CN/") { + $file = $directory . $a . "autorun.resources.dll"; + ok -r $file, "$file is there"; +} + +# FIXME what does this do? does it work? +# in the meantime, skipped +SKIP: { + skip 'Not clear what this does', 1 unless 0; + + my $_cp = `cp $exe .`; + eval { + local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required + alarm 5; + my $_nread = sysread my $_SOCKET, my $_buffer, my $_size; + my $_mono = `mono autorun.exe 2> autorun_exe.log`; + alarm 0; + if ($@) { + die unless $@ eq "alarm\n"; # propagate unexpected errors + # timed out + } else { + # didn't + } + }; + + open(my $exe_log, 'autorun_exe.log'); + my $line = <$exe_log>; + + isnt (substr($line, 0, 20), 'Cannot open assembly', 'autorun.exe is launchable'); + + my $_rm = `rm autorun.exe autorun_exe.log`; +} + +done_testing(); |