Improve error message for insufficient arena memory in _realloc_con_efc.

PiperOrigin-RevId: 826845370
Change-Id: I09467dd44a6f9f01b89ff6c1d74cde493e84eb1c
This commit is contained in:
Yuval Tassa
2025-11-01 05:53:56 -07:00
committed by Copybara-Service
parent f604588a36
commit ad49733db2
2 changed files with 26 additions and 16 deletions
+5 -2
View File
@@ -632,8 +632,11 @@ class MuJoCoBindingsTest(parameterized.TestCase):
self.assertEqual(self.data.efc_J.shape, (nj,))
self.assertEqual(self.data.efc_KBIP.shape, (nefc, 4))
expected_error = 'insufficient arena memory available'
with self.assertRaisesWithLiteralMatch(mujoco.FatalError, expected_error):
expected_error = (
r'Insufficient arena memory, currently allocated memory=' +
r'"[0-9]+[A-Z]?". Increase using <size memory="X"/>.'
)
with self.assertRaisesRegex(mujoco.FatalError, expected_error):
mujoco._functions._realloc_con_efc(self.data, 100000000, 100000000)
self.assertEmpty(self.data.contact)
self.assertEmpty(self.data.efc_id)