From 16e047ffccc453e94d2fa378edfd9546ce84ee91 Mon Sep 17 00:00:00 2001 From: Ralph Lange Date: Sat, 4 Jan 2025 20:24:36 +0100 Subject: [PATCH] WIP run gtests under RTEMS --- gtestSup/Makefile | 2 ++ sampleApp/mixdGtestEpicsSrc/Makefile | 2 +- ...{rtemsTestHarness.c => rtemsTestHarness.cpp} | 17 +++++++++++++++-- 3 files changed, 18 insertions(+), 3 deletions(-) rename sampleApp/mixdGtestEpicsSrc/{rtemsTestHarness.c => rtemsTestHarness.cpp} (56%) diff --git a/gtestSup/Makefile b/gtestSup/Makefile index 263b69b..ec52db6 100644 --- a/gtestSup/Makefile +++ b/gtestSup/Makefile @@ -14,6 +14,8 @@ epics_gtest_main_LIBS += gmock gtest PERL_SCRIPTS += testSuiteList.pl +INCLUDE += tap.h + CFG += RULES_GTEST CFG += compat.RULES_BUILD diff --git a/sampleApp/mixdGtestEpicsSrc/Makefile b/sampleApp/mixdGtestEpicsSrc/Makefile index 1459c59..1061f35 100644 --- a/sampleApp/mixdGtestEpicsSrc/Makefile +++ b/sampleApp/mixdGtestEpicsSrc/Makefile @@ -69,7 +69,7 @@ TESTSCRIPTS_HOST += $(TESTS:%=%.t) testHarness_SRCS += epicsRunSampleTests.c sampleTestHarness_SRCS += $(testHarness_SRCS) -sampleTestHarness_SRCS_RTEMS += rtemsTestHarness.c +sampleTestHarness_SRCS_RTEMS += rtemsTestHarness.cpp PROD_vxWorks = sampleTestHarness PROD_RTEMS += sampleTestHarness diff --git a/sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.c b/sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.cpp similarity index 56% rename from sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.c rename to sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.cpp index a5942e4..8119513 100644 --- a/sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.c +++ b/sampleApp/mixdGtestEpicsSrc/rtemsTestHarness.cpp @@ -6,10 +6,23 @@ * in file LICENSE that is included with this distribution. \*************************************************************************/ -extern void epicsRunSampleTests(void); +#include +#include +#include + +extern "C" void epicsRunSampleTests(void); int main(int argc, char **argv) { + bool addTapListener = true; + epicsRunSampleTests(); /* calls epicsExit(0) */ - return 0; + + testing::InitGoogleMock(&argc, argv); + + if (addTapListener) { + testing::TestEventListeners& listeners = testing::UnitTest::GetInstance()->listeners(); + listeners.Append(new tap::TapListener()); + } + return RUN_ALL_TESTS(); }