Commit graph

265 commits

Author SHA1 Message Date
Havard Graff
b2ce23074e harness: misc bugfixes
1. Get a list of pad templates from the element class, not the
factory. This allows us to interact with test-elements that does
not have a factory.

2. Use the pad_template_caps in caps-queries when caps is not set
explicitly on the pad. Not doing so is simply wrong, and prohibits
interactions with special templates used for testing.

https://bugzilla.gnome.org/show_bug.cgi?id=754193
2015-08-31 12:03:09 +01:00
Havard Graff
28100e0b6a harness: add _set_forwarding function
To be able to disable the slightly "magic" forwarding of the
necessary events between the harnesses.

Also introduce a new test-suite for GstHarness, that documents the
feature, and should hopefully expand into documenting most of the
features the harness possesses.

https://bugzilla.gnome.org/show_bug.cgi?id=752746
2015-08-09 16:02:37 +01:00
Luis de Bethencourt
60de1f26c7 harness: don't run code inside g_assert
Even though asserts can't be disabled in GstHarness, Coverity still
complains about running code inside them. Moving the code to outside the
g_asserts().

CID #1311326, #1311327, #1311328
2015-08-05 14:05:27 +01:00
Nicolas Dufresne
d47b567f2f doc/gsthardness: Fix typo in GstAllocationParams
It's not GstAllocatorParams but GstAllocationParams.
2015-07-28 15:50:40 -04:00
Nicolas Dufresne
67e53e4adc doc/gstharness: Remove unknown parameter
sink_elenment_name is not a parameter of gst_harness_add_sink_harness()
function, but still it show up in documentation.
2015-07-28 15:46:09 -04:00
Olivier Crête
815b5f69e8 harness: Fix indendation 2015-07-22 18:55:29 -04:00
Havard Graff
c97f82e32b harness: add functions for adding sub-harnesses directly
By introducing gst_harness_add_src_harness and gst_harness_add_sink_harness
we collect all sub-harness setup in one function, making the previous
sub-harness creation functions now calls these directly, and making it
much easier (and less error-prone) to add your own src or sink-harness
using the more generic harness-creation functions.
2015-07-20 15:30:11 +01:00
Tim-Philipp Müller
997115e462 harness: fix indentation 2015-07-16 17:50:49 +01:00
Tim-Philipp Müller
36267ca0e2 harness: fix pad template leak 2015-07-16 17:50:06 +01:00
Havard Graff
0841b2a97e harness: don't re-establish the harness sink and src pads
Given that the element has the possibility to have one, they should
already be there.

https://bugzilla.gnome.org/show_bug.cgi?id=752498
2015-07-16 17:09:27 +01:00
Stian Selnes
8597284d0b harness: Improve detection of element type
The element flag does not indicate wether a bin should be tested as a
source or as a sink, eg. a bin with the sink flag may still have a
source pad and a bin with the source flag may have a sink pad. In this
case it is better to determine the element type by looking at the
available pads and pad templates.

Also rename srcpad and sinkpad where it actually represents
element_srcpad_name and element_sinkpad_name.

https://bugzilla.gnome.org/show_bug.cgi?id=752493
2015-07-16 16:23:20 +01:00
Stian Selnes
fe6f694dbb harness: Forward sticky events to sink harness
Fixes issue where if a sink harness was added late the sticky events
would not be forwared.

https://bugzilla.gnome.org/show_bug.cgi?id=752494
2015-07-16 16:18:08 +01:00
Tim-Philipp Müller
e066058fac harness: make header nicer to read 2015-07-16 12:41:51 +01:00
Tim-Philipp Müller
0728b219b9 harness: fix indentation and replace stress test function macros
These screw with indentation and seem a bit trivial. Just copy'n'paste.
2015-07-07 15:02:45 +01:00
Tim-Philipp Müller
b5cc88594e harness: make sure g_assert() statements are always active
We have code with side effects inside g_assert()s, so make
sure those are always enabled here (they might otherwise
get disabled for release builds).
2015-07-07 08:38:31 +01:00
Tim-Philipp Müller
ac79c7f05a harness: rename GstHarnessPrepareBuffer -> GstHarnessPrepareBufferFunc
https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-07 00:58:15 +01:00
Tim-Philipp Müller
49c896db3a docs: add GstHarness to documentation
https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-07 00:53:48 +01:00
Havard Graff
66e25da313 check: Add GstHarness convenience API for unit tests
http://gstconf.ubicast.tv/videos/gstharness-again-a-follow-up/

https://bugzilla.gnome.org/show_bug.cgi?id=751916
2015-07-06 23:36:37 +01:00
Jonas Holmberg
fabe966b0a gstcheck: Print newline in message handler
The message handler is supposed to print a newline after the message
just like the default message handler.
2015-06-23 16:17:56 +01:00
Nicolas Dufresne
632431aecb gi: Use INTROSPECTION_INIT for --add-init-section
This new define was added to common. The new init section fixed
compilation warning found in the init line that was spread across
all files.
2015-06-16 18:08:24 -04:00
Nicolas Dufresne
41dab4e204 gi: Skip gst_consitency_checker_new
This non boxed type cannot be allocated safely.
2015-06-13 19:47:45 -04:00
Tim-Philipp Müller
ac8d5cac4e check: optionally check env var for us to make sure test env is set up
If GST_CHECK_TEST_ENVIRONMENT_BEACON is defined, check if the
environment variable it is defined to is set up at the start
of each test.

