From a2b4c42c28425554a1c8083c3365be33016a77a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Joakim=20Nohlg=C3=A5rd?= <joakim.nohlgard@eistec.se>
Date: Mon, 3 Apr 2017 19:47:32 +0200
Subject: [PATCH] unittests: Only build C++ tests for some platforms

Known working platforms are native and Cortex-M
---
 tests/unittests/Makefile | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/tests/unittests/Makefile b/tests/unittests/Makefile
index 13f3789e1d..3b1fd89bb0 100644
--- a/tests/unittests/Makefile
+++ b/tests/unittests/Makefile
@@ -27,7 +27,7 @@ else
 endif
 
 ARM7_BOARDS := msba2 avrextrem
-DISABLE_TEST_FOR_ARM7 := tests-relic
+DISABLE_TEST_FOR_ARM7 := tests-relic tests-cpp_%
 
 ARM_CORTEX_M_BOARDS := airfy-beacon arduino-due arduino-zero cc2538dk ek-lm4f120xl \
                        f4vi1 fox frdm-k64f iotlab-m3 limifrog-v1 mbed_lpc1768 msbiot \
@@ -43,10 +43,10 @@ ARM_CORTEX_M_BOARDS := airfy-beacon arduino-due arduino-zero cc2538dk ek-lm4f120
 DISABLE_TEST_FOR_ARM_CORTEX_M := tests-relic
 
 AVR_BOARDS := arduino-mega2560 waspmote-pro arduino-uno arduino-duemilanove
-DISABLE_TEST_FOR_AVR := tests-relic
+DISABLE_TEST_FOR_AVR := tests-relic tests-cpp_%
 
 MSP430_BOARDS :=  chronos msb-430 msb-430h telosb wsn430-v1_3b wsn430-v1_4 z1
-DISABLE_TEST_FOR_MSP430 := tests-relic tests-spiffs
+DISABLE_TEST_FOR_MSP430 := tests-relic tests-spiffs tests-cpp_%
 
 ifneq (, $(filter $(ARM7_BOARDS), $(BOARD)))
 UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_ARM7), $(UNIT_TESTS))
@@ -64,6 +64,12 @@ ifneq (, $(filter $(MSP430_BOARDS), $(BOARD)))
 UNIT_TESTS := $(filter-out $(DISABLE_TEST_FOR_MSP430), $(UNIT_TESTS))
 endif
 
+ifneq (,$(filter tests-cpp_%, $(UNIT_TESTS)))
+    # We need to tell the build system to use the C++ compiler for linking
+    export FEATURES_REQUIRED += cpp
+    export CPPMIX := 1
+endif
+
 DISABLE_MODULE += auto_init
 
 # Pull in `Makefile.include`s from the test suites:
-- 
GitLab