From 4ebdb5917a1b71e3ad40a8a0ffd7aef05a166fee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ra=C3=BAl=20Mar=C3=ADn?= Date: Wed, 11 Aug 2021 15:20:36 +0200 Subject: [PATCH] clickhouse-test: Implement @@SKIP@@ directive in tests --- tests/clickhouse-test | 4 ++++ .../01103_check_cpu_instructions_at_startup.sh | 7 ++++++- tests/queries/0_stateless/01801_s3_cluster.sh | 9 +++++++++ 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tests/clickhouse-test b/tests/clickhouse-test index f6833cfbd09..c627810a550 100755 --- a/tests/clickhouse-test +++ b/tests/clickhouse-test @@ -650,6 +650,10 @@ def run_tests_array(all_tests_with_params): status += " - having exception in stdout:\n{}\n".format( '\n'.join(stdout.split('\n')[:100])) status += 'Database: ' + testcase_args.testcase_database + elif '@@SKIP@@' in stdout: + skipped_total += 1 + skip_reason = stdout.replace('@@SKIP@@', '').rstrip("\n") + status += MSG_SKIPPED + f" - {skip_reason}\n" elif reference_file is None: status += MSG_UNKNOWN status += print_test_time(total_time) diff --git a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh index 1039f8f7d97..79c531e1a72 100755 --- a/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh +++ b/tests/queries/0_stateless/01103_check_cpu_instructions_at_startup.sh @@ -6,10 +6,15 @@ CURDIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # If we run sanitized binary under qemu, it will try to slowly allocate 20 TiB until OOM. # Don't even try to do that. This test should be disabled for sanitizer builds. -${CLICKHOUSE_LOCAL} --query "SELECT max(value LIKE '%sanitize%') FROM system.build_options" | grep -q '1' && echo 'Skip test for sanitizer build' && exit +${CLICKHOUSE_LOCAL} --query "SELECT max(value LIKE '%sanitize%') FROM system.build_options" | grep -q '1' && echo '@@SKIP@@: Sanitizer build' && exit command=$(command -v ${CLICKHOUSE_LOCAL}) +if ! hash qemu-x86_64-static 2>/dev/null; then + echo "@@SKIP@@: No qemu-x86_64-static" + exit 0 +fi + function run_with_cpu() { qemu-x86_64-static -cpu "$@" "$command" --query "SELECT 1" 2>&1 | grep -v -F "warning: TCG doesn't support requested feature" ||: diff --git a/tests/queries/0_stateless/01801_s3_cluster.sh b/tests/queries/0_stateless/01801_s3_cluster.sh index 215d5500be5..460f3856a2f 100755 --- a/tests/queries/0_stateless/01801_s3_cluster.sh +++ b/tests/queries/0_stateless/01801_s3_cluster.sh @@ -7,6 +7,15 @@ CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd) # shellcheck source=../shell_config.sh . "$CUR_DIR"/../shell_config.sh +if [[ -z $S3_ACCESS_KEY_ID ]]; then + echo "@@SKIP@@: Missing \$S3_ACCESS_KEY_ID" + exit 0 +fi + +if [[ -z $S3_SECRET_ACCESS ]]; then + echo "@@SKIP@@: Missing \$S3_SECRET_ACCESS" + exit 0 +fi ${CLICKHOUSE_CLIENT_BINARY} --send_logs_level="none" -q "SELECT * FROM s3('https://s3.mds.yandex.net/clickhouse-test-reports/*/*/functional_stateless_tests_(ubsan)/test_results.tsv', '$S3_ACCESS_KEY_ID', '$S3_SECRET_ACCESS', 'LineAsString', 'line String') limit 100 FORMAT Null;" ${CLICKHOUSE_CLIENT_BINARY} --send_logs_level="none" -q "SELECT * FROM s3Cluster('test_cluster_two_shards', 'https://s3.mds.yandex.net/clickhouse-test-reports/*/*/functional_stateless_tests_(ubsan)/test_results.tsv', '$S3_ACCESS_KEY_ID', '$S3_SECRET_ACCESS', 'LineAsString', 'line String') limit 100 FORMAT Null;"