summaryrefslogtreecommitdiffstats
path: root/src/report-python/test_full
diff options
context:
space:
mode:
authorDenys Vlasenko <dvlasenk@redhat.com>2010-12-16 18:28:07 +0100
committerDenys Vlasenko <dvlasenk@redhat.com>2010-12-16 18:28:07 +0100
commit628fb1fbae2a9e3e8fc3add070bceb5557973029 (patch)
tree7e46ad228722cf5b6e7f4b54b9100d6cf638a135 /src/report-python/test_full
parent93d5d8a317ec9294bbd6dcc6bd8baec0c2b63b1b (diff)
create_dump_dir: add base_dir_name parameter.
This makes python wrappers more usable. src/report-python/test_full demonstrates how pyhton programs can run reporting now. Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
Diffstat (limited to 'src/report-python/test_full')
-rwxr-xr-xsrc/report-python/test_full27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/report-python/test_full b/src/report-python/test_full
new file mode 100755
index 00000000..a9f32034
--- /dev/null
+++ b/src/report-python/test_full
@@ -0,0 +1,27 @@
+#!/usr/bin/python
+
+import sys
+from report import *
+
+def run_event_on_crash_data(cd, event, log_function = None):
+ dd = cd.create_dump_dir("/tmp")
+ dir_name = dd.name
+ print "Created dump_dir:", dir_name
+ dd.close()
+ run_state = run_event_state()
+ if log_function: # maybe if callable(log_function)?
+ run_state.logging_callback = log_function
+ print "Running event:", event
+ r = run_state.run_event(dir_name, event)
+ print "Deleting:", dir_name
+ delete_dump_dir(dir_name)
+ return r;
+
+def log_function(line):
+ print "LOG:", line
+
+cd = crash_data()
+cd.add("foo", "bar")
+cd.add("analyzer", "baz")
+r = run_event_on_crash_data(cd, "post-create", log_function)
+print "Result:", r