aboutsummaryrefslogtreecommitdiffstats
path: root/t_install_iso
diff options
context:
space:
mode:
Diffstat (limited to 't_install_iso')
-rw-r--r--t_install_iso/010_check_autorun.t94
-rw-r--r--t_install_iso/011_check_idx.t78
-rw-r--r--t_install_iso/012_check_ids.t22
-rw-r--r--t_install_iso/013_check_rpms.t31
-rw-r--r--t_install_iso/014_check_bad_words.t27
-rw-r--r--t_install_iso/016_check_pubkey.t95
6 files changed, 347 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();
diff --git a/t_install_iso/011_check_idx.t b/t_install_iso/011_check_idx.t
new file mode 100644
index 0000000..de9b8bb
--- /dev/null
+++ b/t_install_iso/011_check_idx.t
@@ -0,0 +1,78 @@
+# TODO
+#
+#
+use Test::Most;
+
+bail_on_fail;
+
+SKIP: {
+ skip "TODO", 1 unless 0;
+}
+
+done_testing();
+
+# get the product to verify in idxlist
+sub check_idx {
+ my ($log, $distro, $image, $verbo) = @_;
+ my $idx;
+ my $valid = 1;
+ my $col;
+ $col = 0 if member($distro, qw(Free FREE));
+ $col = 2 if member($distro, qw(PWP Powerpack));
+ $col = 3 if member($distro, qw(One ONE one));
+ $col = 1 if -r "/media/iso_check/i586/" && -r "/media/iso_check/x86_64/";
+ if ($col == 3) {
+ substr($image, -3 , 3) = '';
+ $idx = $image . "lst";
+ $valid &= check_idx_list($idx, $log, $col, $verbo) if -r $idx && -r "idxlist";
+ }
+ else {
+ substr($image, -3 , 3) = '';
+ $idx = $image . "idx";
+ $valid &= check_idx_list($idx, $log, $col, $verbo) if -r $idx && -r "idxlist";
+ }
+
+ return $valid;
+}
+
+
+# Verification of the presence of the packages on the iso
+sub check_idx_list {
+ my ($idx, $log, $col, $verb) = @_;
+ my $pkg;
+ my $valid = 1;
+ my $file;
+ my @media;
+
+ print "<Log of check_idx>\n" if $verb;
+ print $log "<Log of check_idx>\n";
+
+ open(my $list, 'idxlist') or fail('check_idx_list');
+ while ($pkg = <$list>) {
+ if (substr($pkg, 0, 1) ne '#') {
+ chomp($pkg);
+ @media = split(/ /, $pkg);
+ if ($media[$col] == 1) {
+ $file = `cat $idx | cut -d ' ' -f 2 | grep $media[4]` if $col != 3;
+ $file = `cat $idx | grep $media[4]` if $col == 3;
+ if ($file eq '') {
+ print $log "$media[4] NOT FOUND in $idx\n";
+ print "$media[4] NOT FOUND in $idx\n" if $verb;
+ $valid = 0;
+ }
+ else {
+ print $file if $verb;
+ #print $log $file;
+ }
+ }
+ }
+ }
+ print $log "</Log of check_idx>\n";
+ print $log "Comparison between idxlist and .idx OK\n" if $valid != 0;
+ print $log "Comparison between idxlist and .idx NOT OK\n" if $valid == 0;
+ print "</Log of check_idx>\n" if $verb;
+ print "Comparison between idxlist and .idx: OK\n" if $valid != 0 && $verb;
+ print "Comparison between idxlist and .idx: NOT OK\n" if $valid == 0 && $verb;
+
+ return $valid;
+}
diff --git a/t_install_iso/012_check_ids.t b/t_install_iso/012_check_ids.t
new file mode 100644
index 0000000..1078cfc
--- /dev/null
+++ b/t_install_iso/012_check_ids.t
@@ -0,0 +1,22 @@
+#
+# Check if PCI ids are on the ISO
+#
+
+use Test::Most tests => 1;
+use File::Basename;
+
+my ($image_path) = @ARGV;
+
+bail_on_fail;
+
+my $valid;
+my $valid2;
+
+$valid = -r "/media/iso_check/i586/isolinux/pci.ids" if -r "/media/iso_check/i586";
+$valid2 = -r "/media/iso_check/x86_64/isolinux/pci.ids" if -r "/media/iso_check/x86_64";
+$valid &= $valid2 if -r "/media/iso_check/x86_64" && -r "/media/iso_check/i586";
+$valid = $valid2 if -r "/media/iso_check/x86_64" && !$valid;
+
+ok ($valid, 'HDT can find pci.ids.');
+
+done_testing();
diff --git a/t_install_iso/013_check_rpms.t b/t_install_iso/013_check_rpms.t
new file mode 100644
index 0000000..bd83030
--- /dev/null
+++ b/t_install_iso/013_check_rpms.t
@@ -0,0 +1,31 @@
+#
+# Verification of the signature of all the rpm packages present on the iso
+#
+use Test::Most;
+
+bail_on_fail;
+
+SKIP: {
+ skip "Not working yet", 1 unless 0;
+
+my $_find = `find /media/iso_check/* -name *.rpm > find_all_rpm.log`;
+open(my $list, 'find_all_rpm.log');
+
+my $pkg;
+my $sign;
+my $valid = 1;
+
+while ($pkg = <$list>) {
+ $sign = '';
+ chomp($pkg);
+ $sign = `rpm -K $pkg | grep 'gpg OK'`;
+ ok ($sign, "$pkg is correctly signed.");
+
+ $valid = 0 if !$sign;
+}
+close($list);
+my $_res = `rm -rf find_all_rpm.log`;
+
+}
+
+done_testing();
diff --git a/t_install_iso/014_check_bad_words.t b/t_install_iso/014_check_bad_words.t
new file mode 100644
index 0000000..88cf122
--- /dev/null
+++ b/t_install_iso/014_check_bad_words.t
@@ -0,0 +1,27 @@
+#
+# This function search if there is any temporary files ( .file.swp and file~)
+# or file with "bad" words.
+#
+use Test::Most tests => 2;
+
+bail_on_fail;
+
+#
+my $res = `find /media/iso_check/ -name '*~' -or -iname '*.swp'`;
+if ($res) {
+ fail('Has no swap temporary file (*~ or *.swp).');
+ note $res;
+} else {
+ pass('Has no swap temp file.');
+}
+
+#
+$res = `find /media/iso_check/ -iname '*roxx*' -or -iname '*sucks*' -or -iname 'ubuntu*' -or -iname 'microsoft*' -or -iname 'mandrake*' -or -iname 'mandriva'`;
+if ($res) {
+ fail('Has no blacklisted word.');
+ note $res;
+} else {
+ pass('Has no blacklisted word.');
+}
+
+done_testing();
diff --git a/t_install_iso/016_check_pubkey.t b/t_install_iso/016_check_pubkey.t
new file mode 100644
index 0000000..fc5ffaa
--- /dev/null
+++ b/t_install_iso/016_check_pubkey.t
@@ -0,0 +1,95 @@
+#
+# TODO check pubkeys FIXME this looks like a mess.
+# This function get the path of the pubkeys
+#
+use Test::Most;
+use File::Basename;
+use Tools;
+
+my ($image_path) = @ARGV;
+my $name = basename($image_path);
+my %info = Tools::parse_mageia_iso_name($name);
+
+bail_on_fail;
+
+my $url;
+my $path;
+my $pubkey = 1;
+my $media;
+
+system "ls /media/iso_check/i586/media/ > temp_media_on_iso.log" if -r "/media/iso_check/i586/media/";
+system "ls /media/iso_check/x86_64/media/ >> temp_media_on_iso.log" if -r "/media/iso_check/x86_64/media/";
+
+ok (-r "temp_media_on_iso.log", "Got a log for media contents");
+
+open(my $file, "temp_media_on_iso.log") if -r "temp_media_on_iso.log";
+
+while ($media = <$file>) {
+ chomp($media);
+ if ($info{"arch"} ne "dual" && $media ne 'media_info') {
+ $path = "/media/iso_check/" . $info{"arch"} . "/media/$media/media_info/pubkey";
+ $url = "pubkey/" . $info{"arch"} . "-$media-pubkey";
+ #$url .= "-cooker" if !$finale;
+ $pubkey &= check_key($path, $url, $media, $info{"arch"}) if -r $path && -r $url;
+ }
+ elsif ($media ne 'media_info') {
+ foreach my $arch ("i586", "x86_64") {
+ $path = "/media/iso_check/$arch/media/$media/media_info/pubkey";
+ $url = "pubkey/$arch-$media-pubkey";
+ #$url .= "-cooker" if !$finale;
+ -r $path and -r $url and $pubkey &= check_key($path, $url, $media, $arch);
+ }
+ }
+}
+-r "temp_media_on_iso.log" and system "rm temp_media_on_iso.log";
+
+
+#This function get the gpg -a key of the pubkey to compare it
+sub get_gpg {
+ my ($pubkey) = @_;
+ my $key;
+ my $file;
+ system "gpg -a $pubkey > get_gpg_key.log";
+ open($file, "get_gpg_key.log");
+ while (my $a = <$file>) {
+ if (substr($a, 0, 11) eq "pub 1024D/") {
+ $key = substr($a, 11, 8);
+ }
+ }
+ system "rm get_gpg_key.log";
+
+ return $key;
+}
+
+
+#Verification of the pubkey with the original pubkey
+sub check_key { # sed "s/pub\w1024D/\(.*\) /\1/"
+ my ($iso_file, $ref_file, $media, $arch) = @_;
+ my $unvalid;
+ my $valid = 1;
+ my $file = get_gpg($iso_file);
+ my $sign = `cat $ref_file`;
+ chomp($sign);
+ if ($file eq $sign) {
+ if (member($media, qw(core nonfree))) {
+ note "$arch-$media pubkey is valid.\t\tOK\n" if $arch eq 'i586';
+ note "$arch-$media pubkey is valid.\t\tOK\n" if $arch eq 'x86_64' && member($media, qw(core nonfree));
+ note "$arch-$media pubkey is valid.\tOK\n" if $arch eq 'x86_64' && $media eq 'non-free';
+ } else {
+ note "$arch-$media pubkey is valid.\tOK\n";
+ }
+ note "$arch-$media pubkey is valid.\n";
+ return $valid;
+ } else {
+ if (member($media, qw(core))) {
+ note "$arch-$media pubkey isn't valid.\t\tNOK\n";
+ } else {
+ note "$arch-$media pubkey isn't valid.\tNOK\n";
+ }
+ note "$arch-$media pubkey isn't valid.\n";
+ return $unvalid;
+ }
+ return $unvalid;
+}
+
+done_testing();