From 0f78319fd528236a0fd7d152870e77248cfc5891 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Sat, 26 Sep 2015 14:41:56 +0200 Subject: Make tests work on more systems Some systems do not have subsecond file modification detection capabilities. This is the case in OSX because the HFS+ file system has 1 second resolution. This is also the case in other OSes with particular file systems or even shells. For example, the "test" command in Bash does not support subsecond file times, while the ZSH one and the /usr/bin/test on my machine does. On those systems, with Bash, find -newer will work, but not test -nt. Tests were updated to reflect this. The test Makefile runs a series of commands to determine if subsecond resolution is available. When it is not, a sleep command will be executed before relevant operations in the tests. Because the Bash shell is often the default shell for Make, and because users of ZSH may want to avoid sleeping for no reasons, a new variable was introduced: ZSH=1. When provided when running tests, the shell will be switched to ZSH, and subsecond resolution will work as expected. Tests have been fixed to work with ZSH as well. All this only applies to tests, Erlang.mk itself is so far not affected by this issue. --- test/core_compat.mk | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'test/core_compat.mk') diff --git a/test/core_compat.mk b/test/core_compat.mk index b8c0681..62dfe93 100644 --- a/test/core_compat.mk +++ b/test/core_compat.mk @@ -38,9 +38,7 @@ core-compat-auto-rebar: build clean-core-compat-auto-rebar $i "Create a temporary file" $t touch $(APP)/older_file - - $i "Wait a second" - $t sleep 1 + $t $(SLEEP) $i "Build the application again" $t $(MAKE) -C $(APP) $v @@ -79,9 +77,7 @@ core-compat-rebar: build clean-core-compat-rebar $i "Create a temporary file" $t touch $(APP)/older_file - - $i "Wait a second" - $t sleep 1 + $t $(SLEEP) $i "Run 'make rebar.config' again" $t $(MAKE) -C $(APP) rebar.config $v -- cgit v1.2.3