aboutsummaryrefslogtreecommitdiffstats
path: root/t_install_iso/010_check_autorun.t
diff options
context:
space:
mode:
Diffstat (limited to 't_install_iso/010_check_autorun.t')
-rw-r--r--t_install_iso/010_check_autorun.t94
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();