summaryrefslogtreecommitdiffstats
path: root/test/check_dmidecode.pl
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2005-03-14 15:09:23 +0000
committerPascal Rigaux <pixel@mandriva.com>2005-03-14 15:09:23 +0000
commit8b38ae039d55b86f25819b8dda992e1961b9dfcc (patch)
tree6b67ca89fff0176ecdfe979d55977f514c71d71f /test/check_dmidecode.pl
parenta6d2425fddd72d74fe3a212fa3456bc78fd869d8 (diff)
downloadldetect-lst-8b38ae039d55b86f25819b8dda992e1961b9dfcc.tar
ldetect-lst-8b38ae039d55b86f25819b8dda992e1961b9dfcc.tar.gz
ldetect-lst-8b38ae039d55b86f25819b8dda992e1961b9dfcc.tar.bz2
ldetect-lst-8b38ae039d55b86f25819b8dda992e1961b9dfcc.tar.xz
ldetect-lst-8b38ae039d55b86f25819b8dda992e1961b9dfcc.zip
add dmitable
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..53adb90d
--- /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 -p /dev/null -u /dev/null --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;
+ }
+}