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 d20862dc07b9b8858ca929d9b91caa1eb6d88bbc (commit) from 9ac2eb1478d0582c8e52b467aab9bf5a40a33fd2 (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/d20862dc07b9b8858ca929d9b91caa1eb6d88...
commit d20862dc07b9b8858ca929d9b91caa1eb6d88bbc Author: Cyril Hrubis metan@ucw.cz Date: Sat Oct 13 18:23:39 2012 +0200
tests: core: Start core tests using new framework.
diff --git a/tests/core/Makefile b/tests/core/Makefile index c848cb0..bafa3c2 100644 --- a/tests/core/Makefile +++ b/tests/core/Makefile @@ -2,14 +2,24 @@ TOPDIR=../..
include $(TOPDIR)/pre.mk
+#CSOURCES=$(shell echo *.c) + +# hack LIBNAME=core -TESTSUITE=core_suite -LDLIBS+=-lGP -L$(TOPDIR)/build/ -lcheck -lm -lSDL -GENSOURCES+=GP_Convert.test.gen.c GP_WritePixel.test.gen.c - GP_MixPixels.test.gen.c
-all: $(TESTSUITE) +LDFLAGS+=-L../framework/ -L$(TOPDIR)/build/ +LDLIBS+=$(shell $(TOPDIR)/gfxprim-config --libs --libs-loaders) +LDLIBS+=-ltst_preload -ldl -ltst +CFLAGS+=-I../framework/
-include $(TOPDIR)/tests.mk -include $(TOPDIR)/post.mk +GENSOURCES+=WritePixel_testsuite.gen.c + +APPS=WritePixel_testsuite.gen
+$(APPS): ../framework/libtst.a + +CLEAN+=log.html log.json + +include $(TOPDIR)/gen.mk +include $(TOPDIR)/app.mk +include $(TOPDIR)/post.mk diff --git a/tests/core/WritePixel_testsuite.gen.c.t b/tests/core/WritePixel_testsuite.gen.c.t new file mode 100644 index 0000000..a554e9b --- /dev/null +++ b/tests/core/WritePixel_testsuite.gen.c.t @@ -0,0 +1,122 @@ +/***************************************************************************** + * This file is part of gfxprim library. * + * * + * Gfxprim is free software; you can redistribute it and/or * + * modify it under the terms of the GNU Lesser General Public * + * License as published by the Free Software Foundation; either * + * version 2.1 of the License, or (at your option) any later version. * + * * + * Gfxprim is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * + * Lesser General Public License for more details. * + * * + * You should have received a copy of the GNU Lesser General Public * + * License along with gfxprim; if not, write to the Free Software * + * Foundation, Inc., 51 Franklin Street, Fifth Floor, * + * Boston, MA 02110-1301 USA * + * * + * Copyright (C) 2009-2012 Cyril Hrubis metan@ucw.cz * + * * + *****************************************************************************/ + +%% extends "base.test.c.t" + +%% block body + +#include <stdio.h> + +#include "GP_WritePixel.h" + +#include "tst_test.h" + +static void dump_buffer(const char *name, char *buf, unsigned int buf_len) +{ + unsigned int i; + + printf("%s:n{", name); + + for (i = 0; i < buf_len; i++) { + printf("%i", !!buf[i]); + + if (i != buf_len - 1) + printf(", "); + + if (i % 26 == 25) + printf("n "); + } + + printf("}n"); +} + +/* + * Compares two statically defined buffers + */ +#define COMPARE_BUFFERS(id, buf1, buf2) do { + unsigned int buf1_len = sizeof(buf1)/sizeof(*buf1); + unsigned int buf2_len = sizeof(buf2)/sizeof(*buf2); + unsigned int i; + + if (buf1_len != buf2_len) { + tst_report(0, "Invalid buffers"); + return TST_FAILED; + } + + for (i = 0; i < buf1_len; i++) + if(buf1[i] != buf2[i]) { + printf("%sn", id); + dump_buffer("wrote", buf1, buf1_len); + dump_buffer("gen", buf2, buf2_len); + tst_report(0, "Buffers are different"); + return TST_FAILED; + } + + return TST_SUCCESS; +} while (0) + +%% for pixelsize in [8, 16, 24, 32] +%% for offset in range(0, 4) +%% for len in range(0, 6) +%% for aligment in [0, 1] +static int WritePixel{{ "_%i_%i_%i_%i"|format(pixelsize, offset, len, aligment) }}(void) +//, {{ ""offset=%i, len=%i, aligment=%i,""|format(offset, len, aligment) }}) +{ + char write_buf[{{ 25 * pixelsize//8 }}] = {}; + char gen_buf[{{ 25 * pixelsize//8 }}] = {}; + + /* + * Fill the compare buffer + */ +%% for i in range(0, len) +%% for j in range(0, pixelsize//8) + gen_buf[{{aligment + offset * pixelsize//8 + i * pixelsize//8 + j}}] = 0xff; +%% endfor +%% endfor + + GP_WritePixels{{ pixelsize }}bpp(write_buf + {{aligment + offset * pixelsize//8}}, {{ len }}, 0xffffffff>>{{32 - pixelsize}}); + + COMPARE_BUFFERS({{""p=%i o=%i l=%i a=%i""|format(pixelsize, offset, len, aligment)}}, write_buf, gen_buf); +} +%% endfor +%% endfor +%% endfor +%% endfor + +const struct tst_suite tst_suite = { + .suite_name = "WritePixel Testsuite", + .tests = { +%% for pixelsize in [8, 16, 24, 32] +%% for offset in range(0, 4) +%% for len in range(0, 6) +%% for aligment in [0, 1] + {.name = "WritePixel {{ pixelsize }} {{ offset }} {{ len }} {{ aligment }}", + .tst_fn = WritePixel{{ "_%i_%i_%i_%i"|format(pixelsize, offset, len, aligment) }}}, +%% endfor +%% endfor +%% endfor +%% endfor + {.name = NULL} + } +}; + +%% endblock body diff --git a/tests/core/runtest.sh b/tests/core/runtest.sh new file mode 100755 index 0000000..0a9821e --- /dev/null +++ b/tests/core/runtest.sh @@ -0,0 +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`/../framework/libtst_preload.so LD_LIBRARY_PATH=../../build/ ./WritePixel_testsuite.gen "$@" diff --git a/tests/core/GP_Blit.test.c b/tests/core_old/GP_Blit.test.c similarity index 100% rename from tests/core/GP_Blit.test.c rename to tests/core_old/GP_Blit.test.c diff --git a/tests/core/GP_Common.test.c b/tests/core_old/GP_Common.test.c similarity index 100% rename from tests/core/GP_Common.test.c rename to tests/core_old/GP_Common.test.c diff --git a/tests/core/GP_Convert.test.c b/tests/core_old/GP_Convert.test.c similarity index 100% rename from tests/core/GP_Convert.test.c rename to tests/core_old/GP_Convert.test.c diff --git a/tests/core/GP_Convert.test.gen.c.t b/tests/core_old/GP_Convert.test.gen.c.t similarity index 100% rename from tests/core/GP_Convert.test.gen.c.t rename to tests/core_old/GP_Convert.test.gen.c.t diff --git a/tests/core/GP_Counter.test.c b/tests/core_old/GP_Counter.test.c similarity index 100% rename from tests/core/GP_Counter.test.c rename to tests/core_old/GP_Counter.test.c diff --git a/tests/core/GP_MixPixels.test.gen.c.t b/tests/core_old/GP_MixPixels.test.gen.c.t similarity index 100% rename from tests/core/GP_MixPixels.test.gen.c.t rename to tests/core_old/GP_MixPixels.test.gen.c.t diff --git a/tests/core/GP_WritePixel.test.gen.c.t b/tests/core_old/GP_WritePixel.test.gen.c.t similarity index 100% rename from tests/core/GP_WritePixel.test.gen.c.t rename to tests/core_old/GP_WritePixel.test.gen.c.t diff --git a/tests/core/Makefile b/tests/core_old/Makefile similarity index 100% copy from tests/core/Makefile copy to tests/core_old/Makefile
-----------------------------------------------------------------------
Summary of changes: tests/core/Makefile | 24 +++- tests/core/WritePixel_testsuite.gen.c.t | 122 ++++++++++++++++++++ tests/{loaders => core}/runtest.sh | 2 +- tests/{core => core_old}/GP_Blit.test.c | 0 tests/{core => core_old}/GP_Common.test.c | 0 tests/{core => core_old}/GP_Convert.test.c | 0 tests/{core => core_old}/GP_Convert.test.gen.c.t | 0 tests/{core => core_old}/GP_Counter.test.c | 0 tests/{core => core_old}/GP_MixPixels.test.gen.c.t | 0 .../{core => core_old}/GP_WritePixel.test.gen.c.t | 0 tests/{core => core_old}/Makefile | 0 11 files changed, 140 insertions(+), 8 deletions(-) create mode 100644 tests/core/WritePixel_testsuite.gen.c.t copy tests/{loaders => core}/runtest.sh (89%) rename tests/{core => core_old}/GP_Blit.test.c (100%) rename tests/{core => core_old}/GP_Common.test.c (100%) rename tests/{core => core_old}/GP_Convert.test.c (100%) rename tests/{core => core_old}/GP_Convert.test.gen.c.t (100%) rename tests/{core => core_old}/GP_Counter.test.c (100%) rename tests/{core => core_old}/GP_MixPixels.test.gen.c.t (100%) rename tests/{core => core_old}/GP_WritePixel.test.gen.c.t (100%) copy tests/{core => core_old}/Makefile (100%)
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.