Skip to content

Commit

Permalink
Run Python tests under asan with leak san disabled.
Browse files Browse the repository at this point in the history
  • Loading branch information
dom96 committed Jan 9, 2025
1 parent 6600131 commit b4381a1
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 21 deletions.
13 changes: 12 additions & 1 deletion build/wd_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ def _wd_test_impl(ctx):
# can't just specify some other executable with some args. OK, fine, we'll use a script that
# just execs its args.
if is_windows:
if len(ctx.attr.env):
fail("`env` attribute to _wd_test not supported on Windows")

# Batch script executables must end with ".bat"
executable = ctx.actions.declare_file("%s_wd_test.bat" % ctx.label.name)
ctx.actions.write(
Expand All @@ -73,15 +76,22 @@ def _wd_test_impl(ctx):
)
else:
executable = ctx.outputs.executable

env_exports_list = []
for key, value in ctx.attr.env.items():
env_exports_list.append('export %s="%s"' % (key, value))
env_exports = "\n".join(env_exports_list)

ctx.actions.write(
output = executable,
content = """
#! /bin/sh
echo
echo \\(cd `pwd` \\&\\& \"$@\" -dTEST_TMPDIR=$TEST_TMPDIR\\)
echo
%s
exec \"$@\" -dTEST_TMPDIR=$TEST_TMPDIR
""",
""" % env_exports,
is_executable = True,
)

Expand All @@ -105,5 +115,6 @@ _wd_test = rule(
"flags": attr.string_list(),
"data": attr.label_list(allow_files = True),
"_platforms_os_windows": attr.label(default = "@platforms//os:windows"),
"env": attr.string_dict(default = {}),
},
)
8 changes: 4 additions & 4 deletions src/cloudflare/internal/test/ai/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ py_wd_test(
"*.js",
"*.py",
]),
tags = [
# TODO(someday): Fix asan failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
"no-asan",
],
# TODO(someday): Fix leak san failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
env = {
"ASAN_OPTIONS": "detect_leaks=0",
},
)
8 changes: 4 additions & 4 deletions src/cloudflare/internal/test/aig/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ py_wd_test(
"*.js",
"*.py",
]),
tags = [
# TODO(someday): Fix asan failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
"no-asan",
],
# TODO(someday): Fix leak san failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
env = {
"ASAN_OPTIONS": "detect_leaks=0",
},
)
8 changes: 4 additions & 4 deletions src/cloudflare/internal/test/d1/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ py_wd_test(
"*.py",
"*.js",
]),
tags = [
# TODO(someday): Fix asan failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
"no-asan",
],
# TODO(someday): Fix leak san failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
env = {
"ASAN_OPTIONS": "detect_leaks=0",
},
)
8 changes: 4 additions & 4 deletions src/cloudflare/internal/test/vectorize/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ py_wd_test(
"*.py",
"*.js",
]),
tags = [
# TODO(someday): Fix asan failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
"no-asan",
],
# TODO(someday): Fix leak san failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
env = {
"ASAN_OPTIONS": "detect_leaks=0",
},
)
8 changes: 4 additions & 4 deletions src/workerd/server/tests/python/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ py_wd_test("subdirectory")

py_wd_test(
"sdk",
tags = [
# TODO(someday): Fix asan failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
"no-asan",
],
# TODO(someday): Fix leak san failure for this, see https://github.com/cloudflare/workerd/pull/3140#discussion_r1858273318
env = {
"ASAN_OPTIONS": "detect_leaks=0",
},
)

gen_import_tests(PYODIDE_IMPORTS_TO_TEST)

0 comments on commit b4381a1

Please sign in to comment.