Commit Graph

80 Commits

Author SHA1 Message Date
Dan Winship
c9ac45a023 .gitignore: add "signals" 2013-09-28 10:39:01 -04:00
Ray Strode
29ef821766 tests: add signal disconnection test
This commit adds a test to ensure that during a signal emission, if
a signal handler gets disconnected, it won't be run, even if it would
have run before the disconnection.
2013-09-20 16:06:02 -04:00
Ryan Lortie
601a00fa2a Change a pair of TESTS = to TEST += 2013-06-01 09:55:13 -04:00
Ryan Lortie
f9eb9eed10 Rework the build system for a new tests approach
Perform a substantial cleanup of the build system with respect to
building and installing testcases.

First, Makefile.decl has been renamed glib.mk and substantially
expanded.  We intend to add more stuff here in the future, like canned
rules for mkenums, marshallers, resources, etc.

By default, tests are no longer compiled as part of 'make'.  They will
be built when 'make check' is run.  The old behaviour can be obtained
with --enable-always-build-tests.

--disable-modular-tests is gone (because tests are no longer built by
default).  There is no longer any way to cause 'make check' to be a
no-op, but that's not very useful anyway.

A new glibtests.m4 file is introduced.  Along with glib.mk, this
provides for consistent handling of --enable-installed-tests and
--enable-always-build-tests (mentioned above).

Port our various test-installing Makefiles to the new framework.

This patch substantially improves the situation in the toplevel tests/
directory.  Things are now somewhat under control there.  There were
some tests being built that weren't even being run and we run those now.
The long-running GObject performance tests in this directory have been
removed from 'make check' because they take too long.

As an experiment, 'make check' now runs the testcases on win32 builds,
by default.  We can't run them under gtester (since it uses a pipe to
communicate with the subprocess) so just toss them in TESTS.  Most of
them are passing on win32.

Things are not quite done here, but this patch is already a substantial
improvement.  More to come.
2013-05-31 23:12:15 -04:00
Ryan Lortie
210b1f8b42 Remove a bunch of lingering g_thread_init()
After this patch, there is but one remaining use of g_thread_init(),
which is in tests/slice-threadinit.c, a testcase dedicated to testing
the functionality of gslice across a g_thread_init() boundary.

This testcase is pretty meaningless these days... probably we should
delete it.
2013-05-31 23:03:19 -04:00
Ryan Lortie
d7b3e558cf Move a pair of gobject tests to tests/gobject/
testgobject.c and timeloop-closure.c are the only two tests in the
toplevel tests/ directory that depend on gobject, so move them to
tests/gobject/ along with the other gobject tests.

Both of these were in noinst_PROGRAMS and not TESTS, so keep them that
way when we move them.
2013-05-31 23:03:19 -04:00
Colin Walters
0b167b0ae9 build: Fix usage of %.test again
We actually need the first dependency because it includes the
final executable name.  Rather, fix the original bug by using
the variable $(EXEEXT).
2013-05-24 22:16:44 +01:00
Colin Walters
5088c705ac tests: Drop unnecessary % from .test pattern match rule
On Windows, the executables will have .exe, so this won't
match.  Furthermore, they aren't actually dependent on the
executable to build.
2013-05-24 16:30:21 -04:00
Ryan Lortie
8bb6a4aec5 performance test: add signal test with args
Add a signal that has some typical arguments (a uint and a pointer)
since all of the other signal performance tests are for signals with no
args.

https://bugzilla.gnome.org/show_bug.cgi?id=694380
2013-05-23 21:50:53 -04:00
Ryan Lortie
4b72bbf9b1 performance test: share some code
The handled and unhandled cases share the same data and _run()
functions.  Refactor into a common section.

https://bugzilla.gnome.org/show_bug.cgi?id=694380
2013-05-23 21:50:52 -04:00
Dan Winship
52f6a7d162 tests: fix a few recently-broken tests 2013-05-21 11:21:36 -03:00
Matthias Clasen
7ff5c08221 Convert more tests to installed tests
This makes the tests in tests installed, except for
the performance tests.
2013-05-20 23:41:49 -04:00
Matthias Clasen
1808888a1f Convert more tests to installed tests 2013-05-20 21:05:56 -04:00
Ryan Lortie
d7c8eda186 tests: comment out asserts in dynamic type tests
We have some testcases that assert that type modules are unloaded after
the last reference on them is dropped.  Comment out those asserts now
that we turned the last unref into a no-op.

