@@ -14,7 +14,7 @@ namespace Microsoft.DotNet.SourceBuild.SmokeTests;
14
14
15
15
public class DebugTests : SdkTests
16
16
{
17
- private record ScanResult ( string FileName , bool HasDebugInfo , bool HasDebugAbbrevs , bool HasFileSymbols , bool HasGnuDebugLink ) ;
17
+ private record ScanResult ( string FileName , bool HasDebugInfo , bool HasDebugAbbrevs , bool HasGnuDebugLink ) ;
18
18
19
19
public DebugTests ( ITestOutputHelper outputHelper ) : base ( outputHelper ) { }
20
20
@@ -30,7 +30,7 @@ public void SourceBuiltSdkContainsNativeDebugSymbols()
30
30
StringBuilder issueDetails = new ( ) ;
31
31
foreach ( var fileName in fileNames )
32
32
{
33
- if ( ! IsElfFile ( fileName ) || SkipFile ( fileName ) )
33
+ if ( ! IsElfFile ( fileName ) )
34
34
{
35
35
continue ;
36
36
}
@@ -49,11 +49,6 @@ public void SourceBuiltSdkContainsNativeDebugSymbols()
49
49
foundIssue = true ;
50
50
issueDetails . Append ( $ "missing .debug_abbrev section in { fileName } { newLine } ") ;
51
51
}
52
- if ( ! result . HasFileSymbols )
53
- {
54
- foundIssue = true ;
55
- issueDetails . Append ( $ "missing FILE symbols in { fileName } { newLine } ") ;
56
- }
57
52
if ( result . HasGnuDebugLink )
58
53
{
59
54
foundIssue = true ;
@@ -70,14 +65,6 @@ private bool IsElfFile(string fileName)
70
65
return Regex . IsMatch ( fileStdOut , @"ELF 64-bit [LM]SB (?:pie )?(?:executable|shared object)" ) ;
71
66
}
72
67
73
- private static bool SkipFile ( string path )
74
- {
75
- string fileName = Path . GetFileName ( path ) ;
76
-
77
- // 'ilc' is a NativeAOT-built application which doesn't meet the expectations set by the test.
78
- return fileName == "ilc" ;
79
- }
80
-
81
68
private ScanResult ScanFile ( string fileName )
82
69
{
83
70
string readelfSStdOut = ExecuteHelper . ExecuteProcessValidateExitCode ( "eu-readelf" , $ "-S { fileName } ", OutputHelper ) ;
@@ -96,35 +83,11 @@ private ScanResult ScanFile(string fileName)
96
83
97
84
string readelfsStdOut = ExecuteHelper . ExecuteProcessValidateExitCode ( "eu-readelf" , $ "-s { fileName } ", OutputHelper ) ;
98
85
99
- // Test FILE symbols. These will most likely be removed by anyting that
100
- // manipulates symbol tables because it's generally useless. So a nice test
101
- // that nothing has messed with symbols.
102
- bool hasFileSymbols = readelfsStdOut . Split ( "\n " ) . Where ( ContainsFileSymbols ) . Any ( ) ;
103
-
104
86
// Test that there are no .gnu_debuglink sections pointing to another
105
87
// debuginfo file. There shouldn't be any debuginfo files, so the link makes
106
88
// no sense either.
107
89
bool hasGnuDebuglink = readelfsStdOut . Split ( "\n " ) . Where ( line => line . Contains ( "] .gnu_debuglink" ) ) . Any ( ) ;
108
90
109
- return new ScanResult ( fileName , hasDebugInfo , hasDebugAbbrev , hasFileSymbols , hasGnuDebuglink ) ;
110
- }
111
-
112
- private bool ContainsFileSymbols ( string line )
113
- {
114
- // Try matching against output like this:
115
- // 10: 0000000000000000 0 FILE LOCAL DEFAULT ABS coreclr_resolver.cpp
116
- // 779: 0000000000000000 0 FILE LOCAL DEFAULT ABS header.cpp
117
-
118
- var parts = new Regex ( @"[ \t\n\r]+" ) . Split ( line ) ;
119
- int expectedNumberOfParts = 9 ;
120
-
121
- if ( parts . Length < expectedNumberOfParts )
122
- {
123
- return false ;
124
- }
125
-
126
- var fileNameRegex = new Regex ( @"(.*/)?[-_a-zA-Z0-9]+\.(c|cc|cpp|cxx)" ) ;
127
- return ( parts [ 3 ] == "0" ) && ( parts [ 4 ] == "FILE" ) && ( parts [ 5 ] == "LOCAL" ) && ( parts [ 6 ] == "DEFAULT" ) &&
128
- ( parts [ 7 ] == "ABS" ) && ( fileNameRegex . IsMatch ( parts [ 8 ] ) ) ;
91
+ return new ScanResult ( fileName , hasDebugInfo , hasDebugAbbrev , hasGnuDebuglink ) ;
129
92
}
130
93
}
0 commit comments