From 8f8e5c1a7854f05bfa94fc41033706bc14682223 Mon Sep 17 00:00:00 2001 From: jvoisin Date: Fri, 21 Jun 2024 16:25:40 +0200 Subject: [PATCH] Add a test for C++ compilation --- tests/Makefile | 9 ++++++++- tests/test_compile.cc | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 tests/test_compile.cc diff --git a/tests/Makefile b/tests/Makefile index d6f5b5d..56455bd 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -156,7 +156,9 @@ clang: CFLAGS+=-I/usr/include/x86_64-linux-musl clang: CFLAGS+=-I../x86_64-linux-musl-native/include/ clang: CFLAGS+=-Ix86_64-linux-musl-native/include/ clang: CFLAGS+=-nostdinc -clang: comptime $(RUNTIME_TARGETS) +clang: CXX=clang++ +clang: CXXFLAGS=$(CFLAGS) +clang: comptime $(RUNTIME_TARGETS) cpp coverage: CFLAGS += -fprofile-arcs -ftest-coverage coverage: CC=../x86_64-linux-musl-native/bin/gcc @@ -173,6 +175,10 @@ all: gcc $(RUNTIME_TARGETS): %: %.c $(CC) $(CFLAGS) -o $@ $< +cpp: test_compile.cc + $(CXX) $(CXXFLAGS) test_compile.cc -o ./test_compile_cc + timeout 1s ./test_compile_cc 1234567890 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL"; \ + run: $(RUNTIME_TARGETS) $(foreach EXE, $(RUNTIME_TARGETS), \ timeout 1s ./$(EXE) 1234567890 2 3 4 5 6 7 8 9 0 >/dev/null && echo "$(EXE) OK" || echo "$(EXE) FAIL"; \ @@ -187,5 +193,6 @@ clean: $(foreach EXE, $(RUNTIME_TARGETS) $(COMPTIME_TARGETS), \ rm -f ./$(EXE) \ ) + rm -f ./test_compile_cc rm -rf ./*.gcno ./*.gcda ./*.gcov ./coverage.info ./coverage diff --git a/tests/test_compile.cc b/tests/test_compile.cc new file mode 100644 index 0000000..edbbb27 --- /dev/null +++ b/tests/test_compile.cc @@ -0,0 +1,18 @@ +#include "common.h" + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +// Check that all headers are compiling. +int main(int argc, char** argv) { + return 0; +}