From 628fb1fbae2a9e3e8fc3add070bceb5557973029 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 16 Dec 2010 18:28:07 +0100 Subject: 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 --- src/report-python/test_full | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100755 src/report-python/test_full (limited to 'src/report-python/test_full') 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 -- cgit From 639ebf76098f56ce33d9b774acc11f4a8e60be3d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 22 Dec 2010 14:49:03 +0100 Subject: src/report-python: expose CD_FLAG_foo constants to Python wrapper Signed-off-by: Denys Vlasenko --- src/report-python/test_full | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/report-python/test_full') diff --git a/src/report-python/test_full b/src/report-python/test_full index a9f32034..05020f05 100755 --- a/src/report-python/test_full +++ b/src/report-python/test_full @@ -22,6 +22,6 @@ def log_function(line): cd = crash_data() cd.add("foo", "bar") -cd.add("analyzer", "baz") +cd.add("analyzer", "baz", CD_FLAG_ISNOTEDITABLE) r = run_event_on_crash_data(cd, "post-create", log_function) print "Result:", r -- cgit From dba326f60e159697a740f08959d098e19c200453 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 22 Dec 2010 16:28:39 +0100 Subject: extend run_event() to run_event_on_dir_name() and run_event_on_crash_data() Signed-off-by: Denys Vlasenko --- src/report-python/test_full | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/report-python/test_full') diff --git a/src/report-python/test_full b/src/report-python/test_full index 05020f05..103535dd 100755 --- a/src/report-python/test_full +++ b/src/report-python/test_full @@ -12,7 +12,7 @@ def run_event_on_crash_data(cd, event, log_function = None): 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) + r = run_state.run_event_on_dir_name(dir_name, event) print "Deleting:", dir_name delete_dump_dir(dir_name) return r; -- cgit