Skip to content

Commit

Permalink
Dynamically obtain current version
Browse files Browse the repository at this point in the history
  • Loading branch information
novafacing committed Dec 10, 2023
1 parent b20245c commit be45c18
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion examples/tests/x86_64-uefi/test-manual-max.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
simics.SIM_set_log_level(tsffs, 4)
tsffs.iface.tsffs.set_start_on_harness(False)
tsffs.iface.tsffs.set_stop_on_harness(False)
tsffs.iface.tsffs.set_timeout(0.0001)
tsffs.iface.tsffs.set_timeout(3.0)
tsffs.iface.tsffs.add_exception_solution(14)
tsffs.iface.tsffs.set_generate_random_corpus(True)
tsffs.iface.tsffs.set_iterations(1000)
Expand Down
3 changes: 2 additions & 1 deletion modules/tsffs/tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ version.workspace = true

[dependencies]
anyhow = { workspace = true }
cargo_metadata = "0.18.1"
command-ext.workspace = true
getters.workspace = true
indoc = "2.0.4"
Expand All @@ -29,4 +30,4 @@ walkdir = "2.4.0"
anyhow.workspace = true
command-ext.workspace = true
simics-codegen.workspace = true
ispm-wrapper.workspace = true
ispm-wrapper.workspace = true
15 changes: 14 additions & 1 deletion modules/tsffs/tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//! SIMICS test utilities for test environment setup and configuration
use anyhow::{anyhow, bail, ensure, Result};
use cargo_metadata::MetadataCommand;
use getters::Getters;
use ispm_wrapper::{
data::ProjectPackage,
Expand Down Expand Up @@ -225,6 +226,15 @@ impl TestEnv {
}

impl TestEnv {
fn current_tsffs_version() -> Result<String> {
let metadata = MetadataCommand::new().exec()?;
metadata
.workspace_metadata
.get("version")
.and_then(|v| v.as_str())
.map(|v| v.to_string())
.ok_or_else(|| anyhow!("No 'version' in workspace metadata"))
}
fn install_tsffs<P, S>(simics_home_dir: P, cargo_manifest_dir: S) -> Result<()>
where
P: AsRef<Path>,
Expand Down Expand Up @@ -253,7 +263,10 @@ impl TestEnv {
.join("../../../")
.join("linux64")
.join("packages")
.join("simics-pkg-31337-6.0.1-linux64.ispm")])
.join(format!(
"simics-pkg-31337-{}-linux64.ispm",
Self::current_tsffs_version()?
))])
.global(
GlobalOptions::builder()
.install_dir(simics_home_dir.as_ref())
Expand Down

0 comments on commit be45c18

Please sign in to comment.