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
This commit is contained in:
Tim-Philipp Müller 2015-04-23 15:54:08 +01:00
parent 60706692b3
commit ac8d5cac4e

View file

@ -116,6 +116,18 @@ gst_check_message_error (msg, GST_MESSAGE_ERROR, \
GST_ ## domain ## _ERROR, GST_ ## domain ## _ERROR_ ## code)
#define assert_message_error(m, d, c) fail_unless_message_error(m, d, c)
#ifdef GST_CHECK_TEST_ENVIRONMENT_BEACON
#define GST_DO_CHECK_TEST_ENVIRONMENT \
G_STMT_START { \
if (g_getenv (GST_CHECK_TEST_ENVIRONMENT_BEACON) == NULL) \
fail ("Test environment not set up correctly! Expected environment " \
"variable '%s' to be set.", GST_CHECK_TEST_ENVIRONMENT_BEACON); \
} G_STMT_END
#else
#define GST_DO_CHECK_TEST_ENVIRONMENT /* nothing to check */
#endif
/**
* GST_START_TEST:
* @__testname: test function name
@ -131,6 +143,7 @@ gst_check_message_error (msg, GST_MESSAGE_ERROR, \
static void __testname (int __i__)\
{\
GST_DEBUG ("test start"); \
GST_DO_CHECK_TEST_ENVIRONMENT; \
tcase_fn_start (""# __testname, __FILE__, __LINE__);
#define GST_END_TEST GST_LOG ("cleaning up tasks"); \