summaryrefslogtreecommitdiffstats
path: root/scripts/kprobes_test/is_probed.py
diff options
context:
space:
mode:
authorMark Wielaard <mjw@redhat.com>2009-01-23 14:28:47 +0100
committerMark Wielaard <mjw@redhat.com>2009-01-23 14:28:47 +0100
commitc3bad3042df505a3470f1e20b09822a9df1d4761 (patch)
tree6842e8eaa705e406379d34cf07a85431b6d71344 /scripts/kprobes_test/is_probed.py
parent750b1f2f5c84acaf0776de5239dc81e2e95c1dec (diff)
parentf120873cb40cfc16cc94f06fd722abc927b96227 (diff)
downloadsystemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.tar.gz
systemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.tar.xz
systemtap-steved-c3bad3042df505a3470f1e20b09822a9df1d4761.zip
Merge branch 'master' into pr6866.
Diffstat (limited to 'scripts/kprobes_test/is_probed.py')
-rwxr-xr-xscripts/kprobes_test/is_probed.py55
1 files changed, 55 insertions, 0 deletions
diff --git a/scripts/kprobes_test/is_probed.py b/scripts/kprobes_test/is_probed.py
new file mode 100755
index 00000000..192abd88
--- /dev/null
+++ b/scripts/kprobes_test/is_probed.py
@@ -0,0 +1,55 @@
+#!/usr/bin/python
+
+# Copyright (C) 2008 Red Hat Inc.
+#
+# This file is part of systemtap, and is free software. You can
+# redistribute it and/or modify it under the terms of the GNU General
+# Public License (GPL); either version 2, or (at your option) any
+# later version.
+
+import re
+import sys
+import os
+from config_opts import config_opts
+
+# Parse the output file, looking for probe points
+pp_re = re.compile(": (-?\d+) (\S+)$")
+f = open(config_opts['probes_result'], 'r')
+pp = dict()
+line = f.readline()
+while line:
+ match = pp_re.search(line)
+ if match:
+ pp[match.group(2)] = int(match.group(1))
+ line = f.readline()
+f.close()
+
+if len(pp.keys()) == 0:
+ print >>sys.stderr, "No data found?"
+ sys.exit(1)
+
+# Parse the list of probe points.
+f = open(config_opts['probes_current'], 'r')
+passed = open(config_opts['probes_passed'], 'a')
+failed = open(config_opts['probes_failed'], 'a')
+untriggered = open(config_opts['probes_untriggered'], 'a')
+unregistered = open(config_opts['probes_unregistered'], 'a')
+line = f.readline().strip()
+while line:
+ if pp.has_key(line):
+ if pp[line] > 0:
+ passed.write(line + '\n')
+ elif pp[line] == 0:
+ untriggered.write(line + '\n')
+ elif pp[line] == -1:
+ unregistered.write(line + '\n')
+ else:
+ failed.write(line + '\n')
+ line = f.readline().strip()
+f.close()
+passed.close()
+failed.close()
+untriggered.close()
+unregistered.close()
+
+sys.exit(0)