@@ -76,7 +76,7 @@ def test_AssertionHelperTestMozCrash():
7676 )
7777 expectedMsg = (
7878 r"Hit MOZ_CRASH\(named lambda static scopes should have been skipped\) at "
79- r"([a-zA-Z]:)?/ .+/ScopeObject\.cpp(:[0-9]+)+"
79+ r".+/ScopeObject\.cpp(:[0-9]+)+"
8080 )
8181 assert sanitizedMsg == expectedMsg
8282 _check_regex_matches (err , sanitizedMsg )
@@ -94,7 +94,7 @@ def test_AssertionHelperTestMozCrashMultiLine():
9494 )
9595 assert sanitizedMsg [- 1 ] == (
9696 r" combined_local_clip_rect\.size\.height >= 0\.0\)"
97- r" at gfx/wr/webrender/src/prim_store /mod\.rs(:[0-9]+)+"
97+ r" at .+ /mod\.rs(:[0-9]+)+"
9898 )
9999 _check_regex_matches (err , sanitizedMsg )
100100
@@ -106,7 +106,7 @@ def test_AssertionHelperTestMozCrashWithPath():
106106 AssertionHelper .getAssertion (err )
107107 )
108108 expectedMsg = (
109- r"Hit MOZ_CRASH\(([a-zA-Z]:)?/ .+/celt_decoder\.c(:[0-9]+)+ assertion failed: "
109+ r"Hit MOZ_CRASH\(.+/celt_decoder\.c(:[0-9]+)+ assertion failed: "
110110 r"st->start < st->end\) at nil(:[0-9]+)+"
111111 )
112112 assert sanitizedMsg == expectedMsg
@@ -121,7 +121,7 @@ def test_AssertionHelperTestMultiMozCrash():
121121 )
122122 expectedMsg = (
123123 r"Hit MOZ_CRASH\(good message\) at "
124- r"([a-zA-Z]:)?/ .+/spatial_node\.rs(:[0-9]+)+"
124+ r".+/spatial_node\.rs(:[0-9]+)+"
125125 )
126126 assert sanitizedMsg == expectedMsg
127127 _check_regex_matches (err , sanitizedMsg )
@@ -138,7 +138,7 @@ def test_AssertionHelperTestJSSelfHosted():
138138 AssertionHelper .getAssertion (err )
139139 )
140140 expectedMsg = (
141- r'Self-hosted JavaScript assertion info: "([a-zA-Z]:)?/ .+/Intl\.js(:[0-9]+)+: '
141+ r'Self-hosted JavaScript assertion info: ".+/Intl\.js(:[0-9]+)+: '
142142 r'non-canonical BestAvailableLocale locale"'
143143 )
144144
@@ -156,7 +156,7 @@ def test_AssertionHelperTestV8Abort():
156156 assert len (sanitizedMsgs ) == 2
157157
158158 expectedMsgs = [
159- r"# Fatal error in \.\./src /compiler\.cc, line [0-9]+" ,
159+ r"# Fatal error in .+ /compiler\.cc, line [0-9]+" ,
160160 (
161161 r"# Check failed: !feedback_vector_->metadata\(\)->SpecDiffersFrom\( "
162162 r"literal\(\)->feedback_vector_spec\(\)\)\."
@@ -174,7 +174,7 @@ def test_AssertionHelperTestChakraAssert():
174174 AssertionHelper .getAssertion (err )
175175 )
176176 expectedMsg = (
177- r"ASSERTION [0-9]{2,}: \(([a-zA-Z]:)?/ .+/ByteCodeEmitter\.cpp, line [0-9]+\) "
177+ r"ASSERTION [0-9]{2,}: \(.+/ByteCodeEmitter\.cpp, line [0-9]+\) "
178178 r"scope->HasInnerScopeIndex\(\)"
179179 )
180180
@@ -200,7 +200,7 @@ def test_AssertionHelperTestWindowsPathSanitizing():
200200
201201 expectedMsg = (
202202 r"Assertion failure: block->graph\(\)\.osrBlock\(\), at "
203- r"([a-zA-Z]:)?/ .+/Lowering\.cpp(:[0-9]+)+"
203+ r".+/Lowering\.cpp(:[0-9]+)+"
204204 )
205205
206206 assert sanitizedMsg1 == expectedMsg
@@ -217,6 +217,26 @@ def test_AssertionHelperTestWindowsPathSanitizing():
217217 # _check_regex_matches(err2, sanitizedMsg2)
218218
219219
220+ def test_AssertionHelperTestRelativePath ():
221+ err = ["Assertion failure: false, at foo/FileName.cpp:123" ]
222+ sanitizedMsg = AssertionHelper .getSanitizedAssertionPattern (
223+ AssertionHelper .getAssertion (err )
224+ )
225+ expectedMsg = r"Assertion failure: false, at .+/FileName\.cpp(:[0-9]+)+"
226+ assert sanitizedMsg == expectedMsg
227+ _check_regex_matches (err , sanitizedMsg )
228+
229+
230+ def test_AssertionHelperTestBareFilename ():
231+ err = ["Assertion failure: false, at FileName.cpp:123" ]
232+ sanitizedMsg = AssertionHelper .getSanitizedAssertionPattern (
233+ AssertionHelper .getAssertion (err )
234+ )
235+ expectedMsg = r"Assertion failure: false, at FileName\.cpp(:[0-9]+)+"
236+ assert sanitizedMsg == expectedMsg
237+ _check_regex_matches (err , sanitizedMsg )
238+
239+
220240def test_AssertionHelperTestAuxiliaryAbortASan ():
221241 err = (
222242 (FIXTURE_PATH / "assert_asan_heap_buffer_overflow.txt" ).read_text ().splitlines ()
@@ -254,7 +274,7 @@ def test_AssertionHelperTestRustPanic01():
254274 expectedMsg = (
255275 r"thread 'StyleThread#[0-9]+' panicked at "
256276 r"'assertion failed: self\.get_data\(\)\.is_some\(\)', "
257- r"([a-zA-Z]:)?/ .+/wrapper\.rs(:[0-9]+)+"
277+ r".+/wrapper\.rs(:[0-9]+)+"
258278 )
259279
260280 assert sanitizedMsg == expectedMsg
@@ -268,7 +288,7 @@ def test_AssertionHelperTestRustPanic02():
268288 )
269289 expectedMsg = (
270290 r"thread 'RenderBackend' panicked at 'called `Option::unwrap\(\)` "
271- r"on a `None` value', ([a-zA-Z]:)?/ .+/option\.rs(:[0-9]+)+"
291+ r"on a `None` value', .+/option\.rs(:[0-9]+)+"
272292 )
273293
274294 assert sanitizedMsg == expectedMsg
@@ -286,8 +306,5 @@ def test_AssertionHelperTestRustPanic03():
286306 sanitizedMsg [0 ]
287307 == r"thread '<unnamed>' panicked at 'assertion failed: `\(left == right\)`"
288308 )
289- assert (
290- sanitizedMsg [- 1 ]
291- == r" right: `Block`', ([a-zA-Z]:)?/.+/style_adjuster\.rs(:[0-9]+)+"
292- )
309+ assert sanitizedMsg [- 1 ] == r" right: `Block`', .+/style_adjuster\.rs(:[0-9]+)+"
293310 _check_regex_matches (err , sanitizedMsg )
0 commit comments