diff options
author | Kent Overstreet <kent.overstreet@linux.dev> | 2024-07-11 15:09:03 -0400 |
---|---|---|
committer | Kent Overstreet <kent.overstreet@linux.dev> | 2024-07-11 15:28:27 -0400 |
commit | 8250cf400784dc48c87a1772755a110d6d4b44bc (patch) | |
tree | b7650747010d61fe02e112069d319f797b30f1cc | |
parent | c636a46621674f46fdfe2c351dca5a56153ceb7b (diff) |
ci: test names now include path from ktest/tests
Signed-off-by: Kent Overstreet <kent.overstreet@linux.dev>
-rwxr-xr-x | ci/test-git-branch.sh | 13 | ||||
-rw-r--r-- | src/bin/gen-job-list.rs | 12 | ||||
-rw-r--r-- | src/bin/get-test-job.rs | 8 | ||||
-rw-r--r-- | src/lib.rs | 10 |
4 files changed, 21 insertions, 22 deletions
diff --git a/ci/test-git-branch.sh b/ci/test-git-branch.sh index f3a912b..044cf16 100755 --- a/ci/test-git-branch.sh +++ b/ci/test-git-branch.sh @@ -93,7 +93,10 @@ run_test_job() { shift 3 SUBTESTS=("$@") - TEST_NAME=$(basename -s .ktest $TEST_PATH) + FULL_TEST_PATH=${KTEST_DIR}/tests/$TEST_PATH + TEST_NAME=${TEST_PATH%%.ktest} + TEST_NAME=$(echo "$TEST_NAME"|tr / .) + OUTPUT=$JOBSERVER_OUTPUT_DIR/$COMMIT if [[ -z $BRANCH ]]; then @@ -106,7 +109,7 @@ run_test_job() { exit 1 fi - if [[ -z $TEST_PATH ]]; then + if [[ -z $FULL_TEST_PATH ]]; then echo "Error getting test job: need test to run" exit 1 fi @@ -121,7 +124,7 @@ run_test_job() { [[ $(git rev-parse HEAD) != $COMMIT ]] && exit 1 for i in ktest-out/*; do - [[ $i != ktest-out/kernel* ]] && rm -rf $i + [[ "$i" != ktest-out/kernel* ]] && rm -rf "$i" done mkdir -p ktest-out/out @@ -147,11 +150,11 @@ run_test_job() { "ktest-out/out/$TEST_NAME.$FNAME/full_log.br" done - echo "Running test $TEST_NAME ${SUBTESTS[@]}" + echo "Running test $TEST_PATH ${SUBTESTS[@]}" $KTEST_DIR/lib/supervisor -T 1200 -f "$FULL_LOG" -S -F \ -b $TEST_NAME -o ktest-out/out \ - -- build-test-kernel run -P $TEST_PATH ${SUBTESTS[@]} & + -- build-test-kernel run -P $FULL_TEST_PATH ${SUBTESTS[@]} & wait SUBTESTS_REMAINING=() diff --git a/src/bin/gen-job-list.rs b/src/bin/gen-job-list.rs index 0cc77c4..c03109f 100644 --- a/src/bin/gen-job-list.rs +++ b/src/bin/gen-job-list.rs @@ -6,7 +6,7 @@ use std::io::prelude::*; use std::path::{Path, PathBuf}; use std::process; use std::process::Stdio; -use ci_cgi::{CiConfig, Userrc, RcTestGroup, ciconfig_read, git_get_commit, commitdir_get_results, lockfile_exists, commit_update_results_from_fs}; +use ci_cgi::{CiConfig, Userrc, RcTestGroup, ciconfig_read, git_get_commit, commitdir_get_results, lockfile_exists, commit_update_results_from_fs, subtest_full_name}; use ci_cgi::TestResultsMap; use file_lock::{FileLock, FileOptions}; use memoize::memoize; @@ -61,12 +61,6 @@ impl PartialEq for TestJob { impl Eq for TestJob {} -fn subtest_full_name(test_path: &Path, subtest: &String) -> String { - format!("{}.{}", - test_path.file_stem().unwrap().to_string_lossy(), - subtest.replace("/", ".")) -} - fn have_result(results: &TestResultsMap, subtest: &str) -> bool { use ci_cgi::TestStatus; @@ -86,10 +80,10 @@ fn branch_test_jobs(rc: &CiConfig, repo: &git2::Repository, test_group: &RcTestGroup, test_path: &Path, verbose: bool) -> Vec<TestJob> { - let test_path = rc.ktest.ktest_dir.join("tests").join(test_path); + let full_test_path = rc.ktest.ktest_dir.join("tests").join(test_path); let mut ret = Vec::new(); - let subtests = get_subtests(test_path.clone()); + let subtests = get_subtests(full_test_path); if verbose { eprintln!("looking for tests to run for branch {} test {:?} subtests {:?}", branch, test_path, subtests) } diff --git a/src/bin/get-test-job.rs b/src/bin/get-test-job.rs index 89ef0e9..8576253 100644 --- a/src/bin/get-test-job.rs +++ b/src/bin/get-test-job.rs @@ -2,7 +2,7 @@ extern crate libc; use std::collections::HashSet; use std::path::Path; use std::process; -use ci_cgi::{Ktestrc, ciconfig_read, lockfile_exists, commit_update_results_from_fs}; +use ci_cgi::{Ktestrc, ciconfig_read, lockfile_exists, commit_update_results_from_fs, subtest_full_name}; use ci_cgi::{Worker, workers_update}; use file_lock::{FileLock, FileOptions}; use chrono::Utc; @@ -100,12 +100,6 @@ fn get_test_job(rc: &Ktestrc) -> Option<TestJob> { ret } -fn subtest_full_name(test_path: &Path, subtest: &String) -> String { - format!("{}.{}", - test_path.file_stem().unwrap().to_string_lossy(), - subtest.replace("/", ".")) -} - fn create_job_lockfiles(rc: &Ktestrc, mut job: TestJob) -> Option<TestJob> { let mut commits_updated = HashSet::new(); @@ -2,7 +2,7 @@ use std::collections::{BTreeMap, HashSet}; use std::fs::{File, OpenOptions, create_dir_all, read_to_string}; use std::io::ErrorKind; use std::io::prelude::*; -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::time::SystemTime; use die::die; use serde_derive::Deserialize; @@ -361,6 +361,14 @@ pub fn update_lcov(rc: &Ktestrc, commit_id: &String) -> Option<()> { Some(()) } +pub fn subtest_full_name(test: &Path, subtest: &String) -> String { + let test = test.to_string_lossy(); + let test = test.replace(".ktest", ""); + let test = test + "." + subtest; + let test = test.replace("/", "."); + test +} + pub fn lockfile_exists(rc: &Ktestrc, commit: &str, test_name: &str, create: bool, commits_updated: &mut HashSet<String>) -> bool { let lockfile = rc.output_dir.join(commit).join(test_name).join("status"); |