@@ -172,7 +172,7 @@ private async Task<Dictionary<KnownPattern, string>> RunSourceGeneratorOnKnownPa
172172 {
173173 await LogAsync ( $ "Generating { branch } Regex sources ...") ;
174174
175- const string TestFilePath = "runtime/ src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs" ;
175+ const string TestFilePath = "src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/RegexGeneratorParserTests.cs" ;
176176
177177 string resultsPath = Path . GetFullPath ( $ "results-{ branch } .json") ;
178178
@@ -235,17 +235,18 @@ partial class C{{i}}
235235 patchSource = string . Join ( '\n ' , patchSource . ReplaceLineEndings ( "\n " ) . Split ( '\n ' ) . Select ( l => $ " { l } ") ) ;
236236
237237 await LogAsync ( $ "Injecting test source patch:\n { TestFilePath } \n { patchSource } ") ;
238- string testSource = File . ReadAllText ( TestFilePath ) ;
238+ string testSource = File . ReadAllText ( $ "runtime/ { TestFilePath } " ) ;
239239 int offset = testSource . IndexOf ( '{' ) + 1 ;
240240 testSource = $ "{ testSource . AsSpan ( 0 , offset ) } \n { patchSource } { testSource . AsSpan ( offset ) } ";
241- File . WriteAllText ( TestFilePath , testSource ) ;
242- await RunProcessAsync ( "git" , "commit -am \" Patch test sources\" " , workDir : "runtime" ) ;
241+ File . WriteAllText ( $ "runtime/{ TestFilePath } ", testSource ) ;
243242
244243 const string RegexTestsPath = "src/libraries/System.Text.RegularExpressions/tests/FunctionalTests" ;
245244 const string XUnitMethodName = "System.Text.RegularExpressions.Tests.InjectedGenerateAllSourcesTestClass.GenerateAllSourcesAsync" ;
246245 await RunProcessAsync ( "runtime/.dotnet/dotnet" , $ "build { RegexTestsPath } /t:Test -c Release /p:XUnitMethodName={ XUnitMethodName } ",
247246 logPrefix : $ "Generating sources for { branch } ", workDir : "runtime" ) ;
248247
248+ await RunProcessAsync ( "git" , $ "checkout { TestFilePath } ", workDir : "runtime" ) ;
249+
249250 EntryWithGeneratedSource [ ] generatedSources = JsonSerializer . Deserialize < EntryWithGeneratedSource [ ] > ( File . ReadAllText ( resultsPath ) , s_jsonOptions ) ! ;
250251
251252 return generatedSources . ToDictionary ( s => new KnownPattern ( s . Pattern , s . Options , s . Count ) , s => s . OutputSource ) ;
0 commit comments