ClickHouse/tests/queries/0_stateless/03133_help_message_verbosity.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.2 KiB
Bash
Raw Normal View History

2024-04-25 17:46:20 +00:00
#!/usr/bin/env bash
# Checks that "clickhouse-client/local --help" prints a brief summary of CLI arguments and "--help --verbose" prints all possible CLI arguments
2024-04-25 17:46:20 +00:00
CUR_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
# shellcheck source=../shell_config.sh
. "$CUR_DIR"/../shell_config.sh
2024-04-26 18:31:26 +00:00
# Unique identifier for concurrent execution
PID=$$
# Get the help message in short and verbose form and put them into txt files
$CLICKHOUSE_CLIENT --help > "help_msg_$PID.txt"
$CLICKHOUSE_CLIENT --help --verbose > "verbose_help_msg_$PID.txt"
2024-04-25 17:46:20 +00:00
# Sizes of files
2024-04-26 18:31:26 +00:00
size_short=$(stat -c %s "help_msg_$PID.txt")
size_verbose=$(stat -c %s "verbose_help_msg_$PID.txt")
2024-04-25 17:46:20 +00:00
# If the size of the short help message is less, everything is OK
if [ $size_short -lt $size_verbose ]; then
echo "OK"
else
echo "Not OK"
fi
2024-04-26 18:31:26 +00:00
rm "help_msg_$PID.txt"
rm "verbose_help_msg_$PID.txt"
2024-04-25 17:46:20 +00:00
# The same for clickhouse local
2024-04-26 18:31:26 +00:00
$CLICKHOUSE_LOCAL --help > "help_msg_$PID.txt"
$CLICKHOUSE_LOCAL --help --verbose > "verbose_help_msg_$PID.txt"
2024-04-25 17:46:20 +00:00
2024-04-26 18:31:26 +00:00
size_short=$(stat -c %s "help_msg_$PID.txt")
size_verbose=$(stat -c %s "verbose_help_msg_$PID.txt")
2024-04-25 17:46:20 +00:00
if [ $size_short -lt $size_verbose ]; then
echo "OK"
else
echo "Not OK"
fi
2024-04-26 18:31:26 +00:00
rm "help_msg_$PID.txt"
rm "verbose_help_msg_$PID.txt"