-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support parallel test execution #260
base: main
Are you sure you want to change the base?
Conversation
I couldn't help myself and just added test lookup functionality (right click on test -> Go to Test). This leads to the source file that a test exe is built from. This only works for simple tests that are made up of one source file, but that should be the majority of tests. |
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
this is required when targets exist twice, e.g. due to subprojects Signed-off-by: Jannik Glückert <jannik.glueckert@gmail.com>
1523925
to
b94ce5d
Compare
@Jannik2099 do you think this PR is ready to go? Sorry it's taken me a long time to get to it |
for (const test of parallelTests) { | ||
const running_test = dispatchTest(test).finally(() => { | ||
running_tests.splice(running_tests.indexOf(running_test), 1); | ||
}); | ||
|
||
running_tests.push(running_test); | ||
|
||
if (running_tests.length >= max_running) { | ||
await Promise.race(running_tests); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we provide an option limit the amount of parallelization
@@ -12,6 +12,7 @@ import { extensionPath, workspaceState } from "./extension"; | |||
export interface ExecResult { | |||
stdout: string; | |||
stderr: string; | |||
time: number; // runtime in milliseconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe let's add a suffix to this member: time_ms
// and produces the binary that the test() executes. | ||
const testDependencyTarget = targets.find((target) => { | ||
const depend = test.depends.find((depend) => { | ||
return depend == target.id && depend.endsWith("@exe"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm does the meson introspection stuff really not provide a better heuristic for determining whether a target is an exe?
import { getMesonTests, getMesonTargets } from "./introspection"; | ||
import { workspaceState } from "./extension"; | ||
|
||
// this is far from complete, but should suffice for the | ||
// "test is made of a single executable is made of a single source file" usecase. | ||
function findSourceOfTest(test: Test, targets: Targets) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add an explicit return type
This adds parallel test execution through the vscode TestController API. Sequential tests
test(..., is_parallel = false)
are respected.Parallelism is set to the number of CPUs, if desired I could also add a config option.
I also fixed output formatting of test failures as
vscode.TestRun.appendOutput
always expects CLRF.