summaryrefslogtreecommitdiffstats
path: root/test/check_dmidecode.pl
diff options
context:
space:
mode:
authorDexter Morgan <dmorgan@mageia.org>2011-06-02 20:49:34 +0000
committerDexter Morgan <dmorgan@mageia.org>2011-06-02 20:49:34 +0000
commit6fa41ff0a34926fff40731698814f3ea94261395 (patch)
tree66feec48f4c5e507ff13efdbdc5ad6f76f67373d /test/check_dmidecode.pl
downloadldetect-lst-distro/mga1.tar
ldetect-lst-distro/mga1.tar.gz
ldetect-lst-distro/mga1.tar.bz2
ldetect-lst-distro/mga1.tar.xz
ldetect-lst-distro/mga1.zip
Branch for updatesdistro/mga1
Diffstat (limited to 'test/check_dmidecode.pl')
-rwxr-xr-xtest/check_dmidecode.pl27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/check_dmidecode.pl b/test/check_dmidecode.pl
new file mode 100755
index 00000000..e00a5445
--- /dev/null
+++ b/test/check_dmidecode.pl
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use MDK::Common;
+
+foreach my $file (glob("dmidecode.*")) {
+ my %wanted = cat_($file) =~ /\(=> (\S+): (\S+)\)/g;
+
+ my %got = map {
+ s/\s*: .*//;
+ /(\S+):(.*)/ ? ($1 => $2) : ();
+ } `lspcidrake --dmidecode $file`;
+
+ my @missing = difference2([ keys %wanted ], [ keys %got ]);
+ if (@missing) {
+ warn "for $file, missing: ", join(' ', @missing), "\n";
+ }
+
+ my @surprise = difference2([ keys %got ], [ keys %wanted ]);
+ if (@surprise) {
+ warn "for $file, surprise: ", join(' ', map { "(=> $_: $got{$_})" } @surprise), "\n";
+ }
+
+ my @bad = grep { $wanted{$_} ne $got{$_} } intersection([ keys %wanted ], [ keys %got ]);
+ if (@bad) {
+ warn "for $file, bad $_: $wanted{$_} != $got{$_}\n" foreach @bad;
+ }
+}