Skip to content

Commit 1b59912

Browse files
committed
make tests/run.sh posix-compliant by using \033[ rather than \e
seems like \e is only offered in bash not in zsh (I'm using VSCode's integrated shell, running zsh, and all I see is ~/projects/yosys-slang/tests | chore/warn-for-wait-and-expect $ ./run.sh ./unit/async.ys... \e[32mOK\e[0m . . . afaik, ubuntu uses dash, and the first thing that comes up online is that dash also sees this problem of not having \e function like this
1 parent 9d046dc commit 1b59912

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

tests/run.sh

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,25 @@ YOSYS=yosys
33
TESTSDIR="$(dirname "${BASH_SOURCE[0]}")"
44
PLUGIN="$(realpath "$TESTSDIR/../build/slang.so")"
55
code=0
6+
NOCOLOR='\033[0m'
7+
RED='\033[0;31m'
8+
GREEN='\033[0;32m'
9+
BOLD='\033[1m'
10+
611
for testcase in "$TESTSDIR"/*/*.ys "$TESTSDIR"/*/*.tcl;
712
do
813
TEXT=$testcase;
914
base=$(basename "$testcase")
1015
dir=$(dirname "$testcase")
1116
echo -n "${TEXT}... ";
12-
if ! (cd "$dir" && exec "$YOSYS" -m "$PLUGIN" "$base" 1>/dev/null 2>&1); then
13-
echo -e "\e[31mFAIL\e[0m";
14-
echo -e "Testcase \e[1m${testcase}\e[0m failed";
17+
if ! (cd "$dir" && exec "$YOSYS" -m "$PLUGIN" "$base" >/dev/null 2>&1); then
18+
echo -e "${RED}FAIL${NOCOLOR}";
19+
echo -e "Testcase ${BOLD}${testcase}${NOCOLOR} failed";
1520
(cd "$dir" && exec "$YOSYS" -g -Q -m "$PLUGIN" "$base");
1621
echo;
1722
code=1;
1823
else
19-
echo -e "\e[32mOK\e[0m";
24+
echo -e "${GREEN}OK${NOCOLOR}";
2025
fi
2126
done;
2227
exit $code

0 commit comments

Comments
 (0)