Skip to content

Commit

Permalink
Show when tests are skipped
Browse files Browse the repository at this point in the history
Also, don't depend on tput (ncurses). It's really not needed since
ANSI escape sequences have been standardized for 35 years or so.
  • Loading branch information
edolstra committed Nov 7, 2017
1 parent dc30856 commit fd10f6f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 9 deletions.
16 changes: 9 additions & 7 deletions mk/tests.mk
Expand Up @@ -12,21 +12,23 @@ installcheck:
@total=0; failed=0; \
red=""; \
green=""; \
yellow=""; \
normal=""; \
if [ -t 1 ]; then \
ncolors="$$(tput colors)"; \
if [ -n "$$ncolors" ] && [ "$$ncolors" -ge 8 ]; then \

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 14, 2017

Member

The motivation was here to not enable colors, when output is not a terminal. Otherwise garbage is printed.
This might or not might be relevant here.

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 14, 2017

Member

In case it is not relevant "ncurses-bin" can removed again from release.nix.

This comment has been minimized.

Copy link
@edolstra

edolstra Nov 14, 2017

Author Member

Isn't that already handled by if [ -t 1 ];?

This comment has been minimized.

Copy link
@Mic92

Mic92 Nov 14, 2017

Member

Right. I did not saw this line.

red="$$(tput setaf 1)"; \
green="$$(tput setaf 2)"; \
normal="$$(tput sgr0)"; \
fi; \
red=""; \
green=""; \
yellow=""; \
normal=""; \
fi; \
for i in $(_installcheck-list); do \
total=$$((total + 1)); \
printf "running test $$i..."; \
log="$$(cd $$(dirname $$i) && $(tests-environment) $$(basename $$i) 2>&1)"; \
if [ $$? -eq 0 ]; then \
status=$$?; \
if [ $$status -eq 0 ]; then \
echo " [$${green}PASS$$normal]"; \
elif [ $$status -eq 99 ]; then \
echo " [$${yellow}SKIP$$normal]"; \
else \
echo " [$${red}FAIL$$normal]"; \
echo "$$log" | sed 's/^/ /'; \
Expand Down
2 changes: 1 addition & 1 deletion tests/fetchGit.sh
Expand Up @@ -2,7 +2,7 @@ source common.sh

if [[ -z $(type -p git) ]]; then
echo "Git not installed; skipping Git tests"
exit 0
exit 99
fi

clearStore
Expand Down
2 changes: 1 addition & 1 deletion tests/fetchMercurial.sh
Expand Up @@ -2,7 +2,7 @@ source common.sh

if [[ -z $(type -p hg) ]]; then
echo "Mercurial not installed; skipping Mercurial tests"
exit 0
exit 99
fi

clearStore
Expand Down

0 comments on commit fd10f6f

Please sign in to comment.