Commit Graph

737 Commits

Author SHA1 Message Date
Matthias Clasen
76856241d0 Add a quick utility to test datetime formatting 2011-08-21 21:33:30 -04:00
Matthias Clasen
b76bb6713b Add g_mkdtemp in the spirit of g_mkstemp
At the same time, also add g_mkdtemp_full and g_dir_make_tmp
variants. The patch also unifies the unique-name-generating
code for all variants of mkstemp and mkdtemp and adds tests
for the new functions.

Based on patches by Paolo Bonzini,
http://bugzilla.gnome.org/show_bug.cgi?id=118563
2011-08-14 14:09:58 -04:00
Ryan Lortie
dbd0d63b6b wait longer in threadpool test case
If we are going to fail an assert, wait for a bit longer before doing so
(up to 5 seconds, if needed).

This is a long-standing Debian patch to fix build failures on really
slow machines.
2011-07-20 10:51:16 +02:00
Matthias Clasen
9fa5b8e5c7 asyncqueue: improve test coverage 2011-06-19 01:05:26 -04:00
Ryan Lortie
ce9681b87e Drop a few more G_CONST_RETURN 2011-06-13 09:27:28 -04:00
Matthias Clasen
abf4a0200f Test runtime dir getter 2011-06-06 00:30:30 -04:00
Matthias Clasen
1f022a88d4 Remove deprecated atomic functions from tests 2011-06-06 00:30:02 -04:00
Antoine Jacoutot
2ee470a71f Don't hardcode path to true(1).
true(1) is not always installed under /bin so leave system() find
it in the PATH.

