This is an automated email from the git hooks/post-receive script. It was generated because a ref change was pushed to the repository containing the project gfxprim.git.
The branch, master has been updated via 1883d7d07231829d270253b3f97fc8562047a12c (commit) via 7c67e75801ee1f749d80db0d8fdf67a6808b347e (commit) from 2d7e9bb328d9e81fed96350d419f367b3fb01961 (commit)
Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below.
- Log ----------------------------------------------------------------- http://repo.or.cz/w/gfxprim.git/commit/1883d7d07231829d270253b3f97fc8562047a...
commit 1883d7d07231829d270253b3f97fc8562047a12c Author: Cyril Hrubis metan@ucw.cz Date: Thu Aug 23 22:16:37 2012 +0200
tests: Added example pyton JSON log parser.
diff --git a/tests/framework/json_parse.py b/tests/framework/json_parse.py new file mode 100755 index 0000000..b3e0833 --- /dev/null +++ b/tests/framework/json_parse.py @@ -0,0 +1,72 @@ +#!/usr/bin/env python + +# +# Sample python code to print testsuite name and test results from the JSON logfile +# + +import json + +# +# Create classes from JSON dictionary +# +class TestResult: + def __init__(self, test_result): + self.name = test_result["Test Name"] + self.result = test_result["Test Result"] + self.reports = test_result["Test Reports"] + self.cpu_time = test_result["CPU Time"] + self.run_time = test_result["Run Time"] + + if ("Malloc Stats" in test_result): + self.malloc_stats = 1 + + def __str__(self): + return "Test '%s' ended with '%s' (CPU %is) (TIME %is)" % + (self.name, self.result, self.cpu_time, self.run_time) + + +class TestSuite: + def __init__(self, testsuite_result): + self.name = testsuite_result["Suite Name"] + self.test_results = [] + + for test_result in testsuite_result["Test Results"]: + self.test_results.append(TestResult(test_result)) + + def __str__(self): + ret = 'tt' + self.name + 'nn' + + max_len = 0 + for i in self.test_results: + max_len = max(max_len, len(i.name)) + + for i in self.test_results: + ret += i.name + + padds = (max_len - len(i.name)) + + while padds > 0: + ret += ' ' + padds-=1 + + ret += " | %.3fs/%.3fs | %sn" % + (i.cpu_time, i.run_time, i.result) + + for j in i.reports: + ret += " (%s)n" % j + + return ret + +def main(): + # parse JSON + f = open('log.json') + data = json.load(f) + f.close() + + # convert to python objects + test_suite = TestSuite(data) + + print(test_suite) + +if __name__ == '__main__': + main()
http://repo.or.cz/w/gfxprim.git/commit/7c67e75801ee1f749d80db0d8fdf67a6808b3...
commit 7c67e75801ee1f749d80db0d8fdf67a6808b347e Author: Cyril Hrubis metan@ucw.cz Date: Thu Aug 23 16:38:25 2012 +0200
tests: Silence the job output.
This prepares to capture the messages.
diff --git a/tests/framework/runtest.sh b/tests/framework/runtest.sh index bdefd45..e38592d 100755 --- a/tests/framework/runtest.sh +++ b/tests/framework/runtest.sh @@ -1,3 +1,12 @@ #!/bin/sh
+# +# By default the glibc __libc_message() writes to /dev/tty before calling +# the abort(). Exporting this macro makes it to use stderr instead. +# +# The main usage of the function are malloc assertions, so this makes us catch +# the malloc error message by catching stderr output. +# +export LIBC_FATAL_STDERR_=1 + LD_PRELOAD=`pwd`/libtst_preload.so ./test diff --git a/tests/framework/tst_job.c b/tests/framework/tst_job.c index 150011d..2eda133 100644 --- a/tests/framework/tst_job.c +++ b/tests/framework/tst_job.c @@ -261,6 +261,13 @@ void tst_job_run(struct tst_job *job) return; }
+ /* Redirect stderr/stdout TODO: catch its output */ + if (freopen("/dev/null", "w", stderr)) + tst_warn("freopen(stderr) failed: %s", strerror(errno)); + + if (freopen("/dev/null", "w", stdout)) + tst_warn("freopen(stderr) failed: %s", strerror(errno)); + /* Create directory in /tmp/ and chdir into it. */ if (job->test->flags & TST_TMPDIR) create_tmpdir(job->test->name, template, sizeof(template));
-----------------------------------------------------------------------
Summary of changes: tests/framework/json_parse.py | 72 +++++++++++++++++++++++++++++++++++++++++ tests/framework/runtest.sh | 9 +++++ tests/framework/tst_job.c | 7 ++++ 3 files changed, 88 insertions(+), 0 deletions(-) create mode 100755 tests/framework/json_parse.py
repo.or.cz automatic notification. Contact project admin jiri.bluebear.dluhos@gmail.com if you want to unsubscribe, or site admin admin@repo.or.cz if you receive no reply.