Skip to content

Commit

Permalink
char_util-test: disable TSAN instrumentation in stress tests
Browse files Browse the repository at this point in the history
The UTF8 stress test was sometimes timing out in TSAN precommit.

Change-Id: Ibaafba2e73cdfeec3ca3f7091cedc316238600b2
Reviewed-on: http://gerrit.cloudera.org:8080/14835
Reviewed-by: Andrew Wong <[email protected]>
Tested-by: Adar Dembo <[email protected]>
  • Loading branch information
adembo committed Dec 5, 2019
1 parent c29d144 commit ac6198f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/kudu/util/char_util-test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include <glog/logging.h>
#include <gtest/gtest.h>

#include "kudu/util/debug/sanitizer_scopes.h"
#include "kudu/util/env.h"
#include "kudu/util/faststring.h"
#include "kudu/util/init.h"
Expand Down Expand Up @@ -60,6 +61,10 @@ class CharUtilTest : public KuduTest {
}

void StressTest(const Slice& slice, int length) {
// The memory accesses done in UTF8Truncate are quite slow with TSAN
// instrumentation, probably because so many of them are unaligned.
// Since this test is single-threaded, let's just disable TSAN in it.
debug::ScopedTSANIgnoreReadsAndWrites ignore_tsan;
for (int i = 0; i < kNumCycles_; ++i) {
Slice result;
auto ptr = Truncate(slice, length, &result);
Expand Down
5 changes: 3 additions & 2 deletions src/kudu/util/char_util.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@

#include "kudu/util/char_util.h"

#include <algorithm>
#include <cstring>
#include <emmintrin.h>
#include <smmintrin.h>

#include <algorithm>
#include <cstring>

namespace kudu {

Slice UTF8Truncate(Slice val, size_t max_utf8_length) {
Expand Down

0 comments on commit ac6198f

Please sign in to comment.