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 f6e4b62561d2fa6b7bcc94a24ba3fdaa1763aafe (commit) via bd67135bcd6d8ac8a8df924588988663837be998 (commit) via bbb09186311fc102ad68bfd94156ba4982176b83 (commit) from 9e00a730ea2ab2545b46298056b32841ad3500d4 (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/f6e4b62561d2fa6b7bcc94a24ba3fdaa1763a...
commit f6e4b62561d2fa6b7bcc94a24ba3fdaa1763aafe Author: Cyril Hrubis metan@ucw.cz Date: Sat Oct 13 09:34:46 2012 +0200
tests: framework: Count correctly passed and skipped.
diff --git a/tests/framework/tst_test.c b/tests/framework/tst_test.c index 2cc94a5..1981302 100644 --- a/tests/framework/tst_test.c +++ b/tests/framework/tst_test.c @@ -87,15 +87,19 @@ void tst_run_suite(const struct tst_suite *suite, const char *tst_name) if (tst_name == NULL || !strcmp(tst_name, suite->tests[i].name)) { ret = run_test(&suite->tests[i], html, json); counters[ret]++; - counter++; + + if (ret != TST_SKIPPED) + counter++; } }
tst_log_close(html, TST_LOG_HTML); tst_log_close(json, TST_LOG_JSON);
- fprintf(stderr, "nSummary: succedded %u out of %u (%.2f%%)n", - counters[0], counter, 100.00 * counters[0] / counter); + fprintf(stderr, "nSummary: succedded %u out of " + "%u %.2f%% (skipped %u)n", + counters[0], counter, 100.00 * counters[0] / counter, + counters[TST_SKIPPED]); }
void tst_list_suite(const struct tst_suite *suite)
http://repo.or.cz/w/gfxprim.git/commit/bd67135bcd6d8ac8a8df924588988663837be...
commit bd67135bcd6d8ac8a8df924588988663837be998 Author: Cyril Hrubis metan@ucw.cz Date: Fri Oct 12 23:44:37 2012 +0200
tests: framework: Add Floating Point Exception error.
diff --git a/tests/framework/test.c b/tests/framework/test.c index a47d67d..48fa872 100644 --- a/tests/framework/test.c +++ b/tests/framework/test.c @@ -199,6 +199,14 @@ static int res_fn(void) return TST_SUCCESS; }
+static int fpe_fn(void) +{ + /* its volatile so compiler doesn't detect the division by zero */ + volatile int i = 0; + + return 1/i; +} + const struct tst_suite tst_suite = { .suite_name = "Testing Framework Example", .tests = { @@ -216,6 +224,7 @@ const struct tst_suite tst_suite = { {.name = "Failed FILE", .tst_fn = fail_FILE, .flags = TST_TMPDIR}, {.name = "Resource", .tst_fn = res_fn, .flags = TST_TMPDIR, .res_path = "test.c"}, + {.name = "Floating point exception", .tst_fn = fpe_fn}, {.name = NULL}, } }; diff --git a/tests/framework/tst_job.c b/tests/framework/tst_job.c index 79ae3e2..b27b358 100644 --- a/tests/framework/tst_job.c +++ b/tests/framework/tst_job.c @@ -87,6 +87,9 @@ static void stop_test(struct tst_job *job) case TST_ABORTED: result = "[ e[1;31mABORTEDe[0m ]"; break; + case TST_FPE: + result = "[ e[1;31mFP EXCEPTIONe[0m ]"; + break; case TST_MEMLEAK: result = "[ e[1;33mMEMLEAKe[0m ]"; break; @@ -455,6 +458,13 @@ void tst_job_wait(struct tst_job *job) case SIGALRM: job->result = TST_TIMEOUT; break; + /* + * Floating point exception, most likely + * division by zero (including integer division) + */ + case SIGFPE: + job->result = TST_FPE; + break; /* * abort() called most likely double free or malloc data * corruption diff --git a/tests/framework/tst_log.c b/tests/framework/tst_log.c index 5ab46a6..2991c0a 100644 --- a/tests/framework/tst_log.c +++ b/tests/framework/tst_log.c @@ -44,6 +44,8 @@ static const char *ret_to_bg_color(enum tst_ret ret) return "#800080"; case TST_ABORTED: return "#e00000"; + case TST_FPE: + return "#e00000"; case TST_MEMLEAK: return "#a0a000"; case TST_FAILED: @@ -70,6 +72,8 @@ static const char *ret_to_str(enum tst_ret ret) return "Timeout"; case TST_ABORTED: return "Aborted"; + case TST_FPE: + return "FP Exception"; case TST_MEMLEAK: return "Memory Leak"; case TST_FAILED: diff --git a/tests/framework/tst_test.h b/tests/framework/tst_test.h index c329112..195b040 100644 --- a/tests/framework/tst_test.h +++ b/tests/framework/tst_test.h @@ -30,6 +30,7 @@ enum tst_ret { TST_SIGSEGV, /* Test ended with SIGSEGV */ TST_TIMEOUT, /* Test hasn't finished in time */ TST_ABORTED, /* The abort() was called (possible double free) */ + TST_FPE, /* Floating point exception */ TST_MEMLEAK, /* Memory leak was detected */ TST_FAILED, /* Test failed */ TST_MAX = TST_FAILED+1,
http://repo.or.cz/w/gfxprim.git/commit/bbb09186311fc102ad68bfd94156ba4982176...
commit bbb09186311fc102ad68bfd94156ba4982176b83 Author: Cyril Hrubis metan@ucw.cz Date: Fri Oct 12 22:32:59 2012 +0200
tests: framework: Add resource path.
diff --git a/tests/framework/test.c b/tests/framework/test.c index 0e9e9df..a47d67d 100644 --- a/tests/framework/test.c +++ b/tests/framework/test.c @@ -191,6 +191,14 @@ static int skipped_fn(void) return TST_SKIPPED; }
+static int res_fn(void) +{ + if (access("test.c", R_OK) == 0) + tst_report(0, "File correctly copied"); + + return TST_SUCCESS; +} + const struct tst_suite tst_suite = { .suite_name = "Testing Framework Example", .tests = { @@ -206,6 +214,8 @@ const struct tst_suite tst_suite = { {.name = "Double free()", .tst_fn = double_free}, {.name = "Barrier allocation", .tst_fn = barrier_allocation}, {.name = "Failed FILE", .tst_fn = fail_FILE, .flags = TST_TMPDIR}, + {.name = "Resource", .tst_fn = res_fn, .flags = TST_TMPDIR, + .res_path = "test.c"}, {.name = NULL}, } }; diff --git a/tests/framework/tst_job.c b/tests/framework/tst_job.c index 227edd5..79ae3e2 100644 --- a/tests/framework/tst_job.c +++ b/tests/framework/tst_job.c @@ -146,16 +146,18 @@ static void remove_tmpdir(const char *path) }
/* - * Create temp directory and cd into it + * Create temp directory and cd into it, copy resources if needed */ -static void create_tmpdir(const char *name, char *template, size_t size) +static void prepare_tmpdir(const char *name, const char *res_path, + char *template, size_t size) { - char safe_name[256]; + char tmp[256]; + int ret;
/* Fix any funny characters in the test name */ - snprintf(safe_name, sizeof(safe_name), "%s", name); + snprintf(tmp, sizeof(tmp), "%s", name);
- char *s = safe_name; + char *s = tmp;
while (*s != '0') { if (!isalnum(*s)) @@ -164,13 +166,27 @@ static void create_tmpdir(const char *name, char *template, size_t size) }
/* Create template from test name */ - snprintf(template, size, "/tmp/ctest_%s_XXXXXX", safe_name); + snprintf(template, size, "/tmp/ctest_%s_XXXXXX", tmp);
if (mkdtemp(template) == NULL) { tst_warn("mkdtemp(%s) failed: %s", template, strerror(errno)); exit(TST_INTERR); }
+ /* Copy resources if needed */ + if (res_path != NULL) { + snprintf(tmp, sizeof(tmp), "cp -r '%s' '%s'", + res_path, template); + + ret = system(tmp); + + if (ret) { + tst_warn("failed to copy resource '%s'", res_path); + exit(TST_INTERR); + } + } + + if (chdir(template)) { tst_warn("chdir(%s) failed: %s", template, strerror(errno)); exit(TST_INTERR); @@ -297,7 +313,8 @@ void tst_job_run(struct tst_job *job)
/* Create directory in /tmp/ and chdir into it. */ if (job->test->flags & TST_TMPDIR) - create_tmpdir(job->test->name, template, sizeof(template)); + prepare_tmpdir(job->test->name, job->test->res_path, + template, sizeof(template));
/* * If timeout is specified, setup alarm. diff --git a/tests/framework/tst_test.h b/tests/framework/tst_test.h index 4eb97e0..c329112 100644 --- a/tests/framework/tst_test.h +++ b/tests/framework/tst_test.h @@ -49,7 +49,13 @@ enum tst_flags { };
struct tst_test { + /* test name */ const char *name; + /* + * Resurce path, file or directory which is copied to + * test directory before test is executed. + */ + const char *res_path; /* test function */ int (*tst_fn)(void); /* time limit in seconds 0 == unlimited */
-----------------------------------------------------------------------
Summary of changes: tests/framework/test.c | 19 +++++++++++++++++++ tests/framework/tst_job.c | 41 ++++++++++++++++++++++++++++++++++------- tests/framework/tst_log.c | 4 ++++ tests/framework/tst_test.c | 10 +++++++--- tests/framework/tst_test.h | 7 +++++++ 5 files changed, 71 insertions(+), 10 deletions(-)
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.