Refactor Makefile and .travis tests

This commit is contained in:
Yann Collet 2015-08-26 00:19:06 +01:00
parent f44b2b02b4
commit bf50409e05
4 changed files with 30 additions and 49 deletions

View File

@ -1,6 +1,6 @@
language: c
compiler: gcc
script: make test-travis
script: make $ZSTD_TRAVIS_CI_ENV
before_install:
- sudo apt-get update -qq
- sudo apt-get install -qq gcc-arm-linux-gnueabi
@ -11,11 +11,13 @@ before_install:
env:
- ZSTD_TRAVIS_CI_ENV=travis-install
- ZSTD_TRAVIS_CI_ENV=test-all
- ZSTD_TRAVIS_CI_ENV=clangtest
- ZSTD_TRAVIS_CI_ENV=gpptest
- ZSTD_TRAVIS_CI_ENV=armtest
- ZSTD_TRAVIS_CI_ENV=test
- ZSTD_TRAVIS_CI_ENV="-C programs test32"
- ZSTD_TRAVIS_CI_ENV=sanitize
- ZSTD_TRAVIS_CI_ENV="-C programs memtest"
matrix:
fast_finish: true

View File

@ -34,37 +34,23 @@
# Version number
export VERSION=0.1.1
DESTDIR?=
PREFIX ?= /usr/local
LIBDIR ?= $(PREFIX)/lib
INCLUDEDIR=$(PREFIX)/include
PRGDIR = programs
ZSTDDIR = lib
# Select test target for Travis CI's Build Matrix
ifneq (,$(filter test-%,$(ZSTD_TRAVIS_CI_ENV)))
TRAVIS_TARGET=prg-travis
else
TRAVIS_TARGET=$(ZSTD_TRAVIS_CI_ENV)
endif
.PHONY: clean
default: zstdprograms
default: zstdprogram
all:
@cd $(ZSTDDIR); $(MAKE) -e all
@cd $(PRGDIR); $(MAKE) -e all
$(MAKE) -C $(ZSTDDIR) $@
$(MAKE) -C $(PRGDIR) $@
zstdprograms:
@cd $(PRGDIR); $(MAKE) -e
zstdprogram:
$(MAKE) -C $(PRGDIR)
clean:
@cd $(PRGDIR); $(MAKE) clean
@cd $(ZSTDDIR); $(MAKE) clean
# @cd examples; $(MAKE) clean
$(MAKE) -C $(ZSTDDIR) $@
$(MAKE) -C $(PRGDIR) $@
@echo Cleaning completed
@ -73,23 +59,18 @@ clean:
ifneq (,$(filter $(shell uname),Linux Darwin GNU/kFreeBSD GNU))
install:
@cd $(ZSTDDIR); $(MAKE) -e install
@cd $(PRGDIR); $(MAKE) -e install
$(MAKE) -C $(ZSTDDIR) $@
$(MAKE) -C $(PRGDIR) $@
uninstall:
@cd $(ZSTDDIR); $(MAKE) uninstall
@cd $(PRGDIR); $(MAKE) uninstall
$(MAKE) -C $(ZSTDDIR) $@
$(MAKE) -C $(PRGDIR) $@
travis-install:
sudo $(MAKE) install
test:
@cd $(PRGDIR); $(MAKE) -e test
test-travis: $(TRAVIS_TARGET)
prg-travis:
@cd $(PRGDIR); $(MAKE) -e $(ZSTD_TRAVIS_CI_ENV)
$(MAKE) -C $(PRGDIR) $@
clangtest: clean
clang -v
@ -99,8 +80,8 @@ gpptest: clean
$(MAKE) all CC=g++ CFLAGS="-O3 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Werror"
armtest: clean
cd $(ZSTDDIR); $(MAKE) -e all CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
cd $(PRGDIR); $(MAKE) -e CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
$(MAKE) -C $(ZSTDDIR) -e all CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
$(MAKE) -C $(PRGDIR) -e CC=arm-linux-gnueabi-gcc MOREFLAGS="-Werror"
sanitize: clean
$(MAKE) test CC=clang MOREFLAGS="-g -fsanitize=undefined"

View File

@ -32,14 +32,14 @@
# ################################################################
# Version numbers
VERSION?= 0
VERSION?= 0.1.1
LIBVER_MAJOR=`sed -n '/define ZSTD_VERSION_MAJOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < zstd.h`
LIBVER_MINOR=`sed -n '/define ZSTD_VERSION_MINOR/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < zstd.h`
LIBVER_PATCH=`sed -n '/define ZSTD_VERSION_RELEASE/s/.*[[:blank:]]\([0-9][0-9]*\).*/\1/p' < zstd.h`
LIBVER = $(LIBVER_MAJOR).$(LIBVER_MINOR).$(LIBVER_PATCH)
DESTDIR?=
PREFIX ?= /usr
PREFIX ?= /usr/local
CFLAGS ?= -O3
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-align -Wstrict-prototypes
LDFLAGS = -I.

View File

@ -33,17 +33,15 @@
VERSION?= v0.1.1
DESTDIR?=
PREFIX ?= /usr
PREFIX ?= /usr/local
CFLAGS ?= -O3
CFLAGS += -std=c99 -Wall -Wextra -Wundef -Wshadow -Wcast-qual -Wcast-align -Wstrict-prototypes -DZSTD_VERSION=\"$(VERSION)\"
LDFLAGS = -I../lib
FLAGS = $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) $(MOREFLAGS)
BINDIR=$(PREFIX)/bin
MANDIR=$(PREFIX)/share/man/man1
ZSTDDIR=../lib
TEST_TARGETS=test-native
BINDIR = $(PREFIX)/bin
MANDIR = $(PREFIX)/share/man/man1
ZSTDDIR = ../lib
# Define *.exe as extension for Windows systems
@ -119,7 +117,7 @@ test: test-zstd test-fullbench test-fuzzer
test32: test-zstd32 test-fullbench32 test-fuzzer32
test-all: test test32 test-mem
test-all: test test32 memtest
test-zstd: zstd datagen
@echo "*** zstd cli write error test ***"
@ -148,15 +146,15 @@ test-fuzzer: fuzzer
test-fuzzer32: fuzzer32
./fuzzer32
test-mem: zstd datagen fuzzer fullbench
memtest: zstd datagen fuzzer fullbench
@echo "\n ---- valgrind tests : memory analyzer ----"
valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > /dev/null
valgrind --leak-check=yes --error-exitcode=1 ./datagen -g50M > $(VOID)
./datagen -g16KB > tmp
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp /dev/null
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp $(VOID)
./datagen -g64MB > tmp
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp /dev/null
valgrind --leak-check=yes --error-exitcode=1 ./zstd -vf tmp $(VOID)
@rm tmp
valgrind --leak-check=yes --error-exitcode=1 ./fuzzer -i128 -t1
valgrind --leak-check=yes --error-exitcode=1 ./fuzzer -i1000 -t1
valgrind --leak-check=yes --error-exitcode=1 ./fullbench -i1
endif