https://bugzilla.gnome.org/show_bug.cgi?id=651219
2011-05-27 12:00:41 -04:00
Matthias Clasen
e5c986cbcf Only remove the lines that are no longer needed 2011-05-03 12:41:11 -04:00
Matthias Clasen
5d1aba2464 Revert "[build] Remove stale LDADD lines from tests/Makefile.am to allow build"
This reverts commit b0874ce28e.
2011-05-03 12:37:45 -04:00
Dan Winship
33c0877adc Add back an erroneously-removed line to tests/Makefile.am 2011-05-02 17:06:37 -04:00
Dan Winship
bdc23c44e8 Fix compiler warnings 2011-05-02 11:50:23 -04:00
Behdad Esfahbod
b0874ce28e [build] Remove stale LDADD lines from tests/Makefile.am to allow build
Automake 1.11 wasn't happy.
2011-05-02 11:43:18 -04:00
Matthias Clasen
ef5d4d55fe Fix make check
g_thread_init() causes a hash table to be allocated (in read_aliases).
Since hash tables are now a bit larger, we need to bump one of the
probe sizes to avoid our probe slice being used for the aliases
hash table.
2011-05-01 17:10:04 -04:00
Matthias Clasen
bd8b245f57 Update Unicode tests to 6.0 2011-01-22 00:02:08 -05:00
Matthias Clasen
316be2748f Adapt testglib.c to GRelation deprecation
Patch by Chun-wei Fan, bug https://bugzilla.gnome.org/show_bug.cgi?id=637858
2010-12-28 00:12:19 -05: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
Tor Lillqvist
46390c9d10 Don't call close() on -1
Of course, a proper implementation of close() will just ignore an
invalid parameter silently, and set errno. But apparently the "debug"
version of the Microsoft C library generates some noise in this
case. So avoid that. Thanks to John Emmas for reporting.
2010-10-07 12:06:48 +03:00
Jens Georg
db7ddcc195 Improve parsing of date-only iso8601 strings 2010-08-26 18:18:52 +03: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
Matthias Clasen
5179d92e9c fix the completion test 2010-08-03 10:25:54 -04:00
Matthias Clasen
21d98dbc4b improve completion test coverage 2010-08-03 10:25:54 -04:00
Matthias Clasen
e4b5104003 Move bookmarkfile tests to the test framework 2010-08-03 10:25:54 -04:00
Matthias Clasen
03be0d7237 Move markup parse tests to the test framework 2010-07-30 19:51:21 -04:00
Matthias Clasen
13ac9f94fd Add some more GFile tests 2010-07-30 19:51:19 -04:00
Matthias Clasen
c972d4df64 Move markup escape tests to test framework 2010-07-30 19:51:18 -04:00
Matthias Clasen
d0750c9d6e Don't leak in converter test 2010-07-30 19:51:18 -04:00
Matthias Clasen
9fc3c980cc Add some volume monitor tests
Although not much of this is easily testable.
2010-07-30 19:51:17 -04:00
Matthias Clasen
e5a72ae3c4 Move queue tests to the test framework 2010-07-30 19:51:17 -04:00
Olivier Crête
f6d3e224df notify: Add tests for threadsafe object notifies
https://bugzilla.gnome.org/show_bug.cgi?id=166020
2010-07-22 21:56:21 +02:00
Matthias Clasen
b720732059 Move uri tests to the test framework 2010-07-05 23:13:18 -04:00
Matthias Clasen
953962d783 Move tree tests to the test framework 2010-07-05 23:13:18 -04:00
Matthias Clasen
5123bc69e7 Move slist tests to the test framework 2010-07-05 23:13:18 -04:00
Matthias Clasen
b61fd45ac3 Move list tests to the test framework 2010-07-05 23:13:18 -04:00
Matthias Clasen
26e29cb360 Move charset conversion tests to the test framework 2010-07-04 20:51:06 -04:00
Matthias Clasen
e26b92b947 Move node tests to the test framework 2010-06-23 09:25:29 -04:00
Matthias Clasen
01abbc4bd3 Move node test to the test framework 2010-06-23 09:25:29 -04:00
Matthias Clasen
5c1b3a0263 Move date tests to the test framework 2010-06-23 09:25:29 -04:00
Matthias Clasen
2f438f18ae Move hash tests to the test framework 2010-06-21 23:08:01 -04:00
Matthias Clasen
5629366c3d Move checksum tests to the test framework 2010-06-21 23:08:01 -04:00
Matthias Clasen
7bea2a7a4f Move utf8 validation tests to the test framework 2010-06-20 21:16:24 -04:00
Matthias Clasen
5b08ef84e4 Move utf8 pointer tests to test framework 2010-06-20 21:04:47 -04:00
Matthias Clasen
0ed575213b Consolide base64 tests in a single file 2010-06-20 16:53:39 -04:00
Matthias Clasen
08d6e535be Move scanner tests to glib/tests 2010-06-20 16:53:38 -04:00
Matthias Clasen
09aa2e79ab Move sequence tests to the test framework 2010-06-20 12:23:13 -04:00
Matthias Clasen
bf8ce25216 Move base64 tests of to test framework 2010-06-20 11:34:31 -04:00
Matthias Clasen
f849dbac05 Move regex tests to the g_test framework 2010-06-20 11:20:54 -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
Juan A. Suarez Romero
992e07c8b2 Fix warnings
Do explicit casts to avoid warnings.
2010-06-09 10:32:12 +02:00
Colin Walters
183102104a [mainloop-test] Fix compilation errors 2010-05-26 16:21:15 -04:00
Havoc Pennington
6b53e4826f GSource: add g_source_set_name, g_source_get_name, g_source_set_name_by_id
These allow applications to give meaningful names to their sources.
Source names can then be used for debugging and profiling, for
example with systemtap or gdb.

https://bugzilla.gnome.org/show_bug.cgi?id=606044
2010-05-25 16:59:22 -04:00
Priit Laes
96d105906e Fix run-assert-msg-test to work with libtool-2.2.x. 2010-03-08 00:16:23 -05: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
Tor Lillqvist
241c7f476d Don't use deprecated g_win32 API 2010-02-04 14:53:20 +02:00
Ryan Lortie
6aa73f03eb improve gitignore 2010-01-28 22:43:51 -05:00
Martin Pitt
3658727cfa always use our own internal assertion message symbol
Re-using glibc's __abort_msg symbol causes linking problems, since the symbol
is declared private. Always use our own__glib_abort_msg symbol to store
assertion messages, to avoid compatibility and linking problems.

