@@ -23,7 +23,7 @@ public override void Run()
23
23
// get a directory to work in
24
24
var tmpDirectory = WorkDirectory ;
25
25
26
- var languageRoot = Path . Combine ( Base , Language ) ;
26
+ var languageRoot = Path . Combine ( Base , Language ) ;
27
27
28
28
// check if the language root exists
29
29
if ( ! Directory . Exists ( languageRoot ) ) {
@@ -41,11 +41,11 @@ public override void Run()
41
41
Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Found test directory: { dir } ") ;
42
42
}
43
43
44
+ var transformedDirs = dirs . Select ( dir => Path . GetRelativePath ( Base , dir ) ) ;
45
+
44
46
Parallel . For ( 0 , NumThreads ,
45
47
slice => {
46
48
47
- var testPathString = string . Join ( " " , dirs ) ;
48
-
49
49
TestReport report = new TestReport ( )
50
50
{
51
51
RunnerOS = RunnerOS ,
@@ -56,24 +56,30 @@ public override void Run()
56
56
NumSlices = NumThreads
57
57
} ;
58
58
59
+ var workingDirectory = Path . GetFullPath ( Base ) ;
60
+ var testPathString = string . Join ( " " , transformedDirs ) ;
59
61
var outFileReport = Path . Combine ( tmpDirectory , report . FileName ) ;
60
62
61
- Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Running unit tests for slice { slice } to file { outFileReport } ...") ;
63
+ Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Executing tests in working directory { workingDirectory } .") ;
64
+ Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Test Paths: { testPathString } ") ;
65
+ Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Slice: { slice } of { NumThreads } ") ;
66
+ Log < ExecuteUnitTestsCommandTarget > . G ( ) . LogInformation ( $ "Report File: { outFileReport } ...") ;
62
67
63
68
using ( Process process = new Process ( ) )
64
69
{
65
70
process . StartInfo . FileName = "codeql" ;
66
- process . StartInfo . WorkingDirectory = Base ;
71
+ process . StartInfo . WorkingDirectory = workingDirectory ;
67
72
process . StartInfo . UseShellExecute = false ;
68
73
process . StartInfo . RedirectStandardOutput = true ;
69
74
process . StartInfo . RedirectStandardError = false ;
70
75
process . StartInfo . Arguments = $ "test run --failing-exitcode=122 --slice={ slice + 1 } /{ NumThreads } --ram=2048 --format=json --search-path={ Language } { testPathString } ";
71
- process . StartInfo . FileName = outFileReport ;
72
76
73
77
process . Start ( ) ;
74
78
75
79
// needed for STDOUT redirection
76
- process . StandardOutput . ReadToEnd ( ) ;
80
+ var output = process . StandardOutput . ReadToEnd ( ) ;
81
+
82
+ File . WriteAllText ( outFileReport , output ) ;
77
83
78
84
process . WaitForExit ( ) ;
79
85
0 commit comments