mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-18 13:42:02 +00:00
5de11979ce
* Unify query elapsed time reporting * add-test: Make shell tests executable * Add some tests around query elapsed time * Style and ubsan
32 lines
831 B
Bash
Executable File
32 lines
831 B
Bash
Executable File
#!/bin/bash
|
|
|
|
if [ -z "$1" ]; then
|
|
echo "Helper script to create empty test and reference files and assign a new number."
|
|
echo "Usage: $0 <base_test_name>"
|
|
exit 1
|
|
fi
|
|
|
|
TESTS_PATH=$(dirname ${BASH_SOURCE[0]})
|
|
set -ue
|
|
|
|
# shellcheck disable=SC2010
|
|
LAST_TEST_NO=$(ls -1 ${TESTS_PATH} | grep -P -o '^\d+' | sort -nr | head -1)
|
|
|
|
# remove leading zeros, increment and add padding zeros to 5 digits
|
|
NEW_TEST_NO=$(printf "%05d\n" $((10#$LAST_TEST_NO + 1)))
|
|
|
|
# if extension is not provided, use `.sql`
|
|
FILENAME="${1}"
|
|
FILEEXT="sql"
|
|
if [[ $1 == *.* ]] ; then
|
|
FILENAME="${1%.*}"
|
|
FILEEXT="${1##*.}"
|
|
fi
|
|
|
|
set -x
|
|
touch ${TESTS_PATH}/${NEW_TEST_NO}_${FILENAME}.${FILEEXT}
|
|
if [[ $FILEEXT == "sh" ]] ; then
|
|
chmod +x ${TESTS_PATH}/${NEW_TEST_NO}_${FILENAME}.${FILEEXT}
|
|
fi
|
|
touch ${TESTS_PATH}/${NEW_TEST_NO}_${FILENAME}.reference
|