Also fix the test case to work with out of tree builds (such as "make
distcheck"), and re-enable it.

https://bugzilla.gnome.org/show_bug.cgi?id=594872
2010-01-26 11:22:31 +01:00
Matthias Clasen
975aea7bce Disable yet another failing test that was recently added... 2010-01-25 14:13:48 -05:00
Alberto Garcia
7693b0af44 [tests] Remove C++ style comments
It makes the IBM XL C Compiler (the 'native' non-free compiler
on the AIX 5.3 and 6.1 platform) stop compiling with syntax error.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=581300

Signed-off-by: Javier Jardón <jjardon@gnome.org>
2010-01-20 18:58:32 +01: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
Martin Pitt
da66897950 Support storing assertion messages into core dump
Crash interception/debugging systems like Apport or ABRT capture core dumps for
later crash analysis. However, if a program exits with an assertion failure,
the core dump is not useful since the assertion message is only printed to
stderr.

glibc recently got a patch which stores the message of assert() into the
__abort_msg global variable.
(http://sourceware.org/git/?p=glibc.git;a=commitdiff;h=48dcd0ba)
That works fine for programs which actually use the standard C assert() macro.

This patch adds the same functionality for glib's assertion tests. If we are
building against a glibc which already has __abort_msg (2.11 and later, or
backported above git commit), use that, otherwise put it into our own field
__glib_assert_msg.

Usage:

  $ cat test.c
  #include <glib.h>

  int main() {
      g_assert(1 < 0);
      return 0;
  }

  $ ./test
  **ERROR:test.c:5:main: assertion failed: (1 < 0)
  Aborted (Core dumped)

  $ gdb --batch --ex 'print (char*) __abort_msg' ./test core
  [...]
  $1 = 0x93bf028 "ERROR:test.c:5:main: assertion failed: (1 < 0)"

https://bugzilla.gnome.org/show_bug.cgi?id=594872
2009-12-23 15:51:11 +00: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
8212aadac7 g_time_val_from_iso8601: handle timezoneless dates
per ISO 8601:2004 4.2.5.2

Based on a patch from Andy Shevchenko
http://bugzilla.gnome.org/show_bug.cgi?id=589491
2009-09-01 09:40:03 -04:00
Matthias Clasen
5694ab7642 Revert "Move gio tests from gio/tests/ to tests/gio/"
This reverts commit 2262d76b33.

Move GIO tests back to where they belong.
2009-07-05 22:49:24 -04:00
Dan Winship
29e6525b1e Two "make check" fixes for late changes to the thread-context patch
g_simple_async_result_complete() now checks that it's being run from
the correct main loop, so tests/gio/simple-async-result was failing,
because it called it from outside any main loop. (And gio's pltcheck
was failing because I hadn't added g_main_current_source() to it.)
2009-07-01 13:52:49 -04:00
Benjamin Otte
2262d76b33 Move gio tests from gio/tests/ to tests/gio/
This avoids getting tests built every time when working on libgio and
running make in the gio/ directory.
2009-07-01 19:03:19 +02:00
Hans Breuer
75ef018248 Updated msvc build files 2009-05-30 15:29:23 +02:00
Matthias Clasen
f33a484b4a Fix up tests forgotten in Michaels commit
When Michael cleaned up after my fumbled commit of his gmarkup
optimizations, he fumbled himself and forgot to fix up the tests...
2009-05-03 17:10:16 -04:00
Dan Winship
92ac8d165e Misc warning fixes
glib/pcre/pcre_ucp_search_funcs.c, glib/pcre/pcre_valid_utf8.c: add
back missing config.h includes, and this time add them to the copies
in glib/update-pcre/ too so they don't get lost again on the next PCRE
update.

glib/garray.c, glib/gbase64.c: fix signed/unsigned pointer casts

gio/xdgmime/xdgmimeglob.c: remove unused variable

gio/tests/live-g-file.c: fix printf args on x86_64

tests/Makefile.am, tests/regex-test.c: remove redundant -DENABLE_REGEX
2009-05-01 10:37:45 -04:00
Peter Kjellerstedt
efc2cdbfc9 Fix parsing of timezones
Make g_time_val_from_iso8601 handle timezones with minutes correctly;
also accept comma as a fraction separator.  (#578369)
2009-04-08 10:26:11 -04:00
Matthias Clasen
84fdf0d00e Fix distcheck
svn path=/trunk/; revision=7932
2009-03-01 16:46:45 +00:00
Matthias Clasen
82e1d3e753 Bug 523742 – Use noinst for non-installable libraries
* tests/Makefile.am: use noninst_LTLIBRARIES for noninstalled
        libraries.Patch by Björn Lindqvist


svn path=/trunk/; revision=7860
2009-02-12 03:55:38 +00: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
Matthias Clasen
c6404e8329 Accept short data
svn path=/trunk/; revision=7625
2008-10-24 04:10:50 +00:00
Dan Winship
5c53925ed0 Bug 553447 $(Q#|(B g_assert_no_error()
* glib/gtestutils.h (g_assert_no_error, g_assert_error): Macros to
	assert that a GError is not set, or else is set to a particular
	error.

	* glib/gtestutils.c (g_assertion_message_error): utility for
	those macros

	* glib/tests/keyfile.c:
	* tests/asyncqueue-test.c:
	* tests/bookmarkfile-test.c:
	* tests/convert-test.c:
	* tests/file-test.c: Use g_assert_error/g_assert_no_error

svn path=/trunk/; revision=7555
2008-09-27 01:43:29 +00:00
Ryan Lortie
920f3bffb3 Bug 549771 – improved .gitignore for glib
2007-09-02  Ryan Lortie  <desrt@desrt.ca>

        Bug 549771 – improved .gitignore for glib

        * docs/reference/.gitignore:
        * docs/reference/gio/.gitignore:
        * docs/reference/gobject/tmpl/.gitignore:
        * gio/.gitignore:
        * gio/tests/.gitignore:
        * glib/.gitignore:
        * glib/libcharset/.gitignore:
        * glib/tests/.gitignore:
        * gmodule/.gitignore:
        * gobject/.gitignore:
        * gobject/tests/.gitignore:
        * po/.gitignore:
        * tests/.gitignore: new files
        * .gitignore: remove 'build' (since it's part of glib now), add more
        useful things.


svn path=/trunk/; revision=7432
2008-09-02 18:40:39 +00:00
Paolo Borelli
e6eb809599 Bug 550040 - Move GString, rand and printf tests to the unit test
2008-09-01  Paolo Borelli  <pborelli@katamail.com>

	Bug 550040 - Move GString, rand and printf tests to the unit test
	framework

	* tests/printf-test.c:
	* tests/rand-test.c:
	* tests/string-test.c:
	Removed

	* glib/tests/printf.c:
	* glib/tests/rand.c:
	* glib/tests/string.c:
	Added

	* tests/Makefile.am:
	* glib/tests/Makefile.am:
	Updated for the above


svn path=/trunk/; revision=7419
2008-09-01 09:31:40 +00:00
Bastien Nocera
f84518e35b Bug 548612 – g_strstr_len() should use memmem when available
2008-08-28  Bastien Nocera  <hadess@hadess.net>

	Bug 548612 – g_strstr_len() should use memmem when available

	* glib/tests/strfuncs.c (test_strstr):
	* tests/string-test.c (main): Patch by Paolo Borelli
	<pborelli@katamail.com> to move the tests to the right place,
	and add more tests

	* glib/gstrfuncs.c (g_strstr_len): Fix problem with memmem ignoring
	nul-terminators in strings, and using the haystack_len instead


svn path=/trunk/; revision=7409
2008-08-28 12:53:59 +00:00
Bastien Nocera
5e2a6047ea Bug 548612 – g_strstr_len() should use memmem when available
2008-08-28  Bastien Nocera  <hadess@hadess.net>

	Bug 548612 – g_strstr_len() should use memmem when available

	* configure.in: detect whether memmem is available in the C library
	* glib/gstrfuncs.c (g_strstr_len): use memmem for g_strstr_len() if
	available in it's available, as it could be optimised by the C library
	* tests/string-test.c (main): Add a few tests for g_strstr_len()


svn path=/trunk/; revision=7407
2008-08-27 23:23:23 +00:00
Matthias Clasen
88c7129340 Bug 547337 – G_DISABLE_DEPRECATED breaks tests build
2008-08-13  Matthias Clasen  <mclasen@redhat.com>

        Bug 547337 – G_DISABLE_DEPRECATED breaks tests build

        * tests/testglib.c: Protect deprecated API by ifdefs.
        Patch by Kalle Vahlman


svn path=/trunk/; revision=7353
2008-08-14 03:05:17 +00:00
Ryan Lortie
ce42e7ad4a Fix 'fail' markup test cases to -not- be valid XML 1.1.
2008-08-08  Ryan Lortie  <desrt@desrt.ca>

        * tests/markups/fail-32.gmarkup: change &#x10; to &#x0; since the
        former is no longer a failure.


svn path=/trunk/; revision=7328
2008-08-08 18:35:19 +00:00
Tor Lillqvist
b5b363019a Avoid warning on Win64 by using gintptr cast instead if long cast.
2008-08-04  Tor Lillqvist  <tml@novell.com>

	* tests/testglib.c: Avoid warning on Win64 by using gintptr cast
	instead if long cast.


svn path=/trunk/; revision=7304
2008-08-04 18:12:11 +00:00
Matthias Clasen
6e55e05284 Remove leftovers
svn path=/trunk/; revision=7243
2008-07-23 16:22:32 +00:00
Emmanuele Bassi
bcdc09e641 Do not set the timestamp value using time(), as it will be overwritten
2008-07-21  Emmanuele Bassi  <ebassi@gnome.org>

	* glib/gbookmarkfile.c:
	(bookmark_app_info_new): Do not set the timestamp value
	using time(), as it will be overwritten anyway. (#535223,
	Michael Meeks)

	(parse_application_element),
	(bookmark_app_info_dump): Support the "modified" attribute,
	which takes an ISO-formatted string instead of a Unix time
	stamp, to keep the number of g_strdup_printf() calls to a
	minimum.

	* glib/gtimer.c:
	(g_time_val_to_iso8601): Do not use strftime(): we know
	the format and contents of the ISO 8601 date format we
	use.

	* tests/bookmarks/valid-03.xbel: Add a test file for the
	modified attribute.

svn path=/trunk/; revision=7231
2008-07-21 13:05:24 +00:00
Matthias Clasen
d0008f0070 Move another test
svn path=/trunk/; revision=7209
2008-07-20 02:09:05 +00:00
Matthias Clasen
d0bd89a301 Move another test
svn path=/trunk/; revision=7198
2008-07-18 07:07:39 +00:00
Matthias Clasen
063c43c0d8 Move tests around
svn path=/trunk/; revision=7197
2008-07-18 06:25:23 +00:00
Matthias Clasen
3ec443b188 Ignore the error if iconv doesn't support EUC-JP.
* tests/iochannel-test.c: Ignore the error if iconv doesn't
        support EUC-JP.


svn path=/trunk/; revision=7182
2008-07-14 19:31:33 +00:00
Matthias Clasen
7560b45764 Print error messages when something fails
svn path=/trunk/; revision=7181
2008-07-14 19:15:18 +00:00
Matthias Clasen
052f3e6bd9 Skip a test if iconv doesn't support the encoding
svn path=/trunk/; revision=7180
2008-07-14 18:17:20 +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