From: <tp...@ke...> - 2007-10-16 16:13:13
|
CVS Root: /cvs/gstreamer Module: gstreamer Changes by: tpm Date: Tue Oct 16 2007 16:12:50 UTC Log message: * libs/gst/check/gstcheck.c: * libs/gst/check/gstcheck.h: Allow runtime selection of unit tests to run via the GST_CHECKS environment variable (test case function names, comma-separated). Modified files: . : ChangeLog libs/gst/check : gstcheck.c gstcheck.h Links: http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/ChangeLog.diff?r1=1.3481&r2=1.3482 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/check/gstcheck.c.diff?r1=1.21&r2=1.22 http://freedesktop.org/cgi-bin/viewcvs.cgi/gstreamer/gstreamer/libs/gst/check/gstcheck.h.diff?r1=1.20&r2=1.21 ====Begin Diffs==== Index: ChangeLog =================================================================== RCS file: /cvs/gstreamer/gstreamer/ChangeLog,v retrieving revision 1.3481 retrieving revision 1.3482 diff -u -d -r1.3481 -r1.3482 --- ChangeLog 16 Oct 2007 13:58:40 -0000 1.3481 +++ ChangeLog 16 Oct 2007 16:12:34 -0000 1.3482 @@ -1,3 +1,10 @@ +2007-10-16 Tim-Philipp Müller <tim at centricular dot net> + + * libs/gst/check/gstcheck.c: + * libs/gst/check/gstcheck.h: + Allow runtime selection of unit tests to run via the GST_CHECKS + environment variable (test case function names, comma-separated). 2007-10-16 Stefan Kost <en...@us...> * gst/gststructure.c: Index: gstcheck.c RCS file: /cvs/gstreamer/gstreamer/libs/gst/check/gstcheck.c,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- gstcheck.c 14 Jun 2007 17:36:19 -0000 1.21 +++ gstcheck.c 16 Oct 2007 16:12:35 -0000 1.22 @@ -329,3 +329,28 @@ srunner_free (sr); return nf; } +gboolean +_gst_check_run_test_func (const gchar * func_name) +{ + const gchar *gst_checks; + gboolean res = FALSE; + gchar **funcs, **f; + gst_checks = g_getenv ("GST_CHECKS"); + /* no filter specified => run all checks */ + if (gst_checks == NULL || *gst_checks == '\0') + return TRUE; + /* only run specified functions */ + funcs = g_strsplit (gst_checks, ",", -1); + for (f = funcs; f != NULL && *f != NULL; ++f) { + if (strcmp (*f, func_name) == 0) { + res = TRUE; + break; + } + } + g_strfreev (funcs); + return res; +} Index: gstcheck.h RCS file: /cvs/gstreamer/gstreamer/libs/gst/check/gstcheck.h,v retrieving revision 1.20 diff -u -d -r1.20 -r1.21 --- gstcheck.h 13 Aug 2007 13:33:07 -0000 1.20 +++ gstcheck.h 16 Oct 2007 16:12:36 -0000 1.21 @@ -396,6 +396,22 @@ return gst_check_run_suite (s, # name, __FILE__); \ +/* Hack to allow run-time selection of unit tests to run via the + * GST_CHECKS environment variable (test function names, comma-separated) */ +gboolean _gst_check_run_test_func (const gchar * func_name); +static inline void +__gst_tcase_add_test (TCase * tc, TFun tf, const gchar * func_name) + if (_gst_check_run_test_func (func_name)) { + tcase_add_test (tc, tf); +#undef tcase_add_test +#define tcase_add_test(tc,tf) __gst_tcase_add_test(tc,tf,G_STRINGIFY(tf)) G_END_DECLS #endif /* __GST_CHECK_H__ */ |