Skip to content

Commit

Permalink
Allow test execution
Browse files Browse the repository at this point in the history
  • Loading branch information
Firstyear committed Jul 30, 2024
1 parent 3d248ac commit 92cc874
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 4 deletions.
18 changes: 14 additions & 4 deletions tss-esapi-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,18 @@ pub mod tpm2_tss {
repo_path
}

#[cfg(all(feature = "bundled",not(windows)))]
#[cfg(all(feature = "bundled", not(windows)))]
fn compile_with_autotools(p: PathBuf) -> PathBuf {
let output1 = std::process::Command::new("./bootstrap")
.current_dir(&p)
.output()
.expect("bootstrap script failed");
let status = output1.status;
if !status.success() {
panic!("{:?}/bootstrap script failed with {}:\n{:?}", p, status, output1);
panic!(
"{:?}/bootstrap script failed with {}:\n{:?}",
p, status, output1
);
}

let mut config = autotools::Config::new(p);
Expand Down Expand Up @@ -167,12 +170,16 @@ pub mod tpm2_tss {
let source_path = if let Ok(tpm_tss_source) = std::env::var("TPM_TSS_SOURCE_PATH") {
eprintln!("using local tpm2-tss from {}", tpm_tss_source);
let Ok(source_path) = PathBuf::from(tpm_tss_source).canonicalize() else {
panic!("Unable to canonicalize tpm2-tss source path. Does the source path exist?");
panic!(
"Unable to canonicalize tpm2-tss source path. Does the source path exist?"
);
};

source_path
} else {
eprintln!("using remote tpm2-tss from https://github.com/tpm2-software/tpm2-tss.git");
eprintln!(
"using remote tpm2-tss from https://github.com/tpm2-software/tpm2-tss.git"
);
Self::fetch_source(
out_path,
"tpm2-tss",
Expand Down Expand Up @@ -328,11 +335,14 @@ pub mod tpm2_tss {
.clang_arg(tss2_tcti_tbs.include_dir_arg())
.header(tss2_tcti_tbs.header_file_arg());
}

#[cfg(feature = "bundled")]
if let Some(clang_args) = Self::platform_args() {
for arg in clang_args {
builder = builder.clang_arg(arg);
}
}

builder
}
}
Expand Down
4 changes: 4 additions & 0 deletions tss-esapi/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ time using the headers identified on the system.

Our end-goal is to achieve a fully Rust-native interface that offers strong safety and security guarantees. Check out our [documentation](https://docs.rs/tss-esapi/*/tss_esapi/#notes-on-code-safety) for an overview of our code safety approach.

## Integration Tests

See the [integration tests](https://github.com/parallaxsecond/rust-tss-esapi/tree/main/tss-esapi/tests)

## Cargo Features

The crate currently offers the following features:
Expand Down
2 changes: 2 additions & 0 deletions tss-esapi/tests/integration_tests/common/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ use tss_esapi::{
};

mod marshall;
#[cfg(feature = "serde")]
mod serde;
mod tpm2b_types_equality_checks;
mod tpma_types_equality_checks;
mod tpml_types_equality_checks;
mod tpms_types_equality_checks;
mod tpmt_types_equality_checks;
#[cfg(feature = "serde")]
pub use self::serde::*;
pub use marshall::*;
pub use tpm2b_types_equality_checks::*;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ fn marshall_unmarshall() {
}

#[test]
#[cfg(feature = "serde")]
fn serialise_deserialise() {
crate::common::check_serialise_deserialise(&Private::default());
let private = Private::try_from([0xff; 100].to_vec()).unwrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ fn marshall_unmarshall() {
}

#[test]
#[cfg(feature = "serde")]
fn serialise_deserialise() {
crate::common::publics()
.iter()
Expand Down

0 comments on commit 92cc874

Please sign in to comment.