Files
tmux/regress/Makefile
ejc3 4fd0875050 regress: start panes with /bin/sh, not the login shell
The Makefile runs each test under env -i, so SHELL is unset and the
server's default-shell is the login shell from the password file. It
runs every pane that has no command, as a login shell, and every pane
command given as one string, with -c. zsh takes HOME from the password
file when it is unset, so it reads the user's startup files and
history.

Twenty-six tests type a command into such a pane and give it a fixed
time: twenty-five type an attach to a second server and sleep for a
second, and session-ops.sh types a script and waits five seconds for
it. When the login shell is slow to give a prompt, the checks run
before the command has. zsh, for one, waits until a lock on a non-empty
history file is ten seconds old.

Set SHELL=/bin/sh in the environment the tests run in.
2026-10-15 05:53:29 +00:00

50 lines
1.1 KiB
Makefile

TESTS!= echo *.sh
LOGDIR=logs
.PHONY: all prepare $(TESTS)
all: prepare $(TESTS)
@failed=0; failures=; \
for test in $(TESTS); do \
base=$${test##*/}; \
log="$(LOGDIR)/$${base%.sh}.log"; \
if [ -f "$$log" ]; then \
failed=1; \
failures="$$failures $$test"; \
fi; \
done; \
if [ "$$failed" -ne 0 ]; then \
echo; \
echo "failures:"; \
for test in $$failures; do \
echo " $$test"; \
done; \
else \
rmdir "$(LOGDIR)" 2>/dev/null || true; \
fi; \
exit $$failed
prepare:
@mkdir -p "$(LOGDIR)"
@rm -f "$(LOGDIR)"/*.log
$(TESTS): prepare
@base="$@"; base=$${base##*/}; \
log="$(LOGDIR)/$${base%.sh}.log"; \
start=$$(date +%s); \
env -i LC_CTYPE=C.UTF-8 MallocNanoZone=0 SHELL=/bin/sh \
sh -x "$@" >"$$log" 2>&1; \
result=$$?; \
end=$$(date +%s); \
case $$result in \
0) \
rm -f "$$log"; \
printf '%-40s PASS (%ss)\n' "$@" "$$((end - start))" ;; \
101) \
rm -f "$$log"; \
printf '%-40s SKIP (%ss)\n' "$@" "$$((end - start))" ;; \
*) \
printf '%-40s FAIL (%ss)\n log: %s\n' \
"$@" "$$((end - start))" "$$log" ;; \
esac