https://bugzilla.gnome.org/show_bug.cgi?id=693351
2013-02-07 14:15:45 -05:00
Matthias Clasen
ab328469f5 Silence automake
automake doesn't like INCLUDES anymore.
2013-02-02 22:54:15 -05:00
Ryan Lortie
c2055f22f4 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2013-01-04 21:20:04 +01:00
Rico Tzschichholz
efa7b5f1e7 Revert "gtype: disallow adding interfaces after the fact"
This reverts commit d6a075b0d8.
2013-01-04 20:25:46 +01:00
Ryan Lortie
5df1edaf70 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2012-12-18 21:37:07 +01:00
Rico Tzschichholz
d1ab41c940 Revert "gtype: disallow adding interfaces after the fact"
This reverts commit d6a075b0d8.
2012-12-18 21:23:13 +01:00
Ryan Lortie
d6a075b0d8 gtype: disallow adding interfaces after the fact
Add a check to prevent adding an interface to a class that has already
had its class_init done.

This is an incompatible change but it is suspected that there are not
many users of this functionality.  Two known exceptions are pygobject
(fixed in bug 686149) and our own testsuite (affected tests have been
temporarily disabled by this patch).

Once we confirm that nobody else is using this functionality we can
remove a rather large amount of code for dealing with this case.

https://bugzilla.gnome.org/show_bug.cgi?id=687659
2012-11-05 13:20:28 -05:00
Simon McVittie
733acc2316 Fix more void prototypes in tests
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687441
Reviewed-by: Colin Walters <walters@verbum.org>
2012-11-02 16:14:11 +00:00
Simon McVittie
eb7dc2bcc6 Predeclare more things in tests
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=687441
Reviewed-by: Colin Walters <walters@verbum.org>
2012-11-02 16:14:09 +00:00
Colin Walters
f6da43f56c build: Ensure we #include header files for glib-genmarshal code
Otherwise we fail with -Werror=missing-prototypes.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Ryan Lortie
1dc774a653 Remove g_type_init() calls
Very many testcases, some GLib tools (resource compiler, etc) and
GApplication were calling g_type_init().

Remove those uses, as they are no longer required.

https://bugzilla.gnome.org/show_bug.cgi?id=686161
2012-10-16 09:39:24 -04:00
Dan Winship
c37273dccb fix warnings 2012-04-30 09:28:42 -04:00
Alexander Larsson
950e6a4a20 tests: Add generic and empty signal emission performace tests
generic means it uses the generic marshaller
empty means the vfunc pointer is NULL

https://bugzilla.gnome.org/show_bug.cgi?id=661140
2012-03-02 17:13:03 +01:00
Lionel Landwerlin
3be0e57458 tests: performance: add emit-handled/emit-unhandled tests
Signed-off-by: Lionel Landwerlin <lionel.g.landwerlin@linux.intel.com>
2012-03-02 17:13:03 +01:00
Nicola Fontana
f24d8247b3 Do not use static GTypeInfo and GInterfaceInfo
Either g_type_register_static_simple (used by G_DEFINE_TYPE_EXTENDED)
and G_IMPLEMENT_INTERFACE use automatic variables for GTypeInfo and
GInterfaceInfo structs, while tutorials and source code often use
static variables. This commit consistently adopts the former method.

https://bugzilla.gnome.org/show_bug.cgi?id=600161
2011-11-29 22:03:25 -05:00
Javier Jardón
4a25d21bd0 tests/gobject: Use G_VALUE_INIT 2011-10-18 17:12:33 +01:00
Ryan Lortie
fd382156b8 tests: disable deprecation warnings for tests
We need to test deprecated functions, so don't warn us for doing so.
2011-10-13 10:51:35 -04:00
Javier Jardón
3659ca99f5 tests: Use G_VALUE_INIT 2011-10-02 17:22:57 +01:00
Colin Walters
f42fe6cdc0 gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
The documentation for G_TYPE_CHAR says:

"The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed
 integer."

However the return value for g_value_get_char() was just "char" which
in C has an unspecified signedness; on e.g. x86 it's signed (which
matches the GType), but on e.g. PowerPC or ARM, it's not.

We can't break the old API, so we need to suck it up and add new API.
Port most internal users, but keep some tests of the old API too.

https://bugzilla.gnome.org/show_bug.cgi?id=659870
2011-09-22 20:05:38 -04:00
Matthias Clasen
bf1027f826 Move ifaceproperties test to gobject/tests/ 2010-12-27 23:49:12 -05:00
Matthias Clasen
2a5e0cf9e0 Convert ifaceproperties.c to test framework
Also add a test that checks warnings for failure to implement
interface properties.