https://bugzilla.gnome.org//show_bug.cgi?id=747624
2015-04-23 15:54:08 +01:00
Edward Hervey
e4d07e161d introspection: Don't use g-ir-scanner cache at compile time
It pollutes user directories and we don't need to cache it

https://bugzilla.gnome.org/show_bug.cgi?id=747095
2015-03-31 11:16:09 +02:00
Sebastian Dröge
805684585e check: Fix uninitialized variable compiler warning with gcc
check_run.c: In function 'sig_handler':
check_run.c:127:13: warning: 'child_sig' may be used uninitialized in this function [-Wmaybe-uninitialized]
             killpg(group_pid, child_sig);
             ^
check_run.c:130:31: warning: 'idx' may be used uninitialized in this function [-Wmaybe-uninitialized]
             sigaction(sig_nr, &old_action[idx], NULL);
                               ^
2015-03-21 19:37:30 +01:00
Sebastian Dröge
7646cef644 check: Catch SIGTERM and SIGINT in the test runner and kill all currently running tests
Otherwise e.g. ctrl+c in the test runner exits the test runner, while the test
itself is still running in the background, uses CPU and memory and potentially
never exits (e.g. if the test ran into a deadlock or infinite loop).

The reason why we have to manually kill the actual tests is that after
forking they will be moved to their own process group, and as such are
not receiving any signals sent to the test runner anymore. This is supposed
to be done to make it easier to kill a test, which it only really does if
the test itself is forking off new processes.

This fix is not complete though. SIGKILL can't be caught at all, and error
signals like SIGSEGV, SIGFPE are currently not caught. The latter will only
happen if there is a bug in the test runner itself, and as such seem less
important.
2015-03-21 15:19:43 +01:00
Michał Dębski
a7797d30a8 check: Use mkstemp instead of tempnam if possible
Using tempnam() is deprecated, this gives warning and fails the build
with -Werror.

https://bugzilla.gnome.org/show_bug.cgi?id=745858
2015-03-11 16:14:24 +00:00
Luis de Bethencourt
58f9c1dd71 check: duplicate code branches
CID #1226446
2015-03-10 16:42:48 +00:00
Mathieu Duponchelle
0ee2183aa5 check: cast element in ASSERT_SET_STATE.
https://bugzilla.gnome.org/show_bug.cgi?id=744777
2015-02-19 12:18:50 +01:00
Stefan Sauer
8695a202c8 check: fix another typo in the docs 2015-01-23 08:59:57 +01:00
Heinrich Fink
1b472377c8 check: Fix doc of GST_CHECKS and GST_CHECKS_IGNORE
https://bugzilla.gnome.org/show_bug.cgi?id=743335
2015-01-22 21:38:51 +11:00
Sebastian Dröge
ee3db74ec4 check: Add _fail_unless() compatibility function around _ck_assert_failed()
We exported this in < 1.5 and it was automatically used by many macros
from the header. Keep it exported for now.
2015-01-21 18:09:38 +01:00
Thiago Santos
896b3bfeed gstcheck: fix GI annotation
Add missing : to annotation
2014-12-18 12:04:22 -03:00
Sebastian Rasmussen
0b09573bbe check: Have autotools generate internal-check.h
Previously GStreamer got access to the libcheck interface by including
libs/gst/check/check.h which in turn included internal-check.h in the
same directory. internal-check.h was generated by copying
libs/gst/check/libcheck/check.h which in turn was generated from
check.h.in in the same directory. In this case generating
libs/gst/check/libcheck/check.h is unnecessary, in addition this file
was accidentally distributed in generated project tarballs.

Now libs/gst/check/internal-check.h is generated directly from
libs/gst/check/libcheck/check.h.in by configure. This means that the
libcheck source must include internal-check.h instead of the previously
generated libs/gst/check/libcheck/check.h. However the unnecessary
intermediate step is now skipped.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=741359
2014-12-16 16:32:39 +01:00
Sebastian Rasmussen
1cf733f282 check: Avoid requring (u)intmax_t in macros
Previously embedded libcheck versions did not depend on (u)intmax_t and
doing so would require projects using GStreamer's check framework to add
AX_CREATE_STDINT_H to their configure.ac. A workaround is to fallback to
glib types. This patch assumes that glib.h is always included before
internal-check.h which is ok since everything Gstreamer would include
gst/gstcheck.h instead of directly including internal-check.h.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-12-07 17:32:30 +01:00
Sebastian Rasmussen
fb6ea425b0 check: Fix compilation error for iOS
libcheck includes CoreServices for its compat for clock_gettime(),
even though it never uses anything it declares. Let's remove it.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-12-06 19:46:29 +01:00
Sebastian Rasmussen
85c8b5d2c4 check: Apply GStreamer-specific patches
Reintroduced patches:

 * Make sure that fail_if(1) actually fails
   from commit 9f99d056a2

