Unit testing in CI (#651)
- in appveyor, install clang and cmake in cygwin, enable package upgrades, and build cmocka and enable testing for gcc only - in `gitignore`, ignore generated cmocka folder - in travis, use brew in osx to install cmocka, and enable testing for gcc and clang on os x and linux - in `Makefile`, change to use `uname -s` to determine os type - make `install-cmocka-linux.sh`, a simple shell script to download and install cmocka on linux - in `bindings/Makefile`, enable `make -c` to call subdirectory makefiles instead of `cd [dir] && make` and include environment variables for runtime access to generated libraries - in `samples/Makefile`, change to use `uname -s` to determine os type, remove `clean_bins` from `all` command, and include `Werror` for compile strictness - in `tests/unit/Makefile`, add `cflags` for compile time access to cmocka headers and library, include execute vars for runtime access to cmocka and unicorn libs - in `tests/unit/test_tb_x86.c`, comment out assert that would not compile
This commit is contained in:
committed by
Nguyen Anh Quynh
parent
2a608c778e
commit
bc08bfda67
@@ -4,6 +4,7 @@
|
||||
include ../config.mk
|
||||
|
||||
LIBNAME = unicorn
|
||||
UNAME_S := $(shell uname -s)
|
||||
|
||||
# Find GLIB
|
||||
ifndef GLIB
|
||||
@@ -20,7 +21,7 @@ SAMPLEDIR = .
|
||||
OBJDIR = .
|
||||
LIBDIR = ..
|
||||
|
||||
CFLAGS += -Wall -I$(INCDIR)
|
||||
CFLAGS += -Wall -Werror -I$(INCDIR)
|
||||
LDFLAGS += -lpthread -L$(LIBDIR) -l$(LIBNAME)
|
||||
LDFLAGS_STATIC += $(UNICORN_DEP_LIBS_STATIC)
|
||||
|
||||
@@ -46,27 +47,24 @@ BIN_EXT =
|
||||
AR_EXT = a
|
||||
|
||||
# Cygwin?
|
||||
IS_CYGWIN := $(shell $(CC) -dumpmachine | grep -i cygwin | wc -l)
|
||||
ifeq ($(IS_CYGWIN),1)
|
||||
ifneq ($(filter CYGWIN%,$(UNAME_S)),)
|
||||
CFLAGS := $(CFLAGS:-fPIC=)
|
||||
LDFLAGS += -lssp
|
||||
LDFLAGS_STATIC += -lssp
|
||||
BIN_EXT = .exe
|
||||
AR_EXT = a
|
||||
else
|
||||
# mingw?
|
||||
IS_MINGW := $(shell $(CC) --version | grep -i mingw | wc -l)
|
||||
ifeq ($(IS_MINGW),1)
|
||||
else ifneq ($(filter MINGW%,$(UNAME_S)),)
|
||||
CFLAGS := $(CFLAGS:-fPIC=)
|
||||
BIN_EXT = .exe
|
||||
AR_EXT = lib
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
ifeq ($(UNICORN_STATIC),yes)
|
||||
ifeq ($(IS_MINGW),1)
|
||||
ifneq ($(filter MINGW%,$(UNAME_S)),)
|
||||
ARCHIVE = $(LIBDIR)/$(LIBNAME).$(AR_EXT)
|
||||
else ifeq ($(IS_CYGWIN),1)
|
||||
else ifneq ($(filter CYGWIN%,$(UNAME_S)),)
|
||||
ARCHIVE = $(LIBDIR)/lib$(LIBNAME).$(AR_EXT)
|
||||
else
|
||||
ARCHIVE = $(LIBDIR)/lib$(LIBNAME).$(AR_EXT)
|
||||
@@ -112,7 +110,7 @@ OBJS = $(addprefix $(OBJDIR)/,$(SOURCES:.c=.o))
|
||||
OBJS_ELF = $(addprefix $(OBJDIR)/,$(SOURCES:.c=))
|
||||
BINARY = $(addprefix $(SAMPLEDIR)/,$(SOURCES:.c=$(BIN_EXT)))
|
||||
|
||||
all: clean_bins $(BINARY)
|
||||
all: $(BINARY)
|
||||
|
||||
clean_bins:
|
||||
rm -rf *.o $(OBJS_ELF) $(BINARY) $(SAMPLEDIR)/*.exe $(SAMPLEDIR)/*.static $(OBJDIR)/lib$(LIBNAME)* $(OBJDIR)/$(LIBNAME)*
|
||||
@@ -133,7 +131,7 @@ ifeq ($(UNICORN_SHARED),yes)
|
||||
@$(link-dynamic)
|
||||
endif
|
||||
ifeq ($(UNICORN_STATIC),yes)
|
||||
ifneq ($(IS_MINGW),1)
|
||||
ifneq ($(filter MINGW%,$(UNAME_S)),)
|
||||
$(call log,LINK,$(notdir $(call staticname,$@)))
|
||||
@$(link-static)
|
||||
endif
|
||||
@@ -143,7 +141,7 @@ ifeq ($(UNICORN_SHARED),yes)
|
||||
$(link-dynamic)
|
||||
endif
|
||||
ifeq ($(UNICORN_STATIC),yes)
|
||||
ifneq ($(IS_MINGW),1)
|
||||
ifneq ($(filter MINGW%,$(UNAME_S)),)
|
||||
$(link-static)
|
||||
endif
|
||||
endif
|
||||
|
||||
Reference in New Issue
Block a user