Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run Python tests under asan with leak san disabled. #3304

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will just make the Windows build fail right? Instead, you could use target_compatible_with to mark targets as incompatible with Windows if env is set

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, just passing env on non-Windows is probably easier and avoids just skipping the tests on Windows (assuming we won't have windows-asan in the future).

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)
Loading