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 28f97c18a478cfe9e9144c3b9c151c1f784887d1 (commit) via 52a9dbdc6a7f20fabdcbe29d4ed576624e11351d (commit) from ccc06e628a27ed616222e32e32f0378644e0aae0 (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/28f97c18a478cfe9e9144c3b9c151c1f78488...
commit 28f97c18a478cfe9e9144c3b9c151c1f784887d1 Author: Cyril Hrubis metan@ucw.cz Date: Sat Jan 26 16:52:03 2013 +0100
tests: framework: New python runtests script.
Now the json result files are collected correctly.
diff --git a/tests/core/runtest.sh b/tests/core/runtest.sh deleted file mode 100755 index 7e20739..0000000 --- a/tests/core/runtest.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/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`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./WritePixel_testsuite.gen "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Context "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./GetPutPixel.gen "$@" diff --git a/tests/core/test_list.txt b/tests/core/test_list.txt new file mode 100644 index 0000000..458f6e4 --- /dev/null +++ b/tests/core/test_list.txt @@ -0,0 +1,4 @@ +# Core testsuite +WritePixel_testsuite.gen +Context +GetPutPixel.gen diff --git a/tests/gfx/runtest.sh b/tests/gfx/runtest.sh deleted file mode 100755 index 2dc6ddf..0000000 --- a/tests/gfx/runtest.sh +++ /dev/null @@ -1,24 +0,0 @@ -#!/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`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./gfx_benchmark "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./HLine "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./VLine "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Line "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Circle "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./FillCircle "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Ellipse "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./CircleSeg "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./Polygon "$@" - -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./PutPixelAA "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./HLineAA "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./LineAA "$@" diff --git a/tests/gfx/test_list.txt b/tests/gfx/test_list.txt new file mode 100644 index 0000000..0368b0f --- /dev/null +++ b/tests/gfx/test_list.txt @@ -0,0 +1,14 @@ +# GFX test list + +HLine +VLine +Line +Circle +FillCircle +Ellipse +CircleSeg +Polygon + +PutPixelAA +HLineAA +LineAA diff --git a/tests/loaders/runtest.sh b/tests/loaders/runtest.sh deleted file mode 100755 index e92c0c4..0000000 --- a/tests/loaders/runtest.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/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`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./loaders_suite "$@" -LD_PRELOAD=`pwd`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./PNG "$@" diff --git a/tests/loaders/test_list.txt b/tests/loaders/test_list.txt new file mode 100644 index 0000000..f4a8fe1 --- /dev/null +++ b/tests/loaders/test_list.txt @@ -0,0 +1,3 @@ +# Loaders testsuite +loaders_suite +PNG diff --git a/tests/runtests.py b/tests/runtests.py new file mode 100755 index 0000000..9f3704e --- /dev/null +++ b/tests/runtests.py @@ -0,0 +1,117 @@ +#!/usr/bin/env python +# +# This is a simple glue script to run the tests and collect the results +# + +# +# We expect simple structure i.e. the tests_dir contains directories with +# tests, each directory that contains tests has test_list.txt with a list of +# tests to run. The structure is then mirrored in the results_dir filled with +# json logs. +# + +import os +import datetime + +# +# Relative path to root directory containing tests +# +tests_dir='.' + +# +# Results directory prefix +# +results_dir='results' + +# +# Relative path to the directory with GP libraries to run tests against +# +build_dir='../../build' + +# +# 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. +# +runline_prep='export LIBC_FATAL_STDERR_=1;' + +# +# Relative path, from the current directory, to the framework preload library. +# +framework_lib='framework/libtst_preload.so' + +debug = 0 + +def globpath(path): + return os.getcwd() + '/' + path + +# +# Reads test_list.txt test file and executes tests one after another +# +def run_test(resdir, tstdir, runtest): + f = open(runtest, 'r') + lines = f.readlines() + f.close() + + for line in lines: + # ignore comments + if (line[0] == '#'): + continue + # and blanks + if (line.isspace()): + continue + + line = line.strip(); + + # + # This is a little hairy but what it does is to constructs correct + # paths to preload and dynamic libraries and runs the test. + # + runline = runline_prep + ' ' + runline += 'export LD_PRELOAD="' + globpath(framework_lib) + '"; ' + runline += 'export LD_LIBRARY_PATH="' + globpath(build_dir) + '"; ' + runline += 'cd ' + tstdir + ' && ./' + line + ' -o "' + globpath(resdir) + '"' + + if debug >= 2: + print(" LINE: %s" % runline) + + os.system(runline) + +# +# Discovers tests in directories. +# +def run_tests(resdir, testsdir): + + if debug >= 1: + print('Looking for tests in "%s"' % testsdir) + + for root, dirs, _ in os.walk(testsdir): + for name in dirs: + + path = root + '/' + name + + if debug >= 2: + print('Looking into dir "%s"' % path) + + runtest = path + '/test_list.txt' + + if (os.access(runtest, os.R_OK)): + # Create result directory + curresdir = resdir + '/' + name + os.mkdir(curresdir) + # Run tests + run_test(curresdir, path, runtest) + +def main(): + now = datetime.datetime.now() + resdir = '%s_%i-%02i-%02i_%02i-%02i-%02i' % (results_dir, now.year, now.month, + now.day, now.hour, now.minute, now.second) + print('Creating result directory "%s"' % resdir) + os.mkdir(resdir) + + run_tests(resdir, tests_dir) + +if __name__ == '__main__': + main() diff --git a/tests/runtests.sh b/tests/runtests.sh deleted file mode 100755 index f15668b..0000000 --- a/tests/runtests.sh +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -DIRS="core loaders gfx" - -for i in $DIRS; do - cd $i - ./runtest.sh $@ - cd .. -done
http://repo.or.cz/w/gfxprim.git/commit/52a9dbdc6a7f20fabdcbe29d4ed576624e113...
commit 52a9dbdc6a7f20fabdcbe29d4ed576624e11351d Author: Cyril Hrubis metan@ucw.cz Date: Sat Jan 26 16:40:27 2013 +0100
tests: framework: Add log output dir option.
diff --git a/tests/framework/tst_main.c b/tests/framework/tst_main.c index d1c6474..a45b2c6 100644 --- a/tests/framework/tst_main.c +++ b/tests/framework/tst_main.c @@ -30,6 +30,7 @@ extern const struct tst_suite tst_suite;
/* defined in tst_suite.c */ extern int tst_suite_verbose; +extern const char *tst_log_dir;
void print_help(void) { @@ -38,6 +39,7 @@ void print_help(void) fprintf(stderr, "-l list all testsn"); fprintf(stderr, "-t name runs single test by namen"); fprintf(stderr, "-v turns on verbose moden"); + fprintf(stderr, "-o test log output dirn"); fprintf(stderr, "without any option, all tests are executedn"); }
@@ -45,7 +47,7 @@ int main(int argc, char *argv[]) { int opt;
- while ((opt = getopt(argc, argv, "hlt:v")) != -1) { + while ((opt = getopt(argc, argv, "hlo:t:v")) != -1) { switch (opt) { case 'l': tst_list_suite(&tst_suite); @@ -62,6 +64,9 @@ int main(int argc, char *argv[]) case 'v': tst_suite_verbose = 1; break; + case 'o': + tst_log_dir = optarg; + break; default: print_help(); return 1; diff --git a/tests/framework/tst_suite.c b/tests/framework/tst_suite.c index 924be43..2bb8455 100644 --- a/tests/framework/tst_suite.c +++ b/tests/framework/tst_suite.c @@ -36,6 +36,7 @@ #define NAME_PADD 35
int tst_suite_verbose = 0; +const char *tst_log_dir = NULL;
static void test_job_report(const struct tst_job *job) { @@ -127,7 +128,8 @@ static int run_test(const struct tst_test *test, FILE *json) * child and parent and the lines in the resulting * file would be repeated several times. */ - fflush(json); + if (json) + fflush(json);
tst_job_run(&job); tst_job_wait(&job); @@ -135,7 +137,8 @@ static int run_test(const struct tst_test *test, FILE *json) /* report result into stdout */ test_job_report(&job);
- tst_log_append(&job, json); + if (json) + tst_log_append(&job, json);
/* Free the test message store */ tst_msg_clear(&job.store); @@ -152,8 +155,14 @@ void tst_run_suite(const struct tst_suite *suite, const char *tst_name)
fprintf(stderr, "Running e[1;37m%se[0mnn", suite->suite_name);
- //TODO: - FILE *json = tst_log_open(suite, "log.json"); + FILE *json = NULL; + + if (tst_log_dir) { + char buf[512]; + snprintf(buf, sizeof(buf), "%s/%s.json", + tst_log_dir, suite->suite_name); + json = tst_log_open(suite, buf); + }
for (i = 0; suite->tests[i].name != NULL; i++) { if (tst_name == NULL || !strcmp(tst_name, suite->tests[i].name)) { @@ -165,7 +174,8 @@ void tst_run_suite(const struct tst_suite *suite, const char *tst_name) } }
- tst_log_close(json); + if (json) + tst_log_close(json);
float percents;
-----------------------------------------------------------------------
Summary of changes: tests/core/runtest.sh | 14 ----- tests/core/test_list.txt | 4 ++ tests/framework/tst_main.c | 7 ++- tests/framework/tst_suite.c | 20 ++++++-- tests/gfx/runtest.sh | 24 --------- tests/gfx/test_list.txt | 14 +++++ tests/loaders/runtest.sh | 13 ----- tests/loaders/test_list.txt | 3 + tests/runtests.py | 117 +++++++++++++++++++++++++++++++++++++++++++ tests/runtests.sh | 9 --- 10 files changed, 159 insertions(+), 66 deletions(-) delete mode 100755 tests/core/runtest.sh create mode 100644 tests/core/test_list.txt delete mode 100755 tests/gfx/runtest.sh create mode 100644 tests/gfx/test_list.txt delete mode 100755 tests/loaders/runtest.sh create mode 100644 tests/loaders/test_list.txt create mode 100755 tests/runtests.py delete mode 100755 tests/runtests.sh
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.