diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-08 22:09:55 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-08-08 22:09:55 -0400 |
commit | e17a87900bf93a09fd1875fcbb23a442c6878c90 (patch) | |
tree | a352adc43f27adf7d809c7b0a09e1a4039d386a9 | |
parent | 5eb1a590404fd9c8437a30ab364d1638c1dae26d (diff) |
ci: order subtests by duration
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rw-r--r-- | src/bin/gen-job-list.rs | 17 | ||||
-rw-r--r-- | src/users.rs | 8 |
2 files changed, 17 insertions, 8 deletions
diff --git a/src/bin/gen-job-list.rs b/src/bin/gen-job-list.rs index b75bea5..3bcf86e 100644 --- a/src/bin/gen-job-list.rs +++ b/src/bin/gen-job-list.rs @@ -36,6 +36,7 @@ pub struct TestJob { commit: String, age: u64, nice: u64, + duration: u64, test: String, subtest: String, } @@ -51,6 +52,7 @@ impl Ord for TestJob { testjob_weight(self).cmp(&testjob_weight(other)) .then(self.commit.cmp(&other.commit)) .then(self.test.cmp(&other.test)) + .then(self.duration.cmp(&other.duration)) } } @@ -137,11 +139,15 @@ fn branch_test_jobs(rc: &CiConfig, let mut nice = test_group.nice; let stats = test_stats(durations, test_name, &subtest); - if let Some(stats) = stats { - // Deprioritize tests that only pass or only fail - // XXX: make this configurable - if !stats.passed != !stats.failed && stats.passed + stats.failed > 10 { - nice += 10; + if let Some(ref stats) = stats { + if test_group.test_always_passes_nice != 0 && + !stats.passed != !stats.failed && + stats.passed + stats.failed > test_group.test_always_passes_nice { + nice += test_group.test_always_passes_nice; + } + + if test_group.test_duration_nice != 0 { + nice += stats.duration / test_group.test_duration_nice; } } @@ -150,6 +156,7 @@ fn branch_test_jobs(rc: &CiConfig, commit: commit.clone(), age: age as u64, nice, + duration: stats.map_or(rc.ktest.subtest_duration_def, |s| s.duration), test: test_name.to_string(), subtest, }); diff --git a/src/users.rs b/src/users.rs index 7f1cffa..e762fba 100644 --- a/src/users.rs +++ b/src/users.rs @@ -7,9 +7,11 @@ use anyhow; #[derive(Deserialize)] pub struct RcTestGroup { - pub max_commits: u64, - pub nice: u64, - pub tests: Vec<PathBuf>, + pub max_commits: u64, + pub nice: u64, + pub test_duration_nice: u64, + pub test_always_passes_nice: u64, + pub tests: Vec<PathBuf>, } #[derive(Deserialize)] |