unit tests in clang (#2012)

* clang errors

* non-test-only

* debugging

* rules on mac

* makefile

* put back

* let's see if this way makes everybody happy

* no, it does nto

Co-authored-by: Matthew Kennedy <makenne@microsoft.com>
This commit is contained in:
Matthew Kennedy 2020-12-05 22:21:17 -06:00 committed by GitHub
parent c492d5b6af
commit e544e8150a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 38 additions and 16 deletions

View File

@ -2,6 +2,7 @@
"recommendations": [
"marus25.cortex-debug",
"Gruntfuggly.todo-tree",
"ms-vscode.cpptools"
"ms-vscode.cpptools",
"vadimcn.vscode-lldb"
]
}

10
.vscode/launch.json vendored
View File

@ -5,7 +5,7 @@
"version": "0.2.0",
"configurations": [
{
"name": "Debug Unit Tests",
"name": "Debug Unit Tests (gdb)",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/unit_tests/build/rusefi_test",
@ -24,6 +24,14 @@
}
]
},
{
"name": "Debug Unit Tests (lldb)",
"type": "lldb",
"request": "launch",
"program": "${workspaceFolder}/unit_tests/build/rusefi_test",
"args": [],
"cwd": "${workspaceFolder}/unit_tests/build/",
},
{
"name": "Debug F40x",
"type": "cortex-debug",

View File

@ -18,16 +18,12 @@ include $(PROJECT_DIR)/rusefi_rules.mk
# Compiler options here.
ifeq ($(USE_OPT),)
# As of Jan 2016 we are producing 64 bit unit tests on Windows which needs 64 bit GDB
# Previouslyt we had to download 32 bit version of GDB maybe from http://www.equation.com/servlet/equation.cmd?fa=gdb
#
# -O2 is needed for mingw, without it there is a linking issue to isnanf?!?!
#USE_OPT = $(RFLAGS) -O2 -fgnu89-inline -ggdb -fomit-frame-pointer -falign-functions=16 -std=gnu99 -Werror-implicit-function-declaration -Werror -Wno-error=pointer-sign -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=sign-compare -Wno-error=unused-parameter -Wno-error=missing-field-initializers
USE_OPT = -c -Wall -O0 -ggdb -g3
USE_OPT += -fprofile-arcs -ftest-coverage
USE_OPT += -Werror=missing-field-initializers
USE_OPT += -Wno-unused-parameter -Wno-unused-function
USE_OPT += -fsingle-precision-constant
endif
@ -297,7 +293,7 @@ ULIBDIR =
# List all user libraries here
ULIBS = -lm
ULIBS += -lgcov --coverage
ULIBS += --coverage
#
# End of user defines

View File

@ -54,16 +54,33 @@ ADEFS = $(DADEFS) $(UADEFS)
LIBS = $(DLIBS) $(ULIBS)
# Various settings
#MCFLAGS = -mcpu=$(MCU)
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
ifeq ($(USE_LINK_GC),yes)
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
IS_MAC = no
ifneq ($(OS),Windows_NT)
UNAME_S := $(shell uname -s)
ifeq ($(UNAME_S),Darwin)
IS_MAC = yes
endif
endif
ifeq ($(IS_MAC),yes)
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) $(DEFS)
LDFLAGS = $(MCFLAGS) $(LLIBDIR)
else
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
# not mac
ODFLAGS = -x --syms
ASFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.s=.lst)) $(ADEFS)
ASXFLAGS = $(MCFLAGS) -Wa,-amhls=$(LSTDIR)/$(notdir $(<:.S=.lst)) $(ADEFS)
CFLAGS = $(MCFLAGS) $(OPT) $(COPT) $(CWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.c=.lst)) $(DEFS)
CPPFLAGS = $(MCFLAGS) $(OPT) $(CPPOPT) $(CPPWARN) -Wa,-alms=$(LSTDIR)/$(notdir $(<:.cpp=.lst)) $(DEFS)
ifeq ($(USE_LINK_GC),yes)
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch,--gc-sections $(LLIBDIR)
else
LDFLAGS = $(MCFLAGS) -Wl,-Map=$(BUILDDIR)/$(PROJECT).map,--cref,--no-warn-mismatch $(LLIBDIR)
endif
endif
# Generate dependency information