Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,8 @@ path = "junit.xml"

[profile.ci-api.junit]
path = "junit.xml"

# profile for running emu smoke tests
# (in-process firmware).
[profile.ci-emu-smoke.junit]
path = "junit.xml"
48 changes: 48 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,30 @@ jobs:
echo "One or more tests failed."
exit 1

test_ubuntu_smoke:

runs-on: ubuntu-24.04

defaults:
run:
working-directory: .

steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/ubuntu-setup
- name: Run emu smoke tests
id: test-emu-smoke
run: cargo xtask precheck --nextest --package azihsm_ddi_mbor_types --features emu --test azihsm_ddi_tests --filter smoke --profile ci-emu-smoke
continue-on-error: true
Comment thread
zimmy87 marked this conversation as resolved.
- name: Generate nextest report
id: nextest-report
run: cargo xtask precheck --nextest-report
- name: Fail if any tests failed
if: ${{ steps.test-emu-smoke.outcome == 'failure' }}
run: |
echo "One or more tests failed."
exit 1

build_windows:

runs-on: windows-2025-vs2026
Expand Down Expand Up @@ -217,3 +241,27 @@ jobs:
run: |
echo "One or more tests failed."
exit 1

test_windows_smoke:

runs-on: windows-2025-vs2026

defaults:
run:
working-directory: .

steps:
- uses: actions/checkout@v6
- uses: ./.github/actions/windows-setup
- name: Run emu smoke tests
id: test-emu-smoke
run: cargo xtask precheck --nextest --package azihsm_ddi_mbor_types --features emu --test azihsm_ddi_tests --filter smoke --profile ci-emu-smoke
continue-on-error: true
- name: Generate nextest report
id: nextest-report
run: cargo xtask precheck --nextest-report
- name: Fail if any tests failed
if: ${{ steps.test-emu-smoke.outcome == 'failure' }}
run: |
echo "One or more tests failed."
exit 1
18 changes: 18 additions & 0 deletions xtask/src/coverage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ pub struct Coverage {
#[clap(long)]
pub exclude: Vec<String>,

/// Test only the specified test target
#[clap(long)]
pub test: Option<String>,

/// Test name filters
#[clap(long)]
pub filter: Vec<String>,

/// Skip cleaning existing llvm-cov artifacts before running coverage
#[clap(long)]
pub skip_clean: bool,
Expand Down Expand Up @@ -98,6 +106,14 @@ impl Xtask for Coverage {
}
}
}
let test_val = self.test.clone().unwrap_or_default();
if self.test.is_some() {
command_args.push("--test");
command_args.push(&test_val);
}
if !self.filter.is_empty() {
command_args.extend(self.filter.iter().map(|s| s.as_str()));
}
Comment thread
zimmy87 marked this conversation as resolved.

// Clean existing llvm-cov artifacts unless --skip-clean is set
if !self.skip_clean {
Expand Down Expand Up @@ -129,6 +145,8 @@ impl From<crate::nextest::Nextest> for Coverage {
filterset: nextest.filterset,
profile: nextest.profile,
exclude: nextest.exclude,
test: nextest.test,
filter: nextest.filter,
skip_clean: false,
}
}
Expand Down
2 changes: 2 additions & 0 deletions xtask/src/integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,8 @@ impl Xtask for IntegrationTest {
filterset: None,
profile: Some("ci-provider-integration".to_string()),
exclude: vec![],
test: None,
filter: vec![],
}
.run(ctx)
};
Expand Down
16 changes: 16 additions & 0 deletions xtask/src/nextest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ pub struct Nextest {
/// Crates to exclude from nextest (e.g. crates with heavyweight build scripts)
#[clap(long)]
pub exclude: Vec<String>,

/// Test only the specified test target
#[clap(long)]
pub test: Option<String>,

/// Test name filters
#[clap(long)]
pub filter: Vec<String>,
}

impl Xtask for Nextest {
Expand Down Expand Up @@ -97,6 +105,14 @@ impl Xtask for Nextest {
command_args.push(val);
}
}
let test_val = self.test.clone().unwrap_or_default();
if self.test.is_some() {
command_args.push("--test");
command_args.push(&test_val);
}
if !self.filter.is_empty() {
command_args.extend(self.filter.iter().map(|s| s.as_str()));
}
Comment thread
zimmy87 marked this conversation as resolved.

