mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-28 18:42:26 +00:00
Add force-color option for ctest
This commit is contained in:
parent
aaa07dd5c3
commit
cc8186b77c
@ -21,19 +21,6 @@ import termcolor
|
|||||||
from random import random
|
from random import random
|
||||||
import commands
|
import commands
|
||||||
|
|
||||||
def colored(text, color=None, on_color=None, attrs=None):
|
|
||||||
if sys.stdout.isatty():
|
|
||||||
return termcolor.colored(text, color, on_color, attrs)
|
|
||||||
else:
|
|
||||||
return text
|
|
||||||
|
|
||||||
OP_SQUARE_BRACKET = colored("[", attrs=['bold'])
|
|
||||||
CL_SQUARE_BRACKET = colored("]", attrs=['bold'])
|
|
||||||
|
|
||||||
MSG_FAIL = OP_SQUARE_BRACKET + colored(" FAIL ", "red", attrs=['bold']) + CL_SQUARE_BRACKET
|
|
||||||
MSG_UNKNOWN = OP_SQUARE_BRACKET + colored(" UNKNOWN ", "yellow", attrs=['bold']) + CL_SQUARE_BRACKET
|
|
||||||
MSG_OK = OP_SQUARE_BRACKET + colored(" OK ", "green", attrs=['bold']) + CL_SQUARE_BRACKET
|
|
||||||
MSG_SKIPPED = OP_SQUARE_BRACKET + colored(" SKIPPED ", "cyan", attrs=['bold']) + CL_SQUARE_BRACKET
|
|
||||||
|
|
||||||
MESSAGES_TO_RETRY = [
|
MESSAGES_TO_RETRY = [
|
||||||
"DB::Exception: ZooKeeper session has been expired",
|
"DB::Exception: ZooKeeper session has been expired",
|
||||||
@ -104,6 +91,20 @@ def main(args):
|
|||||||
|
|
||||||
SERVER_DIED = False
|
SERVER_DIED = False
|
||||||
|
|
||||||
|
def colored(text, color=None, on_color=None, attrs=None):
|
||||||
|
if sys.stdout.isatty() or args.force_color:
|
||||||
|
return termcolor.colored(text, color, on_color, attrs)
|
||||||
|
else:
|
||||||
|
return text
|
||||||
|
|
||||||
|
OP_SQUARE_BRACKET = colored("[", attrs=['bold'])
|
||||||
|
CL_SQUARE_BRACKET = colored("]", attrs=['bold'])
|
||||||
|
|
||||||
|
MSG_FAIL = OP_SQUARE_BRACKET + colored(" FAIL ", "red", attrs=['bold']) + CL_SQUARE_BRACKET
|
||||||
|
MSG_UNKNOWN = OP_SQUARE_BRACKET + colored(" UNKNOWN ", "yellow", attrs=['bold']) + CL_SQUARE_BRACKET
|
||||||
|
MSG_OK = OP_SQUARE_BRACKET + colored(" OK ", "green", attrs=['bold']) + CL_SQUARE_BRACKET
|
||||||
|
MSG_SKIPPED = OP_SQUARE_BRACKET + colored(" SKIPPED ", "cyan", attrs=['bold']) + CL_SQUARE_BRACKET
|
||||||
|
|
||||||
def is_data_present():
|
def is_data_present():
|
||||||
clickhouse_proc = Popen(shlex.split(args.client), stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
clickhouse_proc = Popen(shlex.split(args.client), stdin=PIPE, stdout=PIPE, stderr=PIPE)
|
||||||
(stdout, stderr) = clickhouse_proc.communicate("EXISTS TABLE test.hits")
|
(stdout, stderr) = clickhouse_proc.communicate("EXISTS TABLE test.hits")
|
||||||
@ -438,6 +439,7 @@ if __name__ == '__main__':
|
|||||||
parser.add_argument('--order', default='desc', help='Run order (asc, desc, random)')
|
parser.add_argument('--order', default='desc', help='Run order (asc, desc, random)')
|
||||||
parser.add_argument('--testname', action='store_true', default=None, dest='testname', help='Make query with test name before test run')
|
parser.add_argument('--testname', action='store_true', default=None, dest='testname', help='Make query with test name before test run')
|
||||||
parser.add_argument('--hung-check', action='store_true', default=False)
|
parser.add_argument('--hung-check', action='store_true', default=False)
|
||||||
|
parser.add_argument('--force-color', action='store_true', default=False)
|
||||||
|
|
||||||
parser.add_argument('--no-stateless', action='store_true', help='Disable all stateless tests')
|
parser.add_argument('--no-stateless', action='store_true', help='Disable all stateless tests')
|
||||||
parser.add_argument('--skip', nargs='+', help="Skip these tests")
|
parser.add_argument('--skip', nargs='+', help="Skip these tests")
|
||||||
|
@ -131,7 +131,7 @@ else
|
|||||||
TEST_DICT=${TEST_DICT=1}
|
TEST_DICT=${TEST_DICT=1}
|
||||||
CLICKHOUSE_CLIENT_QUERY="${CLICKHOUSE_CLIENT} --config ${CLICKHOUSE_CONFIG_CLIENT} --port $CLICKHOUSE_PORT_TCP -m -n -q"
|
CLICKHOUSE_CLIENT_QUERY="${CLICKHOUSE_CLIENT} --config ${CLICKHOUSE_CONFIG_CLIENT} --port $CLICKHOUSE_PORT_TCP -m -n -q"
|
||||||
$CLICKHOUSE_CLIENT_QUERY 'SELECT * from system.build_options; SELECT * FROM system.clusters;'
|
$CLICKHOUSE_CLIENT_QUERY 'SELECT * from system.build_options; SELECT * FROM system.clusters;'
|
||||||
CLICKHOUSE_TEST="env ${TEST_DIR}clickhouse-test --binary ${BIN_DIR}${CLICKHOUSE_BINARY_NAME} --configclient $CLICKHOUSE_CONFIG_CLIENT --configserver $CLICKHOUSE_CONFIG --tmp $DATA_DIR/tmp --queries $QUERIES_DIR $TEST_OPT0 $TEST_OPT"
|
CLICKHOUSE_TEST="env ${TEST_DIR}clickhouse-test --force-color --binary ${BIN_DIR}${CLICKHOUSE_BINARY_NAME} --configclient $CLICKHOUSE_CONFIG_CLIENT --configserver $CLICKHOUSE_CONFIG --tmp $DATA_DIR/tmp --queries $QUERIES_DIR $TEST_OPT0 $TEST_OPT"
|
||||||
CLICKHOUSE_PERFORMANCE_TEST="${BIN_DIR}clickhouse-performance-test --port $CLICKHOUSE_PORT_TCP --recursive $CUR_DIR/performance --skip-tags=long"
|
CLICKHOUSE_PERFORMANCE_TEST="${BIN_DIR}clickhouse-performance-test --port $CLICKHOUSE_PORT_TCP --recursive $CUR_DIR/performance --skip-tags=long"
|
||||||
if [ "${TEST_RUN_STRESS}" ]; then
|
if [ "${TEST_RUN_STRESS}" ]; then
|
||||||
# Running test in parallel will fail some results (tests can create/fill/drop same tables)
|
# Running test in parallel will fail some results (tests can create/fill/drop same tables)
|
||||||
|
Loading…
Reference in New Issue
Block a user