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 971eefd1c614dfb8969187f90dc32829889a874d (commit) via 4329359915f47fe2b4946869fc59e51a7b7da4a0 (commit) via fb0fefa324ac7b26f40cac96b49758551466bfaf (commit) via 89f6534f6c917d672c3312e15be3d2e74358f343 (commit) via 92bbfc390d6fb4b924e0b7f94626d981d794320a (commit) from b2c5eaa7e3f80fd1b2f3e45f70790d6440465e8f (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/971eefd1c614dfb8969187f90dc32829889a8...
commit 971eefd1c614dfb8969187f90dc32829889a874d Author: Cyril Hrubis metan@ucw.cz Date: Mon Aug 27 12:41:45 2012 +0200
tests: loaders: Add missing dependency on libtst.a
diff --git a/tests/loaders/Makefile b/tests/loaders/Makefile index 9a5aff5..5222d6b 100644 --- a/tests/loaders/Makefile +++ b/tests/loaders/Makefile @@ -10,6 +10,8 @@ CFLAGS+=-I../framework/
APPS=loaders_suite
+$(APPS): ../framework/libtst.a + CLEAN+=libtst_preload.so log.html log.json
include $(TOPDIR)/app.mk
http://repo.or.cz/w/gfxprim.git/commit/4329359915f47fe2b4946869fc59e51a7b7da...
commit 4329359915f47fe2b4946869fc59e51a7b7da4a0 Author: Cyril Hrubis metan@ucw.cz Date: Mon Aug 27 12:40:12 2012 +0200
tests: Add max stats to malloc check.
diff --git a/tests/framework/tst_log.c b/tests/framework/tst_log.c index dcdaced..6535ae8 100644 --- a/tests/framework/tst_log.c +++ b/tests/framework/tst_log.c @@ -77,6 +77,26 @@ static const char *ret_to_str(enum tst_ret ret) return "Unknown"; }
+static void bytes_human_readable(FILE *f, size_t bytes) +{ + if (bytes < 512) { + fprintf(f, "%zuB", bytes); + return; + } + + if (bytes < 1024 * 512) { + fprintf(f, "%.2fkB", (float)bytes / 1024); + return; + } + + if (bytes < 1024 * 1024 * 512) { + fprintf(f, "%.2fMB", (float)bytes / 1024 / 1024); + return; + } + + fprintf(f, "%.2fGB", (float)bytes / 1024 / 1024 / 1024); +} + static void malloc_stats_html(struct tst_job *job, FILE *f, const char *padd) { /* Create innter table */ @@ -97,6 +117,14 @@ static void malloc_stats_html(struct tst_job *job, FILE *f, const char *padd) fprintf(f, "%s </td>n", padd); fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); + fprintf(f, "%s <small>Max size</small>n", padd); + fprintf(f, "%s </td>n", padd); + + fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); + fprintf(f, "%s <small>Max chunks</small>n", padd); + fprintf(f, "%s </td>n", padd); + + fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); fprintf(f, "%s <small>Lost size</small>n", padd); fprintf(f, "%s </td>n", padd); @@ -110,8 +138,9 @@ static void malloc_stats_html(struct tst_job *job, FILE *f, const char *padd) fprintf(f, "%s <tr>n", padd);
fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); - fprintf(f, "%s <center><small>%zu</small></center>n", - padd, job->malloc_stats.total_size); + fprintf(f, "%s <center><small>", padd); + bytes_human_readable(f, job->malloc_stats.total_size); + fprintf(f, "</small></center>n"); fprintf(f, "%s </td>n", padd); fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); @@ -120,8 +149,20 @@ static void malloc_stats_html(struct tst_job *job, FILE *f, const char *padd) fprintf(f, "%s </td>n", padd); fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); - fprintf(f, "%s <center><small>%zu</small></center>n", - padd, job->malloc_stats.lost_size); + fprintf(f, "%s <center><small>", padd); + bytes_human_readable(f, job->malloc_stats.max_size); + fprintf(f, "</small></center>n"); + fprintf(f, "%s </td>n", padd); + + fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); + fprintf(f, "%s <center><small>%u</small></center>n", + padd, job->malloc_stats.max_chunks); + fprintf(f, "%s </td>n", padd); + + fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); + fprintf(f, "%s <center><small>", padd); + bytes_human_readable(f, job->malloc_stats.lost_size); + fprintf(f, "</small></center>n"); fprintf(f, "%s </td>n", padd); fprintf(f, "%s <td bgcolor="#ffffaa">n", padd); @@ -147,7 +188,7 @@ static int append_html(struct tst_job *job, FILE *f) fprintf(f, "%s<tr>n", padd); fprintf(f, "%s <td bgcolor="#ccccee">%s </td>n", padd, job->test->name); fprintf(f, "%s <td bgcolor="#ccccee">n", padd); - fprintf(f, "%s <small><font color="#222">%i.%03is %i.%03is</font></small>", + fprintf(f, "%s <center><small><font color="#222">%i.%03is %i.%03is</font></small></center>", padd, sec, nsec/1000000, (int)job->cpu_time.tv_sec, (int)job->cpu_time.tv_nsec/1000000); fprintf(f, "%s </td>n", padd); fprintf(f, "%s <td bgcolor="%s"><center><font color="white"> %s </td></center>n", padd, @@ -197,6 +238,10 @@ static int append_malloc_stats_json(struct tst_job *job, FILE *f) job->malloc_stats.total_size); fprintf(f, "tttt"Total Chunks": %u,n", job->malloc_stats.total_chunks); + fprintf(f, "tttt"Max Size": %zi,n", + job->malloc_stats.max_size); + fprintf(f, "tttt"Max Chunks": %u,n", + job->malloc_stats.max_chunks); fprintf(f, "tttt"Lost Size": %zi,n", job->malloc_stats.lost_size); fprintf(f, "tttt"Lost Chunks": %un", diff --git a/tests/framework/tst_preload.c b/tests/framework/tst_preload.c index 86927aa..7241926 100644 --- a/tests/framework/tst_preload.c +++ b/tests/framework/tst_preload.c @@ -44,14 +44,20 @@ static size_t cur_size = 0; static unsigned int cur_chunks = 0; static size_t total_size = 0; static unsigned int total_chunks = 0; - +/* Maximal allocated size at a time */ +static size_t max_size = 0; +static unsigned int max_chunks = 0;
void tst_malloc_check_report(struct malloc_stats *stats) { - stats->lost_size = cur_size; - stats->lost_chunks = cur_chunks; stats->total_size = total_size; stats->total_chunks = total_chunks; + + stats->max_size = max_size; + stats->max_chunks = max_chunks; + + stats->lost_size = cur_size; + stats->lost_chunks = cur_chunks; }
#define MAX_CHUNKS 100 @@ -83,6 +89,12 @@ static void add_chunk(size_t size, void *ptr) cur_chunks++; total_size += size; total_chunks++; + + if (cur_size > max_size) + max_size = cur_size; + + if (cur_chunks > max_chunks) + max_chunks = cur_chunks; }
static void rem_chunk(void *ptr) diff --git a/tests/framework/tst_preload.h b/tests/framework/tst_preload.h index 36bb41a..d103e8c 100644 --- a/tests/framework/tst_preload.h +++ b/tests/framework/tst_preload.h @@ -34,9 +34,21 @@ void tst_malloc_check_start(void); void tst_malloc_check_stop(void);
struct malloc_stats { + /* + * Sum of all alocated chunks. + */ size_t total_size; unsigned int total_chunks;
+ /* + * Maximal allocated size and number of chunks at any time. + */ + size_t max_size; + unsigned int max_chunks; + + /* + * Memory that was allocated but not freed + */ size_t lost_size; unsigned int lost_chunks; };
http://repo.or.cz/w/gfxprim.git/commit/fb0fefa324ac7b26f40cac96b49758551466b...
commit fb0fefa324ac7b26f40cac96b49758551466bfaf Author: Cyril Hrubis metan@ucw.cz Date: Mon Aug 27 12:14:46 2012 +0200
tests: loaders: Add more tests.
diff --git a/tests/loaders/loaders_suite.c b/tests/loaders/loaders_suite.c index 1f05961..cb7f398 100644 --- a/tests/loaders/loaders_suite.c +++ b/tests/loaders/loaders_suite.c @@ -120,6 +120,107 @@ static int test_JPG_Load_fail(void) return TST_SUCCESS; }
+static int abort_callback(GP_ProgressCallback *self __attribute__((unused))) +{ + return 1; +} + +/* + * We test that a correct cleanup is done after aborting the image load from a + * callback. + */ +static int test_PNG_Save_abort(void) +{ + GP_Context *img; + + img = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888); + + GP_ProgressCallback callback = {.callback = abort_callback}; + + if (GP_SavePNG(img, "test.png", &callback) == 0) { + tst_report(0, "Failed to save PNG saving"); + return TST_FAILED; + } + + int saved_errno = errno; + + if (saved_errno != ECANCELED) { + tst_report(0, "Expected errno = ECANCELED, have %s", + strerror(saved_errno)); + return TST_FAILED; + } + + GP_ContextFree(img); + + return TST_SUCCESS; +} + +static int test_PNG_Load_abort(void) +{ + GP_Context *img; + + img = GP_ContextAlloc(100, 100, GP_PIXEL_RGB888); + + if (GP_SavePNG(img, "test.png", NULL)) { + tst_report(0, "Failed to save PNG: %s", strerror(errno)); + return TST_FAILED; + } + + GP_ContextFree(img); + + GP_ProgressCallback callback = {.callback = abort_callback}; + + img = GP_LoadPNG("test.png", &callback); + + int saved_errno = errno; + + if (img != NULL) { + tst_report(0, "Failed to abort PNG loading"); + return TST_FAILED; + } + + if (saved_errno != ECANCELED) { + tst_report(0, "Expected errno = ECANCELED, have %s", + strerror(saved_errno)); + return TST_FAILED; + } + + return TST_SUCCESS; +} + +/* + * PNG stress test, let it save and load 10MB image. + */ +static int test_PNG_stress(void) +{ + GP_Context *img; + + img = GP_ContextAlloc(2000, 2000, GP_PIXEL_RGB888); + + if (img == NULL) { + tst_report(0, "GP_ContextAlloc failed"); + return TST_FAILED; + } + + if (GP_SavePNG(img, "test.png", NULL)) { + tst_report(0, "GP_SavePNG failed with: %s", strerror(errno)); + return TST_FAILED; + } + + GP_ContextFree(img); + + img = GP_LoadPNG("test.png", NULL); + + if (img == NULL) { + tst_report(0, "GP_LoadPNG failed with: %s", strerror(errno)); + return TST_FAILED; + } + + GP_ContextFree(img); + + return TST_SUCCESS; +} + const struct tst_suite tst_suite = { .suite_name = "Image Loaders testsuite", .tests = { @@ -131,6 +232,12 @@ const struct tst_suite tst_suite = { .flags = TST_TMPDIR}, {.name = "JPG Load fail", .tst_fn = test_JPG_Load_fail, .flags = TST_TMPDIR}, + {.name = "PNG Load abort", .tst_fn = test_PNG_Load_abort, + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + {.name = "PNG Save abort", .tst_fn = test_PNG_Save_abort, + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, + {.name = "PNG stress", .tst_fn = test_PNG_stress, + .flags = TST_TMPDIR | TST_CHECK_MALLOC}, {.name = NULL}, } };
http://repo.or.cz/w/gfxprim.git/commit/89f6534f6c917d672c3312e15be3d2e74358f...
commit 89f6534f6c917d672c3312e15be3d2e74358f343 Author: Cyril Hrubis metan@ucw.cz Date: Mon Aug 27 12:14:22 2012 +0200
tests: Further edhance test job output.
diff --git a/tests/framework/tst_job.c b/tests/framework/tst_job.c index 469f22d..652b038 100644 --- a/tests/framework/tst_job.c +++ b/tests/framework/tst_job.c @@ -58,6 +58,8 @@ void tst_diff_timespec(int *sec, int *nsec, struct timespec *start, } }
+#define NAME_PADD 24 + static void stop_test(struct tst_job *job) { const char *name = job->test->name; @@ -68,33 +70,39 @@ static void stop_test(struct tst_job *job)
switch (job->result) { case TST_SUCCESS: - result = "e[1;32mSUCCESSe[0m"; + result = "[ e[1;32mSUCCESSe[0m ]"; break; case TST_INTERR: - result = "e[1;31mINTERNAL ERRORe[0m"; + result = "[ e[1;31mINTERNAL ERRORe[0m ]"; break; case TST_SIGSEGV: - result = "e[1;31mSEGFAULTe[0m"; + result = "[ e[1;31mSEGFAULTe[0m ]"; break; case TST_TIMEOUT: - result = "e[1;35mTIMEOUTe[0m"; + result = "[ e[1;35mTIMEOUTe[0m ]"; break; case TST_ABORTED: - result = "e[1;31mABORTEDe[0m"; + result = "[ e[1;31mABORTEDe[0m ]"; break; case TST_MEMLEAK: - result = "e[1;33mMEMLEAKe[0m"; + result = "[ e[1;33mMEMLEAKe[0m ]"; break; case TST_FAILED: - result = "e[1;31mFAILUREe[0m"; + result = "[ e[1;31mFAILUREe[0m ]"; break; case TST_MAX: break; } - fprintf(stderr, "e[1;37m%se[0m finished " - "(Time %i.%03is, CPU %i.%03is) %sn", - name, sec, nsec/1000000, + fprintf(stderr, "e[1;37m%se[0m", name); + + int i; + + for (i = strlen(name); i < NAME_PADD; i++) + fprintf(stderr, " "); + + fprintf(stderr, " finished (Time %i.%03is, CPU %i.%03is) %sn", + sec, nsec/1000000, (int)job->cpu_time.tv_sec, (int)job->cpu_time.tv_nsec/1000000, result); @@ -104,6 +112,8 @@ static void stop_test(struct tst_job *job)
/* Now print test message store */ tst_msg_print(&job->store); + + fprintf(stderr, "------------------------------------------------------------------------------- n"); }
/* @@ -267,11 +277,11 @@ void tst_job_run(struct tst_job *job) }
/* 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", stderr)) + tst_warn("freopen(stderr) failed: %s", strerror(errno));
-// if (freopen("/dev/null", "w", stdout)) -// 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)
http://repo.or.cz/w/gfxprim.git/commit/92bbfc390d6fb4b924e0b7f94626d981d7943...
commit 92bbfc390d6fb4b924e0b7f94626d981d794320a Author: Cyril Hrubis metan@ucw.cz Date: Mon Aug 27 11:14:17 2012 +0200
doc: Fix typos.
diff --git a/doc/drawing_api.txt b/doc/drawing_api.txt index a7f65c9..75b6aa2 100644 --- a/doc/drawing_api.txt +++ b/doc/drawing_api.txt @@ -253,7 +253,7 @@ GP_RetCode GP_Text(GP_Context *context, const GP_TextStyle *style,
Draws text at the position x and y; the alignment of the text in relation to the point is specified by alignment flags. -If the 'style' argument is NULL, a default style is used. +If the 'style' argument is 'NULL', a default style is used.
The text size can be computed by following functions:
diff --git a/doc/environment_variables.txt b/doc/environment_variables.txt index 71e3b91..dec32e7 100644 --- a/doc/environment_variables.txt +++ b/doc/environment_variables.txt @@ -25,6 +25,6 @@ GP_DEBUG ~~~~~~~~
The 'GP_DEBUG' environment variable may be used to set library debug level. -The variable and its value is used only once a the time first debug message is -about to be printed. +The variable and its value is used only once at the time first debug message +is about to be printed.
-----------------------------------------------------------------------
Summary of changes: doc/drawing_api.txt | 2 +- doc/environment_variables.txt | 4 +- tests/framework/tst_job.c | 38 +++++++++----- tests/framework/tst_log.c | 55 +++++++++++++++++++-- tests/framework/tst_preload.c | 18 ++++++- tests/framework/tst_preload.h | 12 +++++ tests/loaders/Makefile | 2 + tests/loaders/loaders_suite.c | 107 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 213 insertions(+), 25 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.