mirror of
https://github.com/lightpanda-io/browser.git
synced 2026-10-28 08:36:17 +08:00
test: run filtered tests in one process by default
Someone filtering is usually debugging one case and wants as little variability as possible. TEST_JOBS still overrides it.
This commit is contained in:
1 parent
6a9026d0be
commit
047ed3ed88
3 files changed
+9
-4
No files matched your search
@@ -15,7 +15,7 @@ TEST_FILTER="WebApi: #selector_all" make test # Filter main + subtest (separat
|
||||
TEST_VERBOSE=true make test
|
||||
TEST_FAIL_FIRST=true make test
|
||||
METRICS=true make test # Capture allocation/duration metrics as JSON
|
||||
TEST_JOBS=1 make test # Run in one process (default: up to 4 in parallel)
|
||||
TEST_JOBS=1 make test # Run in one process (default: up to 4, or 1 when filtered)
|
||||
```
|
||||
|
||||
The custom test runner (`src/test_runner.zig`) detects memory leaks in debug builds. **A test that allocates without freeing fails** — not just lints.
|
||||
|
||||
@@ -350,7 +350,7 @@ TEST_FILTER="WebApi: #selector_all" make test # Filter main + subtest (separat
|
||||
TEST_VERBOSE=true make test
|
||||
TEST_FAIL_FIRST=true make test
|
||||
METRICS=true make test # Capture allocation/duration metrics as JSON
|
||||
TEST_JOBS=1 make test # Run in one process (default: up to 4 in parallel)
|
||||
TEST_JOBS=1 make test # Run in one process (default: up to 4, or 1 when filtered)
|
||||
```
|
||||
|
||||
### End to end tests
|
||||
|
||||
+7
-2
@@ -568,13 +568,18 @@ const Env = struct {
|
||||
.verbose = readEnvBool(map, "TEST_VERBOSE", false),
|
||||
.fail_first = readEnvBool(map, "TEST_FAIL_FIRST", false),
|
||||
// metrics are compared across runs, so keep them to one process
|
||||
.jobs = if (metrics) 1 else readEnvInt(map, "TEST_JOBS") orelse defaultJobs(),
|
||||
.jobs = if (metrics) 1 else readEnvInt(map, "TEST_JOBS") orelse defaultJobs(filter, subfilter),
|
||||
.claim = readEnv(map, "TEST_CLAIM"),
|
||||
.report = readEnv(map, "TEST_REPORT"),
|
||||
};
|
||||
}
|
||||
|
||||
fn defaultJobs() usize {
|
||||
/// A filtered run is usually someone debugging one case, who wants as
|
||||
/// little variability as possible, so it stays in one process unless asked.
|
||||
fn defaultJobs(filter: ?[]const u8, subfilter: ?[]const u8) usize {
|
||||
if (filter != null or subfilter != null) {
|
||||
return 1;
|
||||
}
|
||||
const cpus = std.Thread.getCpuCount() catch 1;
|
||||
return @min(cpus, 4);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user