New patches due to updated libcheck (based on 0.9.14):

 * Checks in m4/check-checks.m4 to cater for new dependencies
 * Conditional compile-time compat POSIX fallbacks for libcheck
 * Avoid relative paths for libcheck header files
 * Make timer_create() usage depend on posix timers, not librt
 * Rely on default AX_PTHREAD behavior to allow HAVE_PTHREAD to be used
   when checking for types and functions (like clock_gettime())
 * Avoid double declaration of clock_gettime() when availabe outside of
   librt by making compat clock_gettime() declaration conditional
 * check 0.9.9 renamed _fail_unless() and 0.9.12 later renamed it again
   to _ck_assert_failed(), so ASSERT_{CRITICAL,WARNING}() now calls this
   function
 * Remove libcheck fallback infrastructure for malloc(), realloc(),
   gettimeofday() and snprintf() since either they appear to be
   available or they introduce even more dependencies.

The result is an embedded check in gstreamer that has been tested by
running check tests in core, -base, -good, -bad, -ugly and rtsp-server
on Linux, OSX and Windows.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-12-06 17:48:25 +01:00
Sebastian Rasmussen
f1df7aba8f check: Import version 0.9.14
This lifts the files almost verbatim (the changes being running though
gst-indent and fixing the FSF address) from the upstream respository.
Therefore this commit reverts some GStreamer-specific patches to check
that will be reintroduced next.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=727826
2014-12-06 17:48:16 +01:00
Sebastian Dröge
154eefecc9 Don't compare booleans for equality to TRUE and FALSE
TRUE is 1, but every other non-zero value is also considered true. Comparing
for equality with TRUE would only consider 1 but not the others.

Also normalize booleans in a few places.
2014-12-01 09:51:37 +01:00
Stefan Sauer
d5518edf12 fixme: bump leftover 0.11 fixme comments 2014-09-25 21:27:03 +02:00
Sebastian Dröge
84c6e885f1 check: Use the name parameter of gst_check_setup_src_pad_by_name() and the sink variant
This was hardcoded to "sink" / "src" by accident in previous refactoring.
2014-09-15 13:08:09 +03:00
Thibault Saunier
87a79673b0 check: Add a function to check destruction of objects
Add a method letting people to ensure that unreffing one object
leads to its destruction, and possibly the destruction of more object
(think destruction of a GstBin etc...).

https://bugzilla.gnome.org/show_bug.cgi?id=736477
2014-09-12 17:18:21 +02:00
Tiago
076b83208a check: Adding documentation to the gst_check_setup_sink_pad_by_name function
https://bugzilla.gnome.org/show_bug.cgi?id=734190
2014-09-12 14:14:05 +03:00
Tiago Cesar Katcipis
91045ccd83 gstcheck: add docs for gst_check_setup_src_pad_by_name()
https://bugzilla.gnome.org/show_bug.cgi?id=734142
2014-08-03 00:27:14 +01:00
Sebastian Rasmussen
863ba1a598 docs: Fix documentation typos and inconsistencies
* GstGlobalDeviceMonitor was renamed to GstDeviceMonitor
 * Expand GST_MESSAGE_DEVICE to the full enum value names
 * Correct the incorrect references to the GstDeviceProvider interfaces
 * Describe caps arguments for gstcheck interface
 * Add missing docs for GstNetAddressMeta and its add function
 * Add docs for toc helper macros
 * Avoid refering to GstValueList type as done elsewhere

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=732786
2014-07-09 09:22:11 +02:00
Tim-Philipp Müller
ba31faf261 libs: gstcheck: check that mutex is locked before g_cond_wait*() is called
Sanity check to catch problems in unit test.
2014-07-06 12:13:04 +01:00
Tim-Philipp Müller
b2bbd1edfa libs: gstcheck: init and clear global mutex and cond variables 2014-07-06 12:12:20 +01:00
Evan Nemerson
5abc82e9f3 introspection: Assorted minor introspection and documentation fixes
https://bugzilla.gnome.org/show_bug.cgi?id=732534
2014-07-01 09:03:41 +02:00
Tim-Philipp Müller
a10ca2ee13 check: use _exit() instead of exit() in fail_unless() so we exit immediately
exit() will call atexit handlers, which may try to
clean up things or wait for things to get cleaned up,
which we don't want or need. We just want to stop
and let the parent know about the failure as quickly
as possible in case fork() is used.

Fixes timeouts on assert failures in checks where
an exit handler waits for things to stop, but they
don't stop because they haven't been shut down,
and they haven't been shut down because there's no
simple way to do so on failures.

http://sourceforge.net/p/check/patches/50/
2014-05-07 10:44:34 +01:00
Antoine Jacoutot
3e24bbefba libs: g-ir-scanner: do not hardcode libtool path
https://bugzilla.gnome.org/show_bug.cgi?id=726571
2014-04-17 09:26:20 +01:00
Edward Hervey
145517aa64 check: Fix exported symbol name
it's _template and not _templ
2014-04-16 07:59:27 +02:00