be/src/common/be_mock_util.h
Line | Count | Source |
1 | | // Licensed to the Apache Software Foundation (ASF) under one |
2 | | // or more contributor license agreements. See the NOTICE file |
3 | | // distributed with this work for additional information |
4 | | // regarding copyright ownership. The ASF licenses this file |
5 | | // to you under the Apache License, Version 2.0 (the |
6 | | // "License"); you may not use this file except in compliance |
7 | | // with the License. You may obtain a copy of the License at |
8 | | // |
9 | | // http://www.apache.org/licenses/LICENSE-2.0 |
10 | | // |
11 | | // Unless required by applicable law or agreed to in writing, |
12 | | // software distributed under the License is distributed on an |
13 | | // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
14 | | // KIND, either express or implied. See the License for the |
15 | | // specific language governing permissions and limitations |
16 | | // under the License. |
17 | | |
18 | | #pragma once |
19 | | #include "util/defer_op.h" |
20 | | |
21 | | namespace doris { |
22 | | |
23 | | // #define BE_TEST |
24 | | |
25 | | #ifdef BE_TEST |
26 | | #define MOCK_FUNCTION virtual |
27 | | #else |
28 | | #define MOCK_FUNCTION |
29 | | #endif |
30 | | |
31 | | #ifdef BE_TEST |
32 | | #define MOCK_DEFINE(str) str |
33 | | #else |
34 | | #define MOCK_DEFINE(str) |
35 | | #endif |
36 | | |
37 | | #ifdef BE_TEST |
38 | | #define MOCK_REMOVE(str) |
39 | | #else |
40 | 1.48k | #define MOCK_REMOVE(str) str |
41 | | #endif |
42 | | |
43 | | void mock_random_sleep(); |
44 | | |
45 | | #ifdef BE_TEST |
46 | | #define INJECT_MOCK_SLEEP(lock_guard) \ |
47 | | DEFER(mock_random_sleep()); \ |
48 | | mock_random_sleep(); \ |
49 | | lock_guard; |
50 | | #else |
51 | 8.91M | #define INJECT_MOCK_SLEEP(lock_guard) lock_guard |
52 | | #endif |
53 | | |
54 | | } // namespace doris |
55 | | |
56 | | /* |
57 | | #include "common/be_mock_util.h" |
58 | | */ |