Skip to content

Commit c1475bd

Browse files
committed
Re-enable exception tests on macOS arm64
Catching exceptions from and through interpreted code works since the upgrade to LLVM 20. Closes #7541
1 parent 8efadfc commit c1475bd

5 files changed

Lines changed: 37 additions & 70 deletions

File tree

bindings/distrdf/test/test_headnode.py

Lines changed: 24 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,9 @@ def test_inmemory_tree(self):
9999
x[0] = i
100100
tree.Fill()
101101

102-
# See https://github.com/root-project/root/issues/7541 and
103-
# https://bugs.llvm.org/show_bug.cgi?id=49692 :
104-
# llvm JIT fails to catch exceptions on M1, so we disable their testing
105-
if platform.processor() != "arm" or platform.mac_ver()[0] == '':
106-
with self.assertRaises(ROOT.std.runtime_error):
107-
# Trees with no associated files are not supported
108-
create_dummy_headnode(tree)
102+
with self.assertRaises(ROOT.std.runtime_error):
103+
# Trees with no associated files are not supported
104+
create_dummy_headnode(tree)
109105

110106
def assertArgs(self, args_list1, args_list2):
111107
"""
@@ -231,31 +227,27 @@ def test_three_args_with_multiple_files(self):
231227

232228
def test_tree_with_friends_and_treeindex(self):
233229
"""TTreeIndex is not supported in distributed mode."""
234-
# See https://github.com/root-project/root/issues/7541 and
235-
# https://bugs.llvm.org/show_bug.cgi?id=49692 :
236-
# llvm JIT fails to catch exceptions on M1, so we disable their testing
237-
if platform.processor() != "arm" or platform.mac_ver()[0] == '':
238-
main_file = "distrdf_indexed_friend_main.root"
239-
aux_file = "distrdf_indexed_friend_aux.root"
240-
fill_main_tree_and_indexed_friend(main_file, aux_file)
241-
242-
main_chain = ROOT.TChain("mainTree", "mainTree")
243-
main_chain.Add(main_file)
244-
aux_chain = ROOT.TChain("auxTree", "auxTree")
245-
aux_chain.Add(aux_file)
246-
247-
aux_chain.BuildIndex("idx")
248-
main_chain.AddFriend(aux_chain)
249-
250-
with self.assertRaises(ValueError) as context:
251-
create_dummy_headnode(main_chain)
252-
253-
self.assertEqual(str(context.exception),
254-
"Friend tree 'auxTree' has a TTreeIndex. This is not supported in distributed mode.")
255-
256-
# Remove unnecessary .root files
257-
os.remove(main_file)
258-
os.remove(aux_file)
230+
main_file = "distrdf_indexed_friend_main.root"
231+
aux_file = "distrdf_indexed_friend_aux.root"
232+
fill_main_tree_and_indexed_friend(main_file, aux_file)
233+
234+
main_chain = ROOT.TChain("mainTree", "mainTree")
235+
main_chain.Add(main_file)
236+
aux_chain = ROOT.TChain("auxTree", "auxTree")
237+
aux_chain.Add(aux_file)
238+
239+
aux_chain.BuildIndex("idx")
240+
main_chain.AddFriend(aux_chain)
241+
242+
with self.assertRaises(ValueError) as context:
243+
create_dummy_headnode(main_chain)
244+
245+
self.assertEqual(str(context.exception),
246+
"Friend tree 'auxTree' has a TTreeIndex. This is not supported in distributed mode.")
247+
248+
# Remove unnecessary .root files
249+
os.remove(main_file)
250+
os.remove(aux_file)
259251

260252

261253
class NumEntriesTest(unittest.TestCase):

bindings/pyroot/cppyy/cppyy/test/test_regression.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1414,14 +1414,11 @@ def test47_initializer_list_fail(self, capfd):
14141414
assert out == ""
14151415
assert err == ""
14161416

1417-
@mark.xfail(run=False, condition=IS_MAC_ARM or IS_WINDOWS == 64, reason="LLVM JIT fails to catch exceptions")
1417+
@mark.xfail(run=False, condition=IS_WINDOWS == 64, reason="LLVM JIT fails to catch exceptions")
14181418
def test49_overloads_with_runtime_errors(self):
14191419
"""Regression test for https://github.com/root-project/root/issues/17497
14201420
1421-
See https://github.com/root-project/root/issues/7541 and
1422-
https://bugs.llvm.org/show_bug.cgi?id=49692 :
1423-
llvm JIT fails to catch exceptions on MacOS ARM, so we disable their testing
1424-
Also fails on Windows 64bit for the same reason
1421+
LLVM JIT failes to catch exceptions on Windows 64bit, so we disable their testing
14251422
"""
14261423
import cppyy
14271424

bindings/pyroot/pythonizations/test/rdataframe_misc.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,8 @@ def test_empty_filenames(self):
5151
"""
5252
An empty list of filenames should be detected and the user should be informed
5353
"""
54-
# See https://github.com/root-project/root/issues/7541 and
55-
# https://bugs.llvm.org/show_bug.cgi?id=49692 :
56-
# llvm JIT fails to catch exceptions on MacOS ARM, so we disable their testing
57-
# Also fails on Windows for the same reason
58-
if (platform.processor() != "arm" or platform.mac_ver()[0] == "") and not platform.system() == "Windows":
54+
# LLVM JIT fails to catch exceptions on Windows, so we disable their testing
55+
if not platform.system() == "Windows":
5956
# With implicit conversions, cppyy also needs to try dispatching to the various
6057
# constructor overloads. The C++ exception will be thrown, but will be incapsulated
6158
# in a more generic TypeError telling the user that none of the overloads worked

interpreter/cling/lib/Interpreter/Exception.cpp

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,6 @@ CLING_LIB_EXPORT
3232
void* cling_runtime_internal_throwIfInvalidPointer(void* Interp, void* Expr,
3333
const void* Arg) {
3434

35-
#if defined(__APPLE__) && defined(__arm64__)
36-
// See https://github.com/root-project/root/issues/7541 and
37-
// https://bugs.llvm.org/show_bug.cgi?id=49692 :
38-
// llvm JIT fails to catch exceptions on M1, so let's throw less.
39-
// This might still better than `terminate`...
40-
(void)Interp;
41-
(void)Expr;
42-
#else
4335
const clang::Expr* const E = (const clang::Expr*)Expr;
4436

4537
// The isValidAddress function return true even when the pointer is
@@ -62,7 +54,6 @@ void* cling_runtime_internal_throwIfInvalidPointer(void* Interp, void* Expr,
6254
throw cling::InvalidDerefException(&S, E,
6355
cling::InvalidDerefException::DerefType::INVALID_MEM);
6456
}
65-
#endif
6657
return const_cast<void*>(Arg);
6758
}
6859
}
@@ -112,12 +103,6 @@ namespace cling {
112103
void CompilationException::throwingHandler(void * /*user_data*/,
113104
const char* reason,
114105
bool /*gen_crash_diag*/) {
115-
// See https://github.com/root-project/root/issues/7541 and
116-
// https://bugs.llvm.org/show_bug.cgi?id=49692 :
117-
// We cannot catch exceptions that traverse JITted code on M1, so let's throw less.
118-
// This might still better than `terminate`...
119-
#if !defined(_MSC_VER) && (!defined(__APPLE__) || !defined(__arm64__))
120106
throw cling::CompilationException(reason);
121-
#endif
122107
}
123108
} // end namespace cling

roottest/python/regression/PyROOT_regressiontests.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -70,19 +70,15 @@ def test1FromROOTImportStarInModule( self ):
7070
class Regression02PyException(MyTestCase):
7171
def test1RaiseAndTrapPyException(self):
7272
"""Test thrown TPyException object processing"""
73-
# See https://github.com/root-project/root/issues/7541 and
74-
# https://bugs.llvm.org/show_bug.cgi?id=49692 :
75-
# llvm JIT fails to catch exceptions on M1, so we disable their testing
76-
if platform.processor() != "arm" or platform.mac_ver()[0] == '':
77-
gROOT.LoadMacro("ScottCppyy.C+")
78-
79-
# test of not overloaded global function
80-
with self.assertRaisesRegex(SyntaxError, "test error message"):
81-
ROOT.ThrowPyException()
82-
83-
# test of overloaded function
84-
with self.assertRaisesRegex(SyntaxError, "overloaded int test error message"):
85-
ROOT.MyThrowingClass.ThrowPyException(1)
73+
gROOT.LoadMacro("ScottCppyy.C+")
74+
75+
# test of not overloaded global function
76+
with self.assertRaisesRegex(SyntaxError, "test error message"):
77+
ROOT.ThrowPyException()
78+
79+
# test of overloaded function
80+
with self.assertRaisesRegex(SyntaxError, "overloaded int test error message"):
81+
ROOT.MyThrowingClass.ThrowPyException(1)
8682

8783

8884
### Several tests that used to cause crashes =================================

0 commit comments

Comments
 (0)