ClickHouse/tests/queries/0_stateless/01681_hyperscan_debug_assertion.sh
2021-10-11 16:40:12 +03:00

27 lines
980 B
Bash
Executable File
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/usr/bin/env bash
# Tags: no-debug, no-fasttest
# Tag no-fasttest: Hyperscan
CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL=fatal
CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CURDIR"/../shell_config.sh
# We throw our own exception from operator new.
# In previous versions of Hyperscan it triggered debug assertion as it only expected std::bad_alloc.
M=1000000
i=0 retries=300
while [[ $i -lt $retries ]]; do
$CLICKHOUSE_CLIENT --allow_hyperscan 1 --max_memory_usage $M --format Null --query "
SELECT [1, 2, 3, 11] = arraySort(multiMatchAllIndices('фабрикант', ['', 'рикан', 'а', 'f[a${RANDOM}e]b[ei]rl', 'ф[иа${RANDOM}эе]б[еэи][рпл]', 'афиукд', 'a[f${RANDOM}t],th', '^ф[аие${RANDOM}э]?б?[еэи]?$', 'бе${RANDOM}рлик', 'fa${RANDOM}b', 'фа[беьв]+е?[рл${RANDOM}ко]']))
" 2>&1 | grep -q 'Memory limit' || break;
M=$((M + 100000))
((++i))
done
echo 'Ok'