2020-12-30 08:26:25 -07:00
|
|
|
#!/bin/sh
|
|
|
|
|
2023-02-21 07:07:12 -07:00
|
|
|
# This comment is used to simplify checking local copies of the script. Bump
|
|
|
|
# this number every time a significant change is made to this script.
|
|
|
|
#
|
|
|
|
# AdGuard-Project-Version: 1
|
|
|
|
|
2020-12-30 08:26:25 -07:00
|
|
|
verbose="${VERBOSE:-0}"
|
2021-05-19 10:31:20 -07:00
|
|
|
readonly verbose
|
2020-12-30 08:26:25 -07:00
|
|
|
|
|
|
|
# Verbosity levels:
|
|
|
|
# 0 = Don't print anything except for errors.
|
|
|
|
# 1 = Print commands, but not nested commands.
|
|
|
|
# 2 = Print everything.
|
|
|
|
if [ "$verbose" -gt '1' ]
|
|
|
|
then
|
|
|
|
set -x
|
2021-06-10 10:09:00 -07:00
|
|
|
v_flags='-v=1'
|
|
|
|
x_flags='-x=1'
|
2020-12-30 08:26:25 -07:00
|
|
|
elif [ "$verbose" -gt '0' ]
|
|
|
|
then
|
|
|
|
set -x
|
2021-06-10 10:09:00 -07:00
|
|
|
v_flags='-v=1'
|
|
|
|
x_flags='-x=0'
|
2020-12-30 08:26:25 -07:00
|
|
|
else
|
|
|
|
set +x
|
2021-06-10 10:09:00 -07:00
|
|
|
v_flags='-v=0'
|
|
|
|
x_flags='-x=0'
|
2020-12-30 08:26:25 -07:00
|
|
|
fi
|
2021-05-19 10:31:20 -07:00
|
|
|
readonly v_flags x_flags
|
2020-12-30 08:26:25 -07:00
|
|
|
|
|
|
|
set -e -f -u
|
|
|
|
|
2021-05-19 10:31:20 -07:00
|
|
|
if [ "${RACE:-1}" -eq '0' ]
|
2020-12-30 08:26:25 -07:00
|
|
|
then
|
2021-06-10 10:09:00 -07:00
|
|
|
race_flags='--race=0'
|
2020-12-30 08:26:25 -07:00
|
|
|
else
|
2021-06-10 10:09:00 -07:00
|
|
|
race_flags='--race=1'
|
2020-12-30 08:26:25 -07:00
|
|
|
fi
|
2021-05-19 10:31:20 -07:00
|
|
|
readonly race_flags
|
2020-12-30 08:26:25 -07:00
|
|
|
|
2021-05-19 10:31:20 -07:00
|
|
|
go="${GO:-go}"
|
2021-12-22 06:34:51 -07:00
|
|
|
readonly go
|
2021-06-10 10:09:00 -07:00
|
|
|
|
|
|
|
count_flags='--count=1'
|
|
|
|
cover_flags='--coverprofile=./coverage.txt'
|
2021-12-22 06:34:51 -07:00
|
|
|
shuffle_flags='--shuffle=on'
|
2023-02-15 09:23:15 -07:00
|
|
|
timeout_flags="${TIMEOUT_FLAGS:---timeout=90s}"
|
2021-12-22 06:34:51 -07:00
|
|
|
readonly count_flags cover_flags shuffle_flags timeout_flags
|
2020-12-30 08:26:25 -07:00
|
|
|
|
2023-02-21 07:07:12 -07:00
|
|
|
"$go" test\
|
|
|
|
"$count_flags"\
|
|
|
|
"$cover_flags"\
|
|
|
|
"$shuffle_flags"\
|
|
|
|
"$race_flags"\
|
|
|
|
"$timeout_flags"\
|
|
|
|
"$x_flags"\
|
|
|
|
"$v_flags"\
|
|
|
|
./...
|