cmd!(
sh,
Expand Down
4 changes: 4 additions & 0 deletions xtask/src/nextest_report.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ fn profile_to_command(profile_name: &str) -> String {
.to_string()
}
"ci-api" => "cargo nextest run --no-fail-fast -p azihsm_api_tests -F mock --profile ci-api".to_string(),
"ci-emu-smoke" => {
"cargo nextest run --no-fail-fast -p azihsm_ddi_mbor_types -F emu --profile ci-emu-smoke --test azihsm_ddi_tests smoke"
.to_string()
}
Comment thread
zimmy87 marked this conversation as resolved.
Comment thread
Copilot marked this conversation as resolved.
// For unknown profiles, construct a generic command showing the profile
_ => format!("cargo nextest run --profile {}", profile_name),
}
Expand Down
48 changes: 46 additions & 2 deletions xtask/src/precheck.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ pub struct Precheck {
/// Additional paths to object files to append to LLVM_COV_FLAGS (used with --coverage-report)
#[clap(long)]
pub additional_obj_paths: Vec<String>,
/// The nextest test target to run
#[clap(long)]
pub test: Option<String>,
/// Test name filters
#[clap(long)]
filter: Vec<String>,
}

impl Xtask for Precheck {
Expand Down Expand Up @@ -180,7 +186,12 @@ impl Xtask for Precheck {
}

if stage.nextest || stage.all {
if self.package.is_none() && self.features.is_none() {
if self.package.is_none()
&& self.features.is_none()
&& self.filterset.is_none()
&& self.test.is_none()
&& self.filter.is_empty()
{
// Run default tests
let tests = default_tests(&self.exclude, self.profile.clone());
run_tests(tests, false, self.skip_clean, ctx.clone())?;
Expand All @@ -199,14 +210,21 @@ impl Xtask for Precheck {
filterset: self.filterset.clone(),
profile: self.profile.clone(),
exclude: self.exclude.clone(),
test: self.test.clone(),
filter: self.filter.clone(),
Comment thread
zimmy87 marked this conversation as resolved.
}
.run(ctx.clone())?;
}
}

// Run code coverage
if stage.coverage || stage.all {
if self.package.is_none() && self.features.is_none() {
if self.package.is_none()
&& self.features.is_none()
&& self.filterset.is_none()
&& self.test.is_none()
&& self.filter.is_empty()
{
// Run default tests with coverage
let tests = default_tests(&self.exclude, self.profile.clone());
run_tests(tests, true, self.skip_clean, ctx.clone())?;
Expand All @@ -218,6 +236,8 @@ impl Xtask for Precheck {
filterset: self.filterset.clone(),
profile: self.profile.clone(),
exclude: self.exclude.clone(),
test: self.test.clone(),
filter: self.filter.clone(),
skip_clean: self.skip_clean,
}
.run(ctx.clone())?;
Expand Down Expand Up @@ -262,6 +282,8 @@ fn default_tests(exclude: &[String], profile: Option<String>) -> Vec<Nextest> {
filterset: None,
profile: profile.clone().or(Some("ci-mock".to_string())),
exclude: mock_exclude,
test: None,
filter: vec![],
});

// SDK Run resiliency fault-injection tests (requires res-test
Expand All @@ -274,6 +296,22 @@ fn default_tests(exclude: &[String], profile: Option<String>) -> Vec<Nextest> {
filterset: Some("test(resiliency::fault_injection::)".to_string()),
profile: profile.clone().or(Some("ci-mock-res".to_string())),
exclude: exclude.to_owned(),
test: None,
filter: vec![],
});
}

// Run emu smoke tests
if !exclude.iter().any(|e| e == "azihsm_ddi_mbor_types") {
tests.push(Nextest {
features: Some("emu".to_string()),
package: Some("azihsm_ddi_mbor_types".to_string()),
no_default_features: false,
filterset: None,
profile: profile.clone().or(Some("ci-emu-smoke".to_string())),
exclude: exclude.to_owned(),
test: Some("azihsm_ddi_tests".to_string()),
filter: vec!["smoke".to_string()],
});
}

Expand All @@ -294,6 +332,8 @@ fn ddi_tests(exclude: &[String], profile: Option<String>) -> Vec<Nextest> {
filterset: None,
profile: profile.clone().or(Some("ci-mock-table-4".to_string())),
exclude: exclude.to_owned(),
test: None,
filter: vec![],
});

// SDK Run azihsm_ddi_mbor_types mock tests table-64
Expand All @@ -304,6 +344,8 @@ fn ddi_tests(exclude: &[String], profile: Option<String>) -> Vec<Nextest> {
filterset: None,
profile: profile.clone().or(Some("ci-mock-table-64".to_string())),
exclude: exclude.to_owned(),
test: None,
filter: vec![],
});
}

Expand All @@ -317,6 +359,8 @@ fn ddi_tests(exclude: &[String], profile: Option<String>) -> Vec<Nextest> {
filterset: None,
profile: profile.clone().or(Some("ci-tbor-emu".to_string())),
exclude: exclude.to_owned(),
test: None,
filter: vec![],
});
}

Expand Down
Loading