Skip to content

Commit

Permalink
SQ -> Tests: Shell: Skip on ASan CI runs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfstr committed Jul 17, 2024
1 parent 4bf1a8f commit cde2cad
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions src/crystal/tests/test_shell.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
from crystal.tests.util.server import served_project
from crystal.tests.util.skip import skipTest
from crystal.tests.util.subtests import SubtestsContext, with_subtests
from crystal.tests.util.xos import skip_on_windows
from crystal.util.xos import is_asan, is_windows
from crystal.util.xthreading import fg_call_and_wait
from functools import wraps
Expand Down Expand Up @@ -163,6 +162,8 @@ def test_builtin_globals_have_stable_public_api(subtests: SubtestsContext) -> No

@with_subtests
def test_shell_exits_with_expected_message(subtests: SubtestsContext) -> None:
_ensure_can_use_crystal_shell()

with subtests.test(case='test when first open/create dialog is closed given shell is running then shell remains running'):
with crystal_shell() as (crystal, _):
_close_open_or_create_dialog(crystal)
Expand Down Expand Up @@ -700,16 +701,7 @@ def crystal_shell(*, env_extra={}) -> Iterator[Tuple[subprocess.Popen, str]]:
Context which starts "crystal --shell" upon enter
and cleans up the associated process upon exit.
"""
if is_windows():
# NOTE: Windows doesn't provide stdout for graphical processes,
# which is needed by the current implementation.
# Workaround is possible with run_exe.py but time-consuming to implement.
skipTest('not supported on Windows; graphical subprocesses are mute')
if is_asan():
# NOTE: ASan slows down many operations, causing shell operations to
# spuriously fail timeout checks, even when
# CRYSTAL_GLOBAL_TIMEOUT_MULTIPLIER is used
skipTest('too slow when run with Address Sanitizer')
_ensure_can_use_crystal_shell()

# Determine how to run Crystal on command line
crystal_command: List[str]
Expand Down Expand Up @@ -761,6 +753,19 @@ def crystal_shell(*, env_extra={}) -> Iterator[Tuple[subprocess.Popen, str]]:
crystal.wait()


def _ensure_can_use_crystal_shell() -> None:
if is_windows():
# NOTE: Windows doesn't provide stdout for graphical processes,
# which is needed by the current implementation.
# Workaround is possible with run_exe.py but time-consuming to implement.
skipTest('not supported on Windows; graphical subprocesses are mute')
if is_asan():
# NOTE: ASan slows down many operations, causing shell operations to
# spuriously fail timeout checks, even when
# CRYSTAL_GLOBAL_TIMEOUT_MULTIPLIER is used
skipTest('too slow when run with Address Sanitizer')


def _py_eval(
python: subprocess.Popen,
py_code: str,
Expand Down

0 comments on commit cde2cad

Please sign in to comment.