diff options
Diffstat (limited to 'test/Makefile')
-rw-r--r-- | test/Makefile | 46 |
1 files changed, 39 insertions, 7 deletions
diff --git a/test/Makefile b/test/Makefile index ba612fa..20b2328 100644 --- a/test/Makefile +++ b/test/Makefile @@ -2,6 +2,14 @@ # Copyright (c) 2014, Viktor Söderqvist <[email protected]> # This file is part of erlang.mk and subject to the terms of the ISC License. +# ZSH users have a more modern shell which doesn't need to +# have the same safeguards as other shells. To use ZSH instead +# of the default shell, set ZSH=1. + +ifdef ZSH +SHELL := $(shell which zsh) +endif + # Temporary application name, taken from rule name. APP = $(subst -,_,$@) @@ -11,12 +19,36 @@ APP_TO_CLEAN = $(subst -,_,$(patsubst clean-%,%,$@)) ERL = erl +A0 -noinput -boot start_clean -# Platform, condensed version. +# Platform detection, condensed version. -ifeq ($(shell uname -o),Msys) - PLATFORM = msys2 +UNAME_S := $(shell uname -s) + +ifeq ($(UNAME_S),Darwin) +PLATFORM = darwin +else ifeq ($(UNAME_S),FreeBSD) +PLATFORM = freebsd +else ifeq ($(shell uname -o),Msys) +PLATFORM = msys2 else - PLATFORM = unix +PLATFORM = unix +endif + +# Some systems do not have sub-second file times resolution. +# This is the case for older systems like OSX that uses the HFS+ +# file system. HFS+ has a 1 second time resolution. This is a +# problem because the Erlang.mk tests rely on file modification +# times to ensure files were rebuilt. To fix this issue, we +# detect here whether the system supports sub-second resolution, +# and maybe sleep during test execution. +# +# Also see: +# * http://arstechnica.com/apple/2011/07/mac-os-x-10-7/12/#hfs-problems +# * https://apple.stackexchange.com/questions/51650/linus-torvalds-and-the-os-x-filesystem + +ifeq ($(shell touch a; sleep 0.01; touch b; sleep 0.01; touch c; test c -nt b -a b -nt a; echo $$?; rm a b c),1) +SLEEP = sleep 1 +else +SLEEP = endif # OTP master, for downloading files for testing. @@ -47,11 +79,11 @@ else ifeq ($V,1) else ifeq ($V,2) t = @echo " TEST " $@; v = V=0 - i = @echo == $@: + i = @echo "== $@:" else t = v = V=1 - i = @echo == $@: + i = @echo "== $@:" endif # Main targets. @@ -132,7 +164,7 @@ core-distclean-tmp: build clean-core-distclean-tmp $i "Distclean the application" $t $(MAKE) -C $(APP) distclean $v - $i "Check if .erlang.mk directory got removed" + $i "Check that .erlang.mk directory got removed" $t test ! -e $(APP)/.erlang.mk core-help: build clean-core-help |