[UT] Speed up BE unit test (#5131)

There are some long loops and sleeps in unit tests, it will cost a
very long time to run all unit tests, especially run in TSAN mode.
This patch speed up unit tests by shortening long loops and sleeps,
on my environment all unit tests finished in 1 minite. It's useful
to do basic functional unit tests.
You can switch to run in this mode by adding a new environment variable
'DORIS_ALLOW_SLOW_TESTS'. For example, you can set:
export DORIS_ALLOW_SLOW_TESTS=1
and also you can disable it by setting:
export DORIS_ALLOW_SLOW_TESTS=0
This commit is contained in:
Yingchun Lai
2020-12-27 22:19:56 +08:00
committed by GitHub
parent 85076b5678
commit 11c0aafa5c
28 changed files with 204 additions and 73 deletions

View File

@ -25,6 +25,7 @@
#include "exprs/anyval_util.h"
#include "testutil/function_utils.h"
#include "util/logging.h"
#include "test_util/test_util.h"
namespace doris {
@ -47,7 +48,7 @@ TEST_F(StringFunctionsTest, do_money_format_bench) {
doris_udf::FunctionContext* context = new doris_udf::FunctionContext();
StringVal expected =
AnyValUtil::from_string_temp(context, std::string("9,223,372,036,854,775,807.00"));
for (int i = 0; i < 10000000; i++) {
for (int i = 0; i < LOOP_LESS_OR_MORE(10, 10000000); i++) {
StringVal result =
StringFunctions::do_money_format(context, "922337203685477580700"); // cent
ASSERT_EQ(expected, result);