seed r680 - in trunk: . libseed tests tests/c
- From: hortont svn gnome org
- To: svn-commits-list gnome org
- Subject: seed r680 - in trunk: . libseed tests tests/c
- Date: Thu, 8 Jan 2009 07:53:35 +0000 (UTC)
Author: hortont
Date: Thu Jan 8 07:53:34 2009
New Revision: 680
URL: http://svn.gnome.org/viewvc/seed?rev=680&view=rev
Log:
Preliminary support for C tests.
Added:
trunk/tests/c/
trunk/tests/c/Makefile.am
trunk/tests/c/test-common.h
trunk/tests/c/test-main.c
trunk/tests/c/test-tests.c
Modified:
trunk/configure.ac
trunk/libseed/seed.h
trunk/ltmain.sh
trunk/tests/Makefile.am
Modified: trunk/configure.ac
==============================================================================
--- trunk/configure.ac (original)
+++ trunk/configure.ac Thu Jan 8 07:53:34 2009
@@ -128,6 +128,7 @@
extensions/Makefile
tests/Makefile
tests/javascript/Makefile
+tests/c/Makefile
doc/Makefile
doc/modules/Makefile
doc/tutorial-standalone/Makefile
Modified: trunk/libseed/seed.h
==============================================================================
--- trunk/libseed/seed.h (original)
+++ trunk/libseed/seed.h Thu Jan 8 07:53:34 2009
@@ -308,25 +308,7 @@
SeedObjectConvertToTypeCallback convert_to_type;
} seed_class_definition;
-seed_class_definition seed_empty_class = {
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
- 0,
-};
+#define seed_empty_class { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,};
SeedClass seed_create_class(seed_class_definition * def);
Modified: trunk/ltmain.sh
==============================================================================
--- trunk/ltmain.sh (original)
+++ trunk/ltmain.sh Thu Jan 8 07:53:34 2009
@@ -65,7 +65,7 @@
# compiler: $LTCC
# compiler flags: $LTCFLAGS
# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu5
+# $progname: (GNU libtool) 2.2.4 Debian-2.2.4-0ubuntu4
# automake: $automake_version
# autoconf: $autoconf_version
#
@@ -73,7 +73,7 @@
PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION="2.2.4 Debian-2.2.4-0ubuntu5"
+VERSION="2.2.4 Debian-2.2.4-0ubuntu4"
TIMESTAMP=""
package_revision=1.2976
Modified: trunk/tests/Makefile.am
==============================================================================
--- trunk/tests/Makefile.am (original)
+++ trunk/tests/Makefile.am Thu Jan 8 07:53:34 2009
@@ -1,4 +1,4 @@
-SUBDIRS = javascript
+SUBDIRS = javascript c
EXTRA_DIST = \
COPYING \
run-tests.py \
Added: trunk/tests/c/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/tests/c/Makefile.am Thu Jan 8 07:53:34 2009
@@ -0,0 +1,32 @@
+# Mostly stolen from Clutter.
+
+NULL =
+
+noinst_PROGRAMS = test
+
+test_SOURCES = \
+ test-main.c \
+ test-tests.c \
+ $(NULL)
+
+test_CFLAGS = -Wall \
+ $(SEED_DEBUG_CFLAGS) \
+ $(SEED_PROFILE_CFLAGS) \
+ $(SEED_CFLAGS)
+
+test_LDADD = $(SEED_LIBS) -lseed
+test_LDFLAGS = -L../../libseed/.libs -lseed -lreadline $(SEED_PROFILE_LDFLAGS)
+
+.PHONY: test
+.PHONY: test-report test-report-normal
+
+test:
+ @gtester -o=test-results.xml ./test
+
+test-report-normal:
+ @gtester -o=test-results.xml -k ./test \
+ && ( gtester-report test-results.xml > test-results.html ) \
+ && gnome-open ./test-results.html
+
+test-report: test-report-normal
+
Added: trunk/tests/c/test-common.h
==============================================================================
--- (empty file)
+++ trunk/tests/c/test-common.h Thu Jan 8 07:53:34 2009
@@ -0,0 +1,20 @@
+
+/* Stuff you put in here is setup once in main() and gets passed around to
+ * all test functions and fixture setup/teardown functions in the data
+ * argument */
+typedef struct _TestSharedState
+{
+ int *argc_addr;
+ char ***argv_addr;
+} TestSharedState;
+
+
+/* This fixture structure is allocated by glib, and before running each test
+ * the test_conform_simple_fixture_setup func (see below) is called to
+ * initialise it, and test_conform_simple_fixture_teardown is called when
+ * the test is finished. */
+typedef struct _TestSimpleFixture
+{
+ /**/
+} TestSimpleFixture;
+
Added: trunk/tests/c/test-main.c
==============================================================================
--- (empty file)
+++ trunk/tests/c/test-main.c Thu Jan 8 07:53:34 2009
@@ -0,0 +1,73 @@
+#include "../../libseed/seed.h"
+#include <stdlib.h>
+#include "test-common.h"
+
+/* This is a bit of sugar for adding new conformance tests:
+ *
+ * - It adds an extern function definition just to save maintaining a header
+ * that lists test entry points.
+ * - It sets up callbacks for a fixture, which lets us share initialization
+ * *code* between tests. (see test-conform-common.c)
+ * - It passes in a shared *data* pointer that is initialised once in main(),
+ * that gets passed to the fixture setup and test functions. (See the
+ * definition in test-conform-common.h)
+ */
+#define TEST_SIMPLE(NAMESPACE, FUNC) \
+ extern void FUNC (TestSimpleFixture *fixture, gconstpointer data); \
+ g_test_add (NAMESPACE "/" #FUNC, \
+ TestSimpleFixture, \
+ shared_state, \
+ test_simple_fixture_setup, \
+ FUNC, \
+ test_simple_fixture_teardown);
+
+
+void test_simple_fixture_setup (TestSimpleFixture *fixture,
+ gconstpointer data);
+void test_simple_fixture_teardown (TestSimpleFixture *fixture,
+ gconstpointer data);
+
+/*
+ * Initialise stuff before each test is run
+ */
+void
+test_simple_fixture_setup (TestSimpleFixture *fixture, gconstpointer data)
+{
+}
+
+
+/*
+ * Cleanup stuff after each test has finished
+ */
+void
+test_simple_fixture_teardown (TestSimpleFixture *fixture, gconstpointer data)
+{
+
+}
+
+int
+main (int argc, char **argv)
+{
+ TestSharedState *shared_state = g_new0(TestSharedState, 1);
+ const gchar * display = g_getenv ("DISPLAY");
+
+ if (!display || *display == '\0')
+ {
+ g_print ("No DISPLAY found. Unable to run the test suite without X11.");
+ return EXIT_SUCCESS;
+ }
+
+ g_test_init (&argc, &argv, NULL);
+
+ //g_test_bug_base ("http://bugzilla.openedhand.com/show_bug.cgi?id=%s");
+
+ g_assert (seed_init(shared_state->argc_addr, shared_state->argv_addr) == 0);
+
+ shared_state->argc_addr = &argc;
+ shared_state->argv_addr = &argv;
+
+ TEST_SIMPLE ("/tests", test_tests);
+
+ return g_test_run ();
+}
+
Added: trunk/tests/c/test-tests.c
==============================================================================
--- (empty file)
+++ trunk/tests/c/test-tests.c Thu Jan 8 07:53:34 2009
@@ -0,0 +1,10 @@
+#include "../../libseed/seed.h"
+#include "test-common.h"
+
+void
+test_tests (TestSimpleFixture *fixture, gconstpointer _data)
+{
+ g_assert(1);
+}
+
+
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]