See https://bugzilla.gnome.org/show_bug.cgi?id=637738
2010-12-27 23:40:28 -05:00
Dan Winship
8f5ec0dad3 Fix misc compiler warnings in (mostly) test programs 2010-08-19 18:24:53 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
Christian Persch
db68f8203a Add g_value_take_variant
Turns out we do need g_value_take_variant(), so we can correctly
implement VARIANT:* marshalers.

Bug #621947.
2010-06-19 19:07:36 +02:00
Christian Persch
4708b8ecc3 Add fundamental type and pspec for GVariant
Make G_TYPE_VARIANT a fundamental type instead of boxed, and add
g_variant_{set,get,dup}_variant.

Add GParamSpecVariant.

Bug #610863.
2010-06-17 21:00:54 +02:00
Christian Persch
1b8ee5196e Sprinkle some $(AM_V_GEN) around to make the build more silent. 2010-06-15 22:01:02 -04:00
Ryan Lortie
1e6b184225 add performance tests to gitignore 2010-02-10 13:59:35 -05:00
Ryan Lortie
3e30e8a87e make tests not dynamic link against /lib/libglib
For some reason, even though the tests are linked against libgobject.la
and libgobject.la mentions libglib.la as a dependency, the tests are
running against the system glib instead of the in-tree one.

Adding the libglib.la file as an explicit LDFLAG fixes it.
2010-02-10 11:35:01 -05:00
Alexander Larsson
3c5e1fd903 Remove additional thread support in performance test
We're always enabling threads now so this is not needed.
2010-01-13 10:24:09 +01:00
Matthias Clasen
80bda52b57 Fix dynamictype test to build 2009-11-29 21:19:10 -05:00
Alexander Larsson
b35fa1994d Cast iface_init to GInterfaceInitFunc
This is in line with what all other type define macros do.

https://bugzilla.gnome.org/show_bug.cgi?id=508157
2009-11-26 12:32:36 +01:00
Alexander Larsson
36646f46ab Add test for G_IMPLEMENT_INTERFACE_DYNAMIC 2009-11-26 11:54:44 +01:00
Alexander Larsson
f4d9789fcf Add gobject performance tests for threaded code
This measures how much things like lock contention affects the gobject
code.
2009-10-02 21:02:48 +02:00
Alexander Larsson
b1f94af095 Add performance tests for GObject primitives
These are basic performance test for a couple of basic gobject
primitives:

* construction of simple objects. Simple is a bare gobject derived
  class with no properties, signals or interfaces.

* construction of complex objects. Complex is a gobject subclass
  with construct properties, normal properties, signals, and
  implements an interface.

* run-time type check of complex objects

* signal emissions

Lots of care is taken to try to make the results reproducible. Each
test is run for multible "rounds", where we try to make each round be
"not too short" in order to be significant wrt timer accuracy, but
also "not to long" to make the probability of some other random event
happening on the system (interrupts, other process scheduled, etc)
during the round less likely.
The current target round time is 4 msecs, which was picked without
rigour, but seems small wrt e.g. scheduler time.

For each test we then run the calculated round size for 60 seconds,
and then report the performance based on the minimal time of one
round. The model here is that any random stuff that happens during a
round can only slow it down, there is nothing that can make it go
faster, so the minimal time is the best estimate of how fast one round
goes.

The result is not ideal, even on a "idle" system the results vary
from round to round, but the variation seems to be less than 1%.
So, any performance difference reported by this test over 1% is
probably statistically significant.

Additionally the tests can be run with or without threads being
initialized. The script tests/gobject/run-performance.sh makes
it easy to produce a performance report for the current checkout.

https://bugzilla.gnome.org/show_bug.cgi?id=557100
2009-10-02 21:02:23 +02:00
Dan Winship
b9cf1ed275 update
* glib/tests/.gitignore: update

	* tests/.gitignore: update, sort

	* tests/gobject/.gitignore: add

svn path=/trunk/; revision=7772
2009-01-05 14:56:55 +00:00
Michael Natterer
4cd8caa6c7 Bug 541208 – Functions to easily install and use signals without class
2008-07-04  Michael Natterer  <mitch@imendio.com>

	Bug 541208 – Functions to easily install and use signals without
	class struct slot

	* tests/gobject/override.c: added tests for the new gsignal
	overriding and chaining APIs.


svn path=/trunk/; revision=7158
2008-07-04 11:10:48 +00:00