commit 8f8e5c1a7854f05bfa94fc41033706bc14682223
parent 520e7e4a631cc038b3e867b2255235da35a98ece
Author: jvoisin <julien.voisin@dustri.org>
Date: Fri, 21 Jun 2024 16:25:40 +0200
Add a test for C++ compilation
Diffstat:
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git 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
@@ -0,0 +1,18 @@
+#include "common.h"
+
+#include <poll.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <strings.h>
+#include <unistd.h>
+#include <wchar.h>
+
+#include <sys/select.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+// Check that all headers are compiling.
+int main(int argc, char** argv) {
+ return 0;
+}