xref: /aosp_15_r20/external/perfetto/test/integrationtest_initializer.h (revision 6dbdd20afdafa5e3ca9b8809fa73465d530080dc)
1 /*
2  * Copyright (C) 2024 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef TEST_INTEGRATIONTEST_INITIALIZER_H_
18 #define TEST_INTEGRATIONTEST_INITIALIZER_H_
19 
20 namespace perfetto::integration_tests {
21 
22 // Simple mechanism to execute code at the beginning of the integrationtest
23 // main() before the gtest tests are run.
24 //
25 // Usage
26 // ```
27 // int PERFETTO_UNUSED initializer =
28 //     integration_tests::Register...Initializer(
29 //         &InitializerFunction);
30 // ```
31 //
32 // This is probably more verbose than required to keep the implementation
33 // straightforward and avoid as much as possible all the pitfalls of static
34 // initialization order.
35 
36 // Implemented in integrationtest_main.cc
37 
38 int RegisterHeapprofdEndToEndTestInitializer(void (*fn)(void));
39 int RegisterApiIntegrationTestInitializer(void (*fn)(void));
40 
41 }  // namespace perfetto::integration_tests
42 
43 #endif  // TEST_INTEGRATIONTEST_INITIALIZER_H_
44