From d2f20d546d4e270c38625762962905f06eb5e979 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim-Philipp=20M=C3=BCller?= Date: Tue, 26 Mar 2024 12:46:02 +0000 Subject: [PATCH] tests: add check to make sure -bad lib headers are C++ compiler clean Only non-internal libs without external deps for now. Part-of: --- .../tests/check/libs/gstlibscpp.cc | 78 +++++++++++++++++++ .../gst-plugins-bad/tests/check/meson.build | 7 ++ 2 files changed, 85 insertions(+) create mode 100644 subprojects/gst-plugins-bad/tests/check/libs/gstlibscpp.cc diff --git a/subprojects/gst-plugins-bad/tests/check/libs/gstlibscpp.cc b/subprojects/gst-plugins-bad/tests/check/libs/gstlibscpp.cc new file mode 100644 index 0000000000..85c6302ce8 --- /dev/null +++ b/subprojects/gst-plugins-bad/tests/check/libs/gstlibscpp.cc @@ -0,0 +1,78 @@ +/* GStreamer + * Copyright (C) 2024 Tim-Philipp Müller + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 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 + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301, USA. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif + +#include +#include + +#include + +#include +#include + +#include +#include +/* +#include +#include +#include +*/ +#include +#include +#include +#include +/* +#include +*/ +#include +#include +// #include +#include +/* +#include +#include +#include +*/ +#include + +/* we mostly just want to make sure that our library headers don't + * contain anything a C++ compiler might not like */ +GST_START_TEST (test_nothing) +{ + gst_init (NULL, NULL); +} + +GST_END_TEST; + +static Suite * +libscpp_suite (void) +{ + Suite *s = suite_create ("BadLibsCpp"); + TCase *tc_chain = tcase_create ("C++ bad libs header tests"); + + suite_add_tcase (s, tc_chain); + tcase_add_test (tc_chain, test_nothing); + + return s; +} + +GST_CHECK_MAIN (libscpp); diff --git a/subprojects/gst-plugins-bad/tests/check/meson.build b/subprojects/gst-plugins-bad/tests/check/meson.build index c21887d99e..3c64a3641a 100644 --- a/subprojects/gst-plugins-bad/tests/check/meson.build +++ b/subprojects/gst-plugins-bad/tests/check/meson.build @@ -113,6 +113,13 @@ base_tests = [ [['libs/cudamemory.c'], not gstcuda_dep.found(), [gstcuda_dep, gstcuda_stub_dep]], ] +# Make sure our headers are C++ clean +if add_languages('cpp', native: false, required: false) + base_tests += [ + [['libs/gstlibscpp.cc'], false ], + ] +endif + # FIXME: unistd dependency, unstable or not tested yet on windows if host_machine.system() != 'windows' base_tests += [