From cafe3788d85a0f9c280da3fd394fd3927a4e24d7 Mon Sep 17 00:00:00 2001 From: 255doesnotexist <1293883574jcy@gmail.com> Date: Mon, 26 Aug 2024 04:19:44 +0800 Subject: [PATCH] feat: bring back package version in report but will be replaced soon --- src/test_runner.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/test_runner.rs b/src/test_runner.rs index 9bac891..aa371df 100644 --- a/src/test_runner.rs +++ b/src/test_runner.rs @@ -39,10 +39,12 @@ impl TestRunner for LocalTestRunner { let mut all_tests_passed = true; let mut test_results = Vec::new(); + let pkgver_tmpfile = format!("{}/pkgver", REMOTE_TMP_DIR); + for script in script_manager?.get_test_scripts() { let output = Command::new("bash") .arg("-c") - .arg(&format!("source {}", script)) + .arg(&format!("source {} && echo -n $PACKAGE_VERSION > {}", script, pkgver_tmpfile)) .stdout(if self.verbose { Stdio::inherit() } else { @@ -64,13 +66,15 @@ impl TestRunner for LocalTestRunner { }); } + let package_version = read_to_string(&pkgver_tmpfile)?; + let report = Report { distro: distro.to_string(), os_version, kernel_version, package_name: package.to_string(), package_type: String::from("package"), - package_version: String::new(), // partially removed + package_version: package_version, // partially removed // TODO: add a metadata.sh script for every package // which generate a metadata.json file containing package version // and other metadata (different distros / packages have really different @@ -242,7 +246,6 @@ impl TestRunner for RemoteTestRunner { let pkgver_tmpfile = format!("{}/pkgver", REMOTE_TMP_DIR); for script in script_manager?.get_test_scripts() { - let result = self.run_command( &sess, &format!("source {} && echo -n $PACKAGE_VERSION > {}", script, pkgver_tmpfile),