Adguardhome/scripts/make/go-bench.sh
Ainar Garipov 8f55534e59 Pull request 2569: AGDNS-3555-imp-docker
Squashed commit of the following:

commit f8f7edfd3948528dfc828cbaa9aa549fdd87c501
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 29 14:12:51 2026 +0300

    scripts: workaround

commit ad007b9ee1db92b37081cb9b8f98708e97fc65ff
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 29 14:01:34 2026 +0300

    bamboo-specs: imp

commit 883a5faad7a034cd6d70d0cc1daa47311e6de46f
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date:   Thu Jan 29 13:56:41 2026 +0300

    scripts: rm unused debug, add progress
2026-01-29 11:28:25 +00:00

55 lines
1,009 B
Bash

#!/bin/sh
verbose="${VERBOSE:-0}"
readonly verbose
# 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
v_flags='-v=1'
x_flags='-x=1'
elif [ "$verbose" -gt '0' ]; then
set -x
v_flags='-v=1'
x_flags='-x=0'
else
set +x
v_flags='-v=0'
x_flags='-x=0'
fi
readonly v_flags x_flags
set -e -f -u
if [ "${RACE:-1}" -eq '0' ]; then
race_flags='--race=0'
else
race_flags='--race=1'
fi
readonly race_flags
benchtime_flags="${BENCHTIME_FLAGS:---benchtime=1x}"
count_flags='--count=2'
go="${GO:-go}"
shuffle_flags='--shuffle=on'
timeout_flags="${TIMEOUT_FLAGS:---timeout=30s}"
readonly benchtime_flags count_flags go shuffle_flags timeout_flags
env \
GOMAXPROCS="${GOMAXPROCS:-2}" \
"$go" test \
"$benchtime_flags" \
"$count_flags" \
"$race_flags" \
"$shuffle_flags" \
"$timeout_flags" \
"$v_flags" \
"$x_flags" \
--bench='.' \
--benchmem \
--run='^$' \
work \
;