Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: local test speed optimizations, add cargo hack feature powerset #176

Merged
merged 5 commits into from
Sep 13, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
20 changes: 19 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ jobs:
toolchain: ${{ matrix.rust_channel }}

- name: cargo test (${{ matrix.mode }}, ${{ matrix.features }})
run: cargo test -vv ${{ matrix.features }} ${{ matrix.mode }}
run: cargo test -vv ${{ matrix.features }} ${{ matrix.mode }} -- --ignored
env:
RUSTFLAGS: "-D warnings"

Expand Down Expand Up @@ -292,3 +292,21 @@ jobs:

- name: check no-std mode
run: cargo check --target $NOSTD_TARGET ${{ matrix.features }}

feature-powerset:
name: Feature Powerset
runs-on: ubuntu-20.04
steps:
- name: Checkout sources
uses: actions/checkout@v4
with:
persist-credentials: false

- name: Install stable toolchain
uses: dtolnay/rust-toolchain@stable

- name: Install cargo hack
uses: taiki-e/install-action@cargo-hack

- name: Check feature powerset
run: cargo hack check --feature-powerset --no-dev-deps
6 changes: 5 additions & 1 deletion src/verify_cert.rs
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,7 @@ mod tests {

#[test]
#[cfg(feature = "alloc")]
fn test_too_many_path_calls() {
fn test_too_many_path_calls_mini() {
assert!(matches!(
build_degenerate_chain(
10,
Expand All @@ -565,6 +565,10 @@ mod tests {
// first expending the signature checks budget is tricky, so we artificially
// inflate the signature limit to make this test easier to write.
signatures: usize::MAX,
// We don't use the default build chain budget here. Doing so makes this test
// run slowly (due to testing quadratic runtime up to the limit) without adding
// much value from a testing perspective over using a smaller non-default limit.
build_chain_calls: 100,
..Budget::default()
})
),
Expand Down
4 changes: 3 additions & 1 deletion tests/better_tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ use serde::Deserialize;
use webpki::types::{CertificateDer, TrustAnchor};
use webpki::{extract_trust_anchor, KeyUsage, SubjectNameRef};

#[ignore] // Runs slower than other unit tests - opt-in with `cargo test -- --ignored`
#[test]
fn better_tls() {
fn path_building() {
let better_tls = testdata();
let root_der = &better_tls.root_der();
let root_der = CertificateDer::from(root_der.as_slice());
Expand All @@ -30,6 +31,7 @@ fn better_tls() {
);
}

#[ignore] // Runs slower than other unit tests - opt-in with `cargo test -- --ignored`
#[test]
fn name_constraints() {
let better_tls = testdata();
Expand Down