Skip to content

Commit 75cbb87

Browse files
committed
split tsan and asan check
Signed-off-by: asingh-g <[email protected]>
1 parent e9b7022 commit 75cbb87

File tree

3 files changed

+27
-4
lines changed

3 files changed

+27
-4
lines changed

test/integration/integration_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
plugins=["xdist"])
3636
if (r != 0):
3737
exit(r)
38-
if not utility.isSanitizerRun():
38+
if not utility.isTsanRun():
3939
r = pytest.main(
4040
[
4141
"--rootdir=" + path,

test/integration/utility.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,31 @@ def parseUrisToSocketAddress(uris: list[str]) -> list[SocketAddress]:
3333
return addresses
3434

3535

36+
def isTsanRun():
37+
"""Determine if current execution is tsan.
38+
39+
Returns:
40+
bool: True iff the current execution is determined to be a sanitizer run.
41+
"""
42+
return True if os.environ.get("NH_INTEGRATION_TEST_THREAD_SANITIZER_RUN", 0) == "1" else False
43+
44+
45+
def isAsanRun():
46+
"""Determine if current execution is asan.
47+
48+
Returns:
49+
bool: True iff the current execution is determined to be a sanitizer run.
50+
"""
51+
return True if os.environ.get("NH_INTEGRATION_TEST_ADDRESS_SANITIZER_RUN", 0) == "1" else False
52+
53+
3654
def isSanitizerRun():
3755
"""Determine if the current execution is a tsan/asan/ubsan run.
3856
3957
Returns:
4058
bool: True iff the current execution is determined to be a sanitizer run.
4159
"""
42-
return True if os.environ.get("NH_INTEGRATION_TEST_SANITIZER_RUN", 0) == "1" else False
60+
return True if isTsanRun() or isAsanRun() else False
4361

4462

4563
def run_binary_with_args(binary, args):

test/python_test.cc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,13 @@ class PythonTest : public Test {};
1313
// of getting code coverage reporting to also consider the code hit by integration tests.
1414
TEST_F(PythonTest, IntegrationTests) {
1515
const std::string path = TestEnvironment::runfilesPath("test/integration/integration_test");
16-
#if defined(__has_feature) && (__has_feature(thread_sanitizer) || __has_feature(address_sanitizer))
17-
char env[] = "NH_INTEGRATION_TEST_SANITIZER_RUN=1";
16+
#if defined(__has_feature) && (__has_feature(address_sanitizer))
17+
char env[] = "NH_INTEGRATION_TEST_ADDRESS_SANITIZER_RUN=1";
18+
putenv(env);
19+
#endif
20+
21+
#if defined(__has_feature) && (__has_feature(thread_sanitizer))
22+
char env[] = "NH_INTEGRATION_TEST_THREAD_SANITIZER_RUN=1";
1823
putenv(env);
1924
#endif
2025
ASSERT_EQ(0, system(path.c_str()));

0 commit comments

Comments
 (0)