Skip to content

Commit 3ba7db0

Browse files
committed
start omitting some tests with opaque FS
1 parent fb98b6e commit 3ba7db0

File tree

4 files changed

+45
-28
lines changed

4 files changed

+45
-28
lines changed

graalpython/com.oracle.graal.python.test/src/tests/cpyext/__init__.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,12 @@ def setUp(self):
7171

7272

7373
def ccompile(self, name):
74+
if getattr(sys, "graal_python_opaque_filesystem", False):
75+
# distutils won't fully work with an opaque filesystem,
76+
# because we cannot read bytes from files and manipulate
77+
# them. We hope the code was already compiled.
78+
return
79+
7480
from distutils.core import setup, Extension
7581
source_file = '%s/%s.c' % (__dir__, name)
7682
file_not_empty(source_file)
@@ -459,7 +465,7 @@ def CPyExtType(name, code, **kwargs):
459465
{nb_inplace_matrix_multiply},
460466
""" if sys.version_info.minor >= 6 else "") + """
461467
}};
462-
468+
463469
static struct PyMethodDef {name}_methods[] = {{
464470
{tp_methods},
465471
{{NULL, NULL, 0, NULL}}

graalpython/com.oracle.graal.python.test/src/tests/cpyext/test_err.py

Lines changed: 29 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -152,23 +152,24 @@ def compile_module(self, name):
152152
cmpfunc=unhandled_error_compare
153153
)
154154

155-
test_PyErr_PrintEx = CPyExtFunction(
156-
lambda args: None,
157-
lambda: (
158-
(True,),
159-
),
160-
code="""PyObject* wrap_PyErr_PrintEx(int n) {
161-
PyErr_SetString(PyExc_KeyError, "unknown key whatsoever");
162-
PyErr_PrintEx(n);
163-
return Py_None;
164-
}
165-
""",
166-
resultspec="O",
167-
argspec='i',
168-
arguments=["int n"],
169-
callfunction="wrap_PyErr_PrintEx",
170-
cmpfunc=unhandled_error_compare
171-
)
155+
if not getattr(sys, "graal_python_opaque_filesystem", False):
156+
test_PyErr_PrintEx = CPyExtFunction(
157+
lambda args: None,
158+
lambda: (
159+
(True,),
160+
),
161+
code="""PyObject* wrap_PyErr_PrintEx(int n) {
162+
PyErr_SetString(PyExc_KeyError, "unknown key whatsoever");
163+
PyErr_PrintEx(n);
164+
return Py_None;
165+
}
166+
""",
167+
resultspec="O",
168+
argspec='i',
169+
arguments=["int n"],
170+
callfunction="wrap_PyErr_PrintEx",
171+
cmpfunc=unhandled_error_compare
172+
)
172173

173174
test_PyErr_GivenExceptionMatches = CPyExtFunction(
174175
_reference_givenexceptionmatches,
@@ -266,16 +267,17 @@ def compile_module(self, name):
266267
cmpfunc=unhandled_error_compare
267268
)
268269

269-
test_PyErr_WarnEx = CPyExtFunctionVoid(
270-
lambda args: warnings.warn(args[1], args[0], args[2]),
271-
lambda: (
272-
(UserWarning, "custom warning", 1),
273-
),
274-
resultspec="O",
275-
argspec='Osn',
276-
arguments=["PyObject* category", "char* msg", "Py_ssize_t level"],
277-
cmpfunc=unhandled_error_compare
278-
)
270+
if not getattr(sys, "graal_python_opaque_filesystem", False):
271+
test_PyErr_WarnEx = CPyExtFunctionVoid(
272+
lambda args: warnings.warn(args[1], args[0], args[2]),
273+
lambda: (
274+
(UserWarning, "custom warning", 1),
275+
),
276+
resultspec="O",
277+
argspec='Osn',
278+
arguments=["PyObject* category", "char* msg", "Py_ssize_t level"],
279+
cmpfunc=unhandled_error_compare
280+
)
279281

280282
test_PyErr_NoMemory = CPyExtFunctionVoid(
281283
_reference_nomemory,

graalpython/com.oracle.graal.python.test/src/tests/test_pyio.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,3 +176,11 @@ def test_builtin_open():
176176
unlink(file_name)
177177

178178
assert success
179+
180+
181+
import sys
182+
if getattr(sys, "graal_python_opaque_filesystem", False):
183+
# this cannot possibly work with opaque files
184+
for k in globals():
185+
if k.startswith("test_"):
186+
del globals()[k]

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/SysModuleBuiltins.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ public void initialize(PythonCore core) {
149149
}));
150150
builtinConstants.put("graal_python_core_home", PythonOptions.getOption(core.getContext(), PythonOptions.CoreHome));
151151
builtinConstants.put("graal_python_stdlib_home", PythonOptions.getOption(core.getContext(), PythonOptions.StdLibHome));
152+
builtinConstants.put("graal_python_opaque_filesystem", PythonOptions.getOption(core.getContext(), PythonOptions.OpaqueFilesystem));
152153
// the default values taken from JPython
153154
builtinConstants.put("float_info", core.factory().createTuple(new Object[]{
154155
Double.MAX_VALUE, // DBL_MAX

0 commit comments

Comments
 (0)