Skip to content

Commit 305e961

Browse files
committed
[TEST] Fix warnings in stress tests
1 parent e9ffb1d commit 305e961

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

‎sdk/test/trace/batch_span_processor_test_stress.cc‎

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,13 @@ template <typename Operation>
6363
bool CallWithWatchdog(const char *operation_name,
6464
const char *stall_hint,
6565
int round,
66-
Operation operation)
66+
const Operation &operation)
6767
{
6868
auto result = std::async(std::launch::async, operation);
6969
if (result.wait_for(kWakeupWatchdog) == std::future_status::timeout)
7070
{
7171
std::cerr << operation_name << " did not return within " << kWakeupWatchdog.count()
72-
<< "m at round " << round << ". " << stall_hint << std::endl;
72+
<< "m at round " << round << ". " << stall_hint << '\n';
7373
std::abort();
7474
}
7575
return result.get();
@@ -95,10 +95,13 @@ void RunWorkerParkRace(const char *operation_name, const char *stall_hint, Opera
9595

9696
// Vary the offset across a sweep so that over the whole set we have a better chance of hitting
9797
// the race window.
98-
int spin_iterations = round * kSpinSweep;
99-
for (volatile int s = 0; s < spin_iterations; ++s)
98+
int spin_iterations = round * kSpinSweep;
99+
volatile int spin_sink = 0;
100+
for (int s = 0; s < spin_iterations; ++s)
100101
{
101102
// busy-spin a scheduling-independent increasing amount to sweep the race offset
103+
int next = spin_sink;
104+
spin_sink = next + 1;
102105
}
103106
processor->OnEnd(processor->MakeRecordable());
104107

0 commit comments

Comments
 (0)