Skip to content

Commit 63890c5

Browse files
committed
Annotate test name in each TSAN report separated file
Signed-off-by: Carlos Ferreira González <carlosferreira@eprosima.com>
1 parent 2036d72 commit 63890c5

1 file changed

Lines changed: 15 additions & 3 deletions

File tree

.github/workflows/reusable-sanitizers-ci.yml

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -392,11 +392,16 @@ jobs:
392392
$rp = $reportFiles | ForEach-Object { Show-Tsan -Path $_.FullName }
393393
# filter duplicates
394394
$rp = $rp | group md5hash | % { $_.group[0] }
395-
# Attribute every report to the test executable(s) that produced it, extracted from
396-
# its own stack frames (the non-shared-object modules). This is self-contained per
397-
# file and robust to interleaving, unlike deriving the test from the tsan.<pid> name.
395+
# Attribute every report to the test that produced it, extracted from its own stack
396+
# frames. Self-contained per file and robust to interleaving. We prefer the googletest
397+
# case name (present as "<Suite>_<Name>_Test::TestBody" in the thread creation stack);
398+
# when there is none (e.g. communication subprocesses), we fall back to the test
399+
# executable(s), i.e. the non-shared-object modules in the "(module+0x...)" frames.
398400
$getTests = {
399401
param($text)
402+
$gtest = @([regex]::Matches($text, '([A-Za-z_][A-Za-z0-9_]*)_Test::') |
403+
% { $_.Groups[1].Value } | Sort-Object -Unique)
404+
if ($gtest) { return $gtest }
400405
@([regex]::Matches($text, '\(([^()+\s]+)\+0x[0-9a-fA-F]+\)') |
401406
% { $_.Groups[1].Value } | ? { $_ -notmatch '\.so(\.|$)' } | Sort-Object -Unique)
402407
}
@@ -418,6 +423,13 @@ jobs:
418423
}
419424
# Keep one representative per distinct crash signature
420425
$crash = @($crash | Group-Object signature | % { $_.Group[0] })
426+
# Prepend the offending test(s) as the first line of every per-process report file, so
427+
# the raw capture shows which test produced it. Done after parsing so it does not affect
428+
# Show-Tsan or the crash scan above.
429+
foreach ($f in $reportFiles) {
430+
$content = Get-Content -Raw -Path $f.FullName
431+
Set-Content -Path $f.FullName -Value "Test: $((& $getTests $content) -join ', ')`n`n$content"
432+
}
421433
# Export raw data
422434
$rp | Export-CliXML (Join-Path $exports all_reports.xml)
423435
# Group the reports by issue

0 commit comments

Comments
 (0)