File tree 5 files changed +37
-19
lines changed
5 files changed +37
-19
lines changed Original file line number Diff line number Diff line change 7
7
#include < netaddress.h>
8
8
#include < netbase.h>
9
9
#include < test/fuzz/util/check_globals.h>
10
+ #include < test/util/coverage.h>
10
11
#include < test/util/random.h>
11
12
#include < test/util/setup_common.h>
12
13
#include < util/check.h>
@@ -89,25 +90,6 @@ const std::function<std::string()> G_TEST_GET_FULL_NAME{[]{
89
90
return std::string{g_fuzz_target};
90
91
}};
91
92
92
- #if defined(__clang__) && defined(__linux__)
93
- extern " C" void __llvm_profile_reset_counters (void ) __attribute__((weak));
94
- extern " C" void __gcov_reset (void ) __attribute__((weak));
95
-
96
- void ResetCoverageCounters ()
97
- {
98
- if (__llvm_profile_reset_counters) {
99
- __llvm_profile_reset_counters ();
100
- }
101
-
102
- if (__gcov_reset) {
103
- __gcov_reset ();
104
- }
105
- }
106
- #else
107
- void ResetCoverageCounters () {}
108
- #endif
109
-
110
-
111
93
static void initialize ()
112
94
{
113
95
// By default, make the RNG deterministic with a fixed seed. This will affect all
Original file line number Diff line number Diff line change 5
5
add_library (test_util STATIC EXCLUDE_FROM_ALL
6
6
blockfilter.cpp
7
7
coins.cpp
8
+ coverage.cpp
8
9
index.cpp
9
10
json.cpp
10
11
logging.cpp
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2025-present The Bitcoin Core developers
2
+ // Distributed under the MIT software license, see the accompanying
3
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
+
5
+ #include < test/util/coverage.h>
6
+
7
+ #if defined(__clang__) && defined(__linux__)
8
+ extern " C" void __llvm_profile_reset_counters (void ) __attribute__((weak));
9
+ extern " C" void __gcov_reset (void ) __attribute__((weak));
10
+
11
+ void ResetCoverageCounters ()
12
+ {
13
+ if (__llvm_profile_reset_counters) {
14
+ __llvm_profile_reset_counters ();
15
+ }
16
+
17
+ if (__gcov_reset) {
18
+ __gcov_reset ();
19
+ }
20
+ }
21
+ #else
22
+ void ResetCoverageCounters () {}
23
+ #endif
Original file line number Diff line number Diff line change
1
+ // Copyright (c) 2025-present The Bitcoin Core developers
2
+ // Distributed under the MIT software license, see the accompanying
3
+ // file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
+
5
+ #ifndef BITCOIN_TEST_UTIL_COVERAGE_H
6
+ #define BITCOIN_TEST_UTIL_COVERAGE_H
7
+
8
+ void ResetCoverageCounters ();
9
+
10
+ #endif // BITCOIN_TEST_UTIL_COVERAGE_H
Original file line number Diff line number Diff line change 37
37
#include < scheduler.h>
38
38
#include < script/sigcache.h>
39
39
#include < streams.h>
40
+ #include < test/util/coverage.h>
40
41
#include < test/util/net.h>
41
42
#include < test/util/random.h>
42
43
#include < test/util/txmempool.h>
@@ -80,6 +81,7 @@ static const bool g_rng_temp_path_init{[] {
80
81
Assert (!g_used_g_prng);
81
82
(void )g_rng_temp_path.rand64 ();
82
83
g_used_g_prng = false ;
84
+ ResetCoverageCounters (); // The seed strengthen in SeedStartup is not deterministic, so exclude it from coverage counts
83
85
return true ;
84
86
}()};
85
87
You can’t perform that action at this time.
0 commit comments