@@ -39,7 +39,7 @@ def test_find_failure_ninja_logs(self):
3939 self .assertEqual (
4040 failures [0 ],
4141 (
42- "test/4.stamp" ,
42+ "touch test/4.stamp" ,
4343 dedent (
4444 """\
4545 FAILED: touch test/4.stamp
@@ -77,7 +77,7 @@ def test_ninja_log_end(self):
7777 self .assertEqual (
7878 failures [0 ],
7979 (
80- "test/3.stamp" ,
80+ "touch test/3.stamp" ,
8181 dedent (
8282 """\
8383 FAILED: touch test/3.stamp
@@ -106,7 +106,7 @@ def test_ninja_log_multiple_failures(self):
106106 self .assertEqual (
107107 failures [0 ],
108108 (
109- "test/2.stamp" ,
109+ "touch test/2.stamp" ,
110110 dedent (
111111 """\
112112 FAILED: touch test/2.stamp
@@ -117,7 +117,7 @@ def test_ninja_log_multiple_failures(self):
117117 self .assertEqual (
118118 failures [1 ],
119119 (
120- "test/4.stamp" ,
120+ "touch test/4.stamp" ,
121121 dedent (
122122 """\
123123 FAILED: touch test/4.stamp
@@ -150,7 +150,7 @@ def test_ninja_log_runtimes_failure(self):
150150 self .assertEqual (
151151 failures [0 ],
152152 (
153- "test/2.stamp" ,
153+ "touch test/2.stamp" ,
154154 dedent (
155155 """\
156156 FAILED: touch test/2.stamp
@@ -159,6 +159,34 @@ def test_ninja_log_runtimes_failure(self):
159159 ),
160160 )
161161
162+ # Test that we correctly handle cases where the FAILED: line does not
163+ # match up with the progress indicator.
164+ def test_ninja_log_mismatched_failed (self ):
165+ failures = generate_test_report_lib .find_failure_in_ninja_logs (
166+ [
167+ [
168+ "[1/5] test/1.stamp" ,
169+ "[2/5] test/2.stamp" ,
170+ "ModuleNotFoundError: No module named 'mount_langley'" ,
171+ "FAILED: tools/check-langley" ,
172+ "Wow! This system is really broken!" ,
173+ "[5/5] test/5.stamp" ,
174+ ]
175+ ]
176+ )
177+ self .assertEqual (len (failures ), 1 )
178+ self .assertEqual (
179+ failures [0 ],
180+ (
181+ "tools/check-langley" ,
182+ dedent (
183+ """\
184+ FAILED: tools/check-langley
185+ Wow! This system is really broken!"""
186+ ),
187+ ),
188+ )
189+
162190 def test_title_only (self ):
163191 self .assertEqual (
164192 generate_test_report_lib .generate_report ("Foo" , 0 , [], []),
@@ -448,15 +476,15 @@ def test_no_failures_multiple_build_failed_ninja_log(self):
448476 All tests passed but another part of the build **failed**. Click on a failure below to see the details.
449477
450478 <details>
451- <summary>test/2.stamp</summary>
479+ <summary>touch test/2.stamp</summary>
452480
453481 ```
454482 FAILED: touch test/2.stamp
455483 Wow! Be Kind!
456484 ```
457485 </details>
458486 <details>
459- <summary>test/4.stamp</summary>
487+ <summary>touch test/4.stamp</summary>
460488
461489 ```
462490 FAILED: touch test/4.stamp
0 commit comments