xref: /aosp_15_r20/system/keymaster/tests/gtest_main.cpp (revision 789431f29546679ab5188a97751fb38e3018d44d)
1*789431f2SAndroid Build Coastguard Worker /*
2*789431f2SAndroid Build Coastguard Worker  * Copyright (C) 2015 The Android Open Source Project
3*789431f2SAndroid Build Coastguard Worker  *
4*789431f2SAndroid Build Coastguard Worker  * Licensed under the Apache License, Version 2.0 (the "License");
5*789431f2SAndroid Build Coastguard Worker  * you may not use this file except in compliance with the License.
6*789431f2SAndroid Build Coastguard Worker  * You may obtain a copy of the License at
7*789431f2SAndroid Build Coastguard Worker  *
8*789431f2SAndroid Build Coastguard Worker  *      http://www.apache.org/licenses/LICENSE-2.0
9*789431f2SAndroid Build Coastguard Worker  *
10*789431f2SAndroid Build Coastguard Worker  * Unless required by applicable law or agreed to in writing, software
11*789431f2SAndroid Build Coastguard Worker  * distributed under the License is distributed on an "AS IS" BASIS,
12*789431f2SAndroid Build Coastguard Worker  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13*789431f2SAndroid Build Coastguard Worker  * See the License for the specific language governing permissions and
14*789431f2SAndroid Build Coastguard Worker  * limitations under the License.
15*789431f2SAndroid Build Coastguard Worker  */
16*789431f2SAndroid Build Coastguard Worker 
17*789431f2SAndroid Build Coastguard Worker #include <gtest/gtest.h>
18*789431f2SAndroid Build Coastguard Worker 
19*789431f2SAndroid Build Coastguard Worker #include <openssl/engine.h>
20*789431f2SAndroid Build Coastguard Worker 
main(int argc,char ** argv)21*789431f2SAndroid Build Coastguard Worker int main(int argc, char** argv) {
22*789431f2SAndroid Build Coastguard Worker #if !defined(OPENSSL_IS_BORINGSSL)
23*789431f2SAndroid Build Coastguard Worker     ERR_load_crypto_strings();
24*789431f2SAndroid Build Coastguard Worker #endif  // not OPENSSL_IS_BORINGSSL
25*789431f2SAndroid Build Coastguard Worker     ::testing::InitGoogleTest(&argc, argv);
26*789431f2SAndroid Build Coastguard Worker     int result = RUN_ALL_TESTS();
27*789431f2SAndroid Build Coastguard Worker #if !defined(OPENSSL_IS_BORINGSSL)
28*789431f2SAndroid Build Coastguard Worker     // Clean up stuff OpenSSL leaves around, so Valgrind doesn't complain.
29*789431f2SAndroid Build Coastguard Worker     CRYPTO_cleanup_all_ex_data();
30*789431f2SAndroid Build Coastguard Worker     ERR_remove_thread_state(NULL);
31*789431f2SAndroid Build Coastguard Worker     ERR_free_strings();
32*789431f2SAndroid Build Coastguard Worker #endif  // not OPENSSL_IS_BORINGSSL
33*789431f2SAndroid Build Coastguard Worker     return result;
34*789431f2SAndroid Build Coastguard Worker }
35