diff options
author | Tavian Barnes <tavianator@tavianator.com> | 2019-01-31 23:43:19 -0500 |
---|---|---|
committer | Tavian Barnes <tavianator@tavianator.com> | 2019-02-01 12:50:22 -0500 |
commit | 02132c2efb6daa213aa07b805ccb0c20241ca2f7 (patch) | |
tree | f3612e876e19422c9a0f1a095cf326192f785e52 | |
parent | 33d320ab80aebb89dc63931684ef2e748b5fb91c (diff) | |
download | bfs-02132c2efb6daa213aa07b805ccb0c20241ca2f7.tar.xz |
Makefile: New distcheck target
To catch more errors automatically, this new target runs the tests in
multiple configurations, including various sanitizers and with/without
optimization.
-rw-r--r-- | .travis.yml | 35 | ||||
-rw-r--r-- | Makefile | 20 |
2 files changed, 27 insertions, 28 deletions
diff --git a/.travis.yml b/.travis.yml index 393a947..1acc520 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,37 +1,24 @@ language: c -script: make check +script: make distcheck addons: apt: packages: - - acl-dev + - gcc-multilib + - libacl1-dev + - libacl1:i386 - libcap-dev + - libcap2:i386 matrix: include: - os: linux - dist: trusty - sudo: false - compiler: gcc - - - os: linux - dist: trusty - sudo: false - compiler: gcc - env: - - CFLAGS="-m32 -g -Wall" - addons: - apt: - packages: - - gcc-multilib - - acl-dev:i386 - - libcap-dev:i386 - - - os: linux - dist: trusty - sudo: false - compiler: clang + dist: xenial + before_script: + # Ubuntu doesn't let you install the -dev packages for both amd64 and + # i386 at once, so we make our own symlinks to fix -m32 -lacl -lcap + - sudo ln -s libacl.so.1 /lib/i386-linux-gnu/libacl.so + - sudo ln -s libcap.so.2 /lib/i386-linux-gnu/libcap.so - os: osx - compiler: clang @@ -54,6 +54,9 @@ LOCAL_LDLIBS := ifeq ($(OS),Linux) LOCAL_LDFLAGS += -Wl,--as-needed LOCAL_LDLIBS += -lacl -lcap -lrt + +# These libraries are not build with msan, so disable them +MSAN_CFLAGS := -DBFS_HAS_SYS_ACL=0 -DBFS_HAS_SYS_CAPABILITY=0 endif ALL_CPPFLAGS = $(LOCAL_CPPFLAGS) $(CPPFLAGS) @@ -82,18 +85,27 @@ bfs: \ util.o $(CC) $(ALL_LDFLAGS) $^ $(ALL_LDLIBS) -o $@ -sanitized: CFLAGS := -g $(WFLAGS) -fsanitize=address -fsanitize=undefined -sanitized: bfs - release: CFLAGS := -g $(WFLAGS) -O3 -flto -DNDEBUG release: bfs +tests/mksock: tests/mksock.o + $(CC) $(ALL_LDFLAGS) $^ -o $@ + %.o: %.c $(CC) $(ALL_CFLAGS) -c $< -o $@ check: all ./tests.sh +distcheck: + +$(MAKE) -Bs check CFLAGS="$(CFLAGS) -fsanitize=undefined -fsanitize=address" +ifneq ($(OS),Darwin) + +$(MAKE) -Bs check CC=clang CFLAGS="$(CFLAGS) $(MSAN_CFLAGS) -fsanitize=memory" + +$(MAKE) -Bs check CFLAGS="$(CFLAGS) -m32" +endif + +$(MAKE) -Bs release check + +$(MAKE) -Bs check + clean: $(RM) bfs *.o *.d @@ -107,6 +119,6 @@ uninstall: $(RM) $(DESTDIR)$(PREFIX)/bin/bfs $(RM) $(DESTDIR)$(PREFIX)/share/man/man1/bfs.1 -.PHONY: all release check clean install uninstall +.PHONY: all release check distcheck clean install uninstall -include $(wildcard *.d) |