Skip to content

Commit 7b36f59

Browse files
committed
Add many skip tests for WASI due to stack issues
1 parent 978b5e7 commit 7b36f59

File tree

10 files changed

+19
-6
lines changed

10 files changed

+19
-6
lines changed

Lib/test/list_tests.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
from functools import cmp_to_key
77

88
from test import seq_tests
9-
from test.support import ALWAYS_EQ, NEVER_EQ, skip_emscripten_stack_overflow
9+
from test.support import ALWAYS_EQ, NEVER_EQ
10+
from test.support import skip_emscripten_stack_overflow, skip_wasi_stack_overflow
1011

1112

1213
class CommonTest(seq_tests.CommonTest):
@@ -59,6 +60,7 @@ def test_repr(self):
5960
self.assertEqual(str(a2), "[0, 1, 2, [...], 3]")
6061
self.assertEqual(repr(a2), "[0, 1, 2, [...], 3]")
6162

63+
@skip_wasi_stack_overflow()
6264
@skip_emscripten_stack_overflow()
6365
def test_repr_deep(self):
6466
a = self.type2test([])

Lib/test/mapping_tests.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# tests common to dict and UserDict
22
import unittest
33
import collections
4-
from test.support import skip_emscripten_stack_overflow
4+
from test.support import skip_emscripten_stack_overflow, skip_wasi_stack_overflow
55

66

77
class BasicTestMappingProtocol(unittest.TestCase):
@@ -622,6 +622,7 @@ def __repr__(self):
622622
d = self._full_mapping({1: BadRepr()})
623623
self.assertRaises(Exc, repr, d)
624624

625+
@skip_wasi_stack_overflow()
625626
@skip_emscripten_stack_overflow()
626627
def test_repr_deep(self):
627628
d = self._empty_mapping()

Lib/test/support/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -557,6 +557,9 @@ def skip_android_selinux(name):
557557
def skip_emscripten_stack_overflow():
558558
return unittest.skipIf(is_emscripten, "Exhausts limited stack on Emscripten")
559559

560+
def skip_wasi_stack_overflow():
561+
return unittest.skipIf(is_wasi, "Exhausts stack on WASI")
562+
560563
is_apple_mobile = sys.platform in {"ios", "tvos", "watchos"}
561564
is_apple = is_apple_mobile or sys.platform == "darwin"
562565

Lib/test/test_ast/test_ast.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,8 @@
1818
_testinternalcapi = None
1919

2020
from test import support
21-
from test.support import os_helper, script_helper, skip_emscripten_stack_overflow
21+
from test.support import os_helper, script_helper
22+
from test.support import skip_emscripten_stack_overflow, skip_wasi_stack_overflow
2223
from test.support.ast_helper import ASTTestMixin
2324
from test.test_ast.utils import to_tuple
2425
from test.test_ast.snippets import (
@@ -745,6 +746,7 @@ def next(self):
745746
enum._test_simple_enum(_Precedence, ast._Precedence)
746747

747748
@support.cpython_only
749+
@skip_wasi_stack_overflow()
748750
@skip_emscripten_stack_overflow()
749751
def test_ast_recursion_limit(self):
750752
crash_depth = 200_000

Lib/test/test_dict.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,7 @@ def __repr__(self):
594594
d = {1: BadRepr()}
595595
self.assertRaises(Exc, repr, d)
596596

597+
@support.skip_wasi_stack_overflow()
597598
@support.skip_emscripten_stack_overflow()
598599
def test_repr_deep(self):
599600
d = {}

Lib/test/test_dictviews.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import copy
33
import pickle
44
import unittest
5-
from test.support import skip_emscripten_stack_overflow
5+
from test.support import skip_emscripten_stack_overflow, skip_wasi_stack_overflow
66

77
class DictSetTest(unittest.TestCase):
88

@@ -277,6 +277,7 @@ def test_recursive_repr(self):
277277
# Again.
278278
self.assertIsInstance(r, str)
279279

280+
@skip_wasi_stack_overflow()
280281
@skip_emscripten_stack_overflow()
281282
def test_deeply_nested_repr(self):
282283
d = {}

Lib/test/test_json/test_recursion.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ def test_highly_nested_objects_decoding(self):
8282
with support.infinite_recursion():
8383
self.loads('[' * 100000 + '1' + ']' * 100000)
8484

85+
@support.skip_wasi_stack_overflow()
8586
@support.skip_emscripten_stack_overflow()
8687
def test_highly_nested_objects_encoding(self):
8788
# See #12051

Lib/test/test_sys_settrace.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3042,11 +3042,11 @@ def f():
30423042
return (
30433043
{}
30443044
)
3045-
""".format("\n+\n".join(f"var{i}\n" for i in range(count)))
3045+
""".format("\n,\n".join(f"var{i}\n" for i in range(count)))
30463046
ns = {f"var{i}": i for i in range(count)}
30473047
exec(code, ns)
30483048
counts = self.count_traces(ns["f"])
3049-
self.assertEqual(counts, {'call': 1, 'line': count * 2, 'return': 1})
3049+
self.assertEqual(counts, {'call': 1, 'line': count * 2 + 1, 'return': 1})
30503050

30513051

30523052
class TestEdgeCases(unittest.TestCase):

Lib/test/test_tokenize.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3040,6 +3040,7 @@ def get_tokens(string):
30403040
with self.subTest(case=case):
30413041
self.assertRaises(tokenize.TokenError, get_tokens, case)
30423042

3043+
@support.skip_wasi_stack_overflow()
30433044
def test_max_indent(self):
30443045
MAXINDENT = 100
30453046

Lib/test/test_xml_etree_c.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ def test_del_attribute(self):
5757
del element.attrib
5858
self.assertEqual(element.attrib, {'A': 'B', 'C': 'D'})
5959

60+
@support.skip_wasi_stack_overflow()
6061
@unittest.skipIf(support.is_emscripten, "segfaults")
6162
def test_trashcan(self):
6263
# If this test fails, it will most likely die via segfault.

0 commit comments

Comments
 (0)