Commit d31df704 authored by Daniel Verkamp's avatar Daniel Verkamp
Browse files

test/cpp_headers: autogenerate header test files



Rather than requiring changes to a static list of header files, use the
GNU Make wildcard function to generate a .cpp file per header.

This also tests whether each header includes all of the system headers
for the types it uses.

Change-Id: I05b82510b194533672568019e138d7d1aad2e86b
Signed-off-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
parent b8272792
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ if hash astyle; then
	rm -f astyle.log
	touch astyle.log
	astyle --options=.astylerc "*.c" >> astyle.log
	astyle --options=.astylerc "*.cpp" >> astyle.log
	astyle --options=.astylerc --exclude=test/cpp_headers "*.cpp" >> astyle.log
	astyle --options=.astylerc "*.h" >> astyle.log
	if grep -q "^Formatted" astyle.log; then
		echo " errors detected"
+1 −0
Original line number Diff line number Diff line
*.cpp
+8 −3
Original line number Diff line number Diff line
@@ -34,11 +34,16 @@
SPDK_ROOT_DIR := $(abspath $(CURDIR)/../..)
include $(SPDK_ROOT_DIR)/mk/spdk.common.mk

CXX_SRCS := cpp_headers.cpp
HEADERS := $(wildcard $(SPDK_ROOT_DIR)/include/spdk/*.h)
CXX_SRCS := $(patsubst %.h,%.cpp,$(notdir $(HEADERS)))

all : cpp_headers.o
%.cpp: $(SPDK_ROOT_DIR)/include/spdk/%.h
	$(Q)echo "  TEST_HEADER include/spdk/$(notdir $<)"; \
	echo '#include "spdk/$(notdir $<)"' > $@

all : $(CXX_SRCS) $(OBJS)

clean :
	$(CLEAN_C)
	$(CLEAN_C) $(CXX_SRCS)

include $(SPDK_ROOT_DIR)/mk/spdk.deps.mk

test/cpp_headers/cpp_headers.cpp

deleted100644 → 0
+0 −36
Original line number Diff line number Diff line
// Make sure all of the SPDK public headers compile as C++

extern "C" {
#include "spdk/assert.h"
#include "spdk/barrier.h"
#include "spdk/bdev.h"
#include "spdk/bit_array.h"
#include "spdk/conf.h"
#include "spdk/copy_engine.h"
#include "spdk/endian.h"
#include "spdk/event.h"
#include "spdk/fd.h"
#include "spdk/gpt_spec.h"
#include "spdk/ioat.h"
#include "spdk/ioat_spec.h"
#include "spdk/iscsi_spec.h"
#include "spdk/json.h"
#include "spdk/jsonrpc.h"
#include "spdk/likely.h"
#include "spdk/log.h"
#include "spdk/mmio.h"
#include "spdk/net.h"
#include "spdk/nvme.h"
#include "spdk/nvme_intel.h"
#include "spdk/nvme_spec.h"
#include "spdk/nvmf_spec.h"
#include "spdk/pci.h"
#include "spdk/pci_ids.h"
#include "spdk/queue.h"
#include "spdk/rpc.h"
#include "spdk/scsi.h"
#include "spdk/scsi_spec.h"
#include "spdk/string.h"
#include "spdk/trace.h"
#include "spdk/vtophys.h"
}