summaryrefslogtreecommitdiff
path: root/tests/check
diff options
context:
space:
mode:
authorU. Artie Eoff <ullysses.a.eoff@intel.com>2019-10-08 12:20:26 -0700
committerU. Artie Eoff <ullysses.a.eoff@intel.com>2019-10-16 12:49:17 -0700
commit7ce24e6ff793dfd8aa710c2cc236002304bc0849 (patch)
tree1576a8047a0487c2b24a11b63d1fdec0d0f50814 /tests/check
parent97aabe8784c057a4bee33d6f541ab7d75ca3708e (diff)
tests: check: initial unit test support
Add minimal unit test toolchain files and a simple vaapipostproc unit test.
Diffstat (limited to 'tests/check')
-rw-r--r--tests/check/elements/vaapipostproc.c53
-rw-r--r--tests/check/meson.build33
2 files changed, 86 insertions, 0 deletions
diff --git a/tests/check/elements/vaapipostproc.c b/tests/check/elements/vaapipostproc.c
new file mode 100644
index 00000000..9190fcfd
--- /dev/null
+++ b/tests/check/elements/vaapipostproc.c
@@ -0,0 +1,53 @@
+/*
+ * vaapipostproc.c - GStreamer unit test for the vaapipostproc element
+ *
+ * Copyright (C) 2019 Intel Corporation
+ * Author: U. Artie Eoff <ullysses.a.eoff@intel.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ * Boston, MA 02110-1301 USA
+ */
+
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
+
+#include <gst/check/gstcheck.h>
+
+GST_START_TEST (test_make)
+{
+ GstElement *vaapipostproc;
+
+ vaapipostproc = gst_element_factory_make ("vaapipostproc", "vaapipostproc");
+ fail_unless (vaapipostproc != NULL, "Failed to create vaapipostproc element");
+
+ gst_object_unref (vaapipostproc);
+}
+
+GST_END_TEST;
+
+static Suite *
+vaapipostproc_suite (void)
+{
+ Suite *s = suite_create ("vaapipostproc");
+ TCase *tc_chain = tcase_create ("general");
+
+ suite_add_tcase (s, tc_chain);
+ tcase_add_test (tc_chain, test_make);
+
+ return s;
+}
+
+GST_CHECK_MAIN (vaapipostproc);
diff --git a/tests/check/meson.build b/tests/check/meson.build
new file mode 100644
index 00000000..1b2a4a01
--- /dev/null
+++ b/tests/check/meson.build
@@ -0,0 +1,33 @@
+tests = [
+ [ 'elements/vaapipostproc' ],
+]
+
+test_deps = [gst_dep, gstcheck_dep]
+test_defines = [
+ '-UG_DISABLE_ASSERT',
+ '-UG_DISABLE_CAST_CHECKS',
+ '-DGST_USE_UNSTABLE_API',
+]
+
+pluginsdirs = []
+if gst_dep.type_name() == 'pkgconfig'
+ pluginsdirs = [gst_dep.get_pkgconfig_variable('pluginsdir')]
+endif
+
+foreach t : tests
+ fname = '@0@.c'.format(t.get(0))
+ test_name = t.get(0).underscorify()
+ extra_sources = [ ]
+ extra_deps = [ ]
+ env = environment()
+ env.set('CK_DEFAULT_TIMEOUT', '20')
+ env.set('GST_PLUGIN_SYSTEM_PATH_1_0', '')
+ env.set('GST_PLUGIN_PATH_1_0', [meson.build_root()] + pluginsdirs)
+ env.set('GST_REGISTRY', join_paths(meson.current_build_dir(), '@0@.registry'.format(test_name)))
+ exe = executable(test_name, fname, extra_sources,
+ include_directories : [configinc, libsinc],
+ c_args : ['-DHAVE_CONFIG_H=1' ] + test_defines,
+ dependencies : test_deps + extra_deps,
+ )
+ test(test_name, exe, env: env, timeout: 3 * 60)
+endforeach