grpc
third_party
boringssl-with-bazel
src
crypto
test
boringssl-with-bazel/src/crypto/test/gtest_main.cc
Go to the documentation of this file.
1
/* Copyright (c) 2016, Google Inc.
2
*
3
* Permission to use, copy, modify, and/or distribute this software for any
4
* purpose with or without fee is hereby granted, provided that the above
5
* copyright notice and this permission notice appear in all copies.
6
*
7
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10
* SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12
* OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14
15
#include <stdio.h>
16
#include <
string.h
>
17
18
#include <gtest/gtest.h>
19
20
#include <
openssl/cpu.h
>
21
#include <
openssl/rand.h
>
22
23
#include "
abi_test.h
"
24
#include "
gtest_main.h
"
25
#include "../internal.h"
26
27
#if (defined(OPENSSL_ARM) || defined(OPENSSL_AARCH64)) && \
28
!defined(OPENSSL_STATIC_ARMCAP)
29
#include <
openssl/arm_arch.h
>
30
#define TEST_ARM_CPUS
31
#endif
32
33
34
int
main
(
int
argc,
char
**argv) {
35
testing::InitGoogleTest
(&argc, argv);
36
bssl::SetupGoogleTest
();
37
38
bool
unwind_tests =
true
;
39
for
(
int
i
= 1;
i
< argc;
i
++) {
40
#if !defined(OPENSSL_WINDOWS)
41
if
(strcmp(argv[
i
],
"--fork_unsafe_buffering"
) == 0) {
42
RAND_enable_fork_unsafe_buffering
(-1);
43
}
44
#endif
45
46
#if defined(TEST_ARM_CPUS)
47
if
(strncmp(argv[
i
],
"--cpu="
, 6) == 0) {
48
const
char
*cpu = argv[
i
] + 6;
49
uint32_t
armcap;
50
if
(strcmp(cpu,
"none"
) == 0) {
51
armcap = 0;
52
}
else
if
(strcmp(cpu,
"neon"
) == 0) {
53
armcap =
ARMV7_NEON
;
54
}
else
if
(strcmp(cpu,
"crypto"
) == 0) {
55
armcap =
ARMV7_NEON
|
ARMV8_AES
|
ARMV8_SHA1
|
ARMV8_SHA256
|
ARMV8_PMULL
;
56
}
else
{
57
fprintf(
stderr
,
"Unknown CPU: %s\n"
, cpu);
58
exit(1);
59
}
60
61
uint32_t
*armcap_ptr = OPENSSL_get_armcap_pointer_for_test();
62
if
((armcap & *armcap_ptr) != armcap) {
63
fprintf(
stderr
,
64
"Host CPU does not support features for testing CPU '%s'.\n"
,
65
cpu);
66
exit(89);
67
}
68
printf
(
"Simulating CPU '%s'\n"
, cpu);
69
*armcap_ptr = armcap;
70
}
71
#endif // TEST_ARM_CPUS
72
73
if
(strcmp(argv[
i
],
"--no_unwind_tests"
) == 0) {
74
unwind_tests =
false
;
75
}
76
}
77
78
if
(unwind_tests) {
79
abi_test::EnableUnwindTests
();
80
}
81
82
return
RUN_ALL_TESTS
();
83
}
main
int main(int argc, char **argv)
Definition:
boringssl-with-bazel/src/crypto/test/gtest_main.cc:34
string.h
printf
_Use_decl_annotations_ int __cdecl printf(const char *_Format,...)
Definition:
cs_driver.c:91
gtest_main.h
ARMV8_AES
#define ARMV8_AES
Definition:
arm_arch.h:109
python_utils.port_server.stderr
stderr
Definition:
port_server.py:51
uint32_t
unsigned int uint32_t
Definition:
stdint-msvc2008.h:80
ARMV7_NEON
#define ARMV7_NEON
Definition:
arm_arch.h:106
ARMV8_SHA256
#define ARMV8_SHA256
Definition:
arm_arch.h:115
arm_arch.h
RUN_ALL_TESTS
int RUN_ALL_TESTS() GTEST_MUST_USE_RESULT_
Definition:
bloaty/third_party/googletest/googletest/include/gtest/gtest.h:2471
testing::InitGoogleTest
GTEST_API_ void InitGoogleTest(int *argc, char **argv)
Definition:
bloaty/third_party/googletest/googletest/src/gtest.cc:6106
rand.h
ARMV8_PMULL
#define ARMV8_PMULL
Definition:
arm_arch.h:118
RAND_enable_fork_unsafe_buffering
#define RAND_enable_fork_unsafe_buffering
Definition:
boringssl_prefix_symbols.h:2064
cpu.h
abi_test.h
ARMV8_SHA1
#define ARMV8_SHA1
Definition:
arm_arch.h:112
abi_test::EnableUnwindTests
void EnableUnwindTests()
Definition:
abi_test.cc:786
SetupGoogleTest
void SetupGoogleTest()
Definition:
gtest_main.h:56
i
uint64_t i
Definition:
abseil-cpp/absl/container/btree_benchmark.cc:230
grpc
Author(s):
autogenerated on Fri May 16 2025 02:58:54