ktest: Added compare script to test ktest.pl to sample.conf
authorSteven Rostedt <srostedt@redhat.com>
Mon, 8 Nov 2010 22:18:37 +0000 (17:18 -0500)
committerSteven Rostedt <rostedt@goodmis.org>
Thu, 18 Nov 2010 16:23:11 +0000 (11:23 -0500)
Add a compare script that makes sure that all the options in
sample.conf are used in ktest.pl, and all the options in
ktest.pl are described in sample.conf.

Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
tools/testing/ktest/compare-ktest-sample.pl [new file with mode: 0755]

diff --git a/tools/testing/ktest/compare-ktest-sample.pl b/tools/testing/ktest/compare-ktest-sample.pl
new file mode 100755 (executable)
index 0000000..9a571e7
--- /dev/null
@@ -0,0 +1,30 @@
+#!/usr/bin/perl
+
+open (IN,"ktest.pl");
+while (<IN>) {
+    if (/\$opt\{"?([A-Z].*?)(\[.*\])?"?\}/ ||
+       /set_test_option\("(.*?)"/) {
+       $opt{$1} = 1;
+    }
+}
+close IN;
+
+open (IN, "sample.conf");
+while (<IN>) {
+    if (/^\s*#?\s*(\S+)\s*=/) {
+       $samp{$1} = 1;
+    }
+}
+close IN;
+
+foreach $opt (keys %opt) {
+    if (!defined($samp{$opt})) {
+       print "opt = $opt\n";
+    }
+}
+
+foreach $samp (keys %samp) {
+    if (!defined($opt{$samp})) {
+       print "samp = $samp\n";
+    }
+}