Pull request 1910: new-rulelist-parser
Squashed commit of the following:
commit bac0da6818388d67840b8fe9b633ce0804964ed9
Merge: cb6759b63 f7dd83251
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jul 7 18:22:40 2023 +0300
Merge branch 'master' into new-rulelist-parser
commit cb6759b63546b35074ec0ae04769ddb5e83ebac1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Fri Jul 7 12:18:44 2023 +0300
all: upd tools
commit d28bf4cb42057b84e0c1325389db121a91f7c989
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jul 6 19:35:48 2023 +0300
all: upd chlog
commit 7df637b00331dff5810c3a76f4a7d2cee24148f1
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jul 6 19:30:42 2023 +0300
rulelist: fix tabs
commit 0598d0d43504b246570e9ee76d79dff0d86413c5
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jul 6 19:06:18 2023 +0300
all: add go-bench, go-fuzz; imp docs
commit a9ab7726048e216b13876a85991f3e3e8696a029
Author: Ainar Garipov <A.Garipov@AdGuard.COM>
Date: Thu Jul 6 18:18:14 2023 +0300
filtering: add new parser
This commit is contained in:
55
scripts/make/go-bench.sh
Normal file
55
scripts/make/go-bench.sh
Normal file
@@ -0,0 +1,55 @@
|
||||
#!/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
|
||||
|
||||
go="${GO:-go}"
|
||||
|
||||
count_flags='--count=1'
|
||||
shuffle_flags='--shuffle=on'
|
||||
timeout_flags="${TIMEOUT_FLAGS:---timeout=30s}"
|
||||
readonly go count_flags shuffle_flags timeout_flags
|
||||
|
||||
"$go" test\
|
||||
"$count_flags"\
|
||||
"$shuffle_flags"\
|
||||
"$race_flags"\
|
||||
"$timeout_flags"\
|
||||
"$x_flags"\
|
||||
"$v_flags"\
|
||||
--bench='.'\
|
||||
--benchmem\
|
||||
--benchtime=1s\
|
||||
--run='^$'\
|
||||
./...
|
||||
58
scripts/make/go-fuzz.sh
Normal file
58
scripts/make/go-fuzz.sh
Normal file
@@ -0,0 +1,58 @@
|
||||
#!/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
|
||||
|
||||
go="${GO:-go}"
|
||||
|
||||
count_flags='--count=1'
|
||||
shuffle_flags='--shuffle=on'
|
||||
timeout_flags="${TIMEOUT_FLAGS:---timeout=30s}"
|
||||
fuzztime_flags="${FUZZTIME_FLAGS:---fuzztime=20s}"
|
||||
|
||||
readonly go count_flags shuffle_flags timeout_flags fuzztime_flags
|
||||
|
||||
# TODO(a.garipov): File an issue about using --fuzz with multiple packages.
|
||||
"$go" test\
|
||||
"$count_flags"\
|
||||
"$shuffle_flags"\
|
||||
"$race_flags"\
|
||||
"$timeout_flags"\
|
||||
"$x_flags"\
|
||||
"$v_flags"\
|
||||
"$fuzztime_flags"\
|
||||
--fuzz='.'\
|
||||
--run='^$'\
|
||||
./internal/filtering/rulelist/\
|
||||
;
|
||||
@@ -176,6 +176,8 @@ run_linter gocognit --over 10\
|
||||
./internal/aghchan/\
|
||||
./internal/aghhttp/\
|
||||
./internal/aghio/\
|
||||
./internal/filtering/hashprefix/\
|
||||
./internal/filtering/rulelist/\
|
||||
./internal/next/\
|
||||
./internal/rdns/\
|
||||
./internal/tools/\
|
||||
@@ -211,6 +213,8 @@ run_linter gosec --quiet\
|
||||
./internal/dhcpd\
|
||||
./internal/dhcpsvc\
|
||||
./internal/dnsforward\
|
||||
./internal/filtering/hashprefix/\
|
||||
./internal/filtering/rulelist/\
|
||||
./internal/next\
|
||||
./internal/schedule\
|
||||
./internal/stats\
|
||||
@@ -219,8 +223,7 @@ run_linter gosec --quiet\
|
||||
./internal/whois\
|
||||
;
|
||||
|
||||
# TODO(a.garipov): Enable --blank?
|
||||
run_linter errcheck --asserts ./...
|
||||
run_linter errcheck ./...
|
||||
|
||||
staticcheck_matrix='
|
||||
darwin: GOOS=darwin
|
||||
|
||||
Reference in New Issue
Block a user