Skip to content

Commit

Permalink
CI: test all crates with --no-default-features (#565)
Browse files Browse the repository at this point in the history
Ensures all of the tests pass even when default features are disabled
  • Loading branch information
tarcieri authored Nov 1, 2023
1 parent 85ff034 commit d80e203
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 6 deletions.
1 change: 1 addition & 0 deletions .github/workflows/aes-gcm-siv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --release --no-default-features
- run: cargo test --target ${{ matrix.target }} --release
- run: cargo test --target ${{ matrix.target }} --release --features stream,std
- run: cargo test --target ${{ matrix.target }} --release --all-features
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/aes-gcm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --release --no-default-features --lib
- run: cargo test --target ${{ matrix.target }} --release
- run: cargo test --target ${{ matrix.target }} --release --features stream,std,zeroize
- run: cargo test --target ${{ matrix.target }} --release --all-features
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/aes-siv.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --release --no-default-features
- run: cargo test --release
- run: cargo test --release --features stream,std
- run: cargo test --release --all-features
1 change: 1 addition & 0 deletions .github/workflows/ascon-aead.yml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --release --no-default-features
- run: cargo test --target ${{ matrix.target }} --release
- run: cargo test --target ${{ matrix.target }} --release --features std,zeroize
- run: cargo test --target ${{ matrix.target }} --release --all-features
1 change: 1 addition & 0 deletions .github/workflows/ccm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ jobs:
toolchain: ${{ matrix.rust }}
targets: ${{ matrix.target }}
- run: ${{ matrix.deps }}
- run: cargo test --target ${{ matrix.target }} --release --no-default-features
- run: cargo test --target ${{ matrix.target }} --release
- run: cargo test --target ${{ matrix.target }} --release --all-features
- run: cargo build --target ${{ matrix.target }} --benches
1 change: 1 addition & 0 deletions .github/workflows/deoxys.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --release --no-default-features --lib
- run: cargo test --release
- run: cargo test --release --features stream,std
- run: cargo test --release --all-features
2 changes: 1 addition & 1 deletion .github/workflows/eax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,6 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --release --no-default-features
- run: cargo test --release
- run: cargo test --release --all-features
- run: cargo test --release --no-default-features
1 change: 1 addition & 0 deletions .github/workflows/mgm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
- uses: dtolnay/rust-toolchain@master
with:
toolchain: ${{ matrix.rust }}
- run: cargo test --release --no-default-features
- run: cargo test --release
- run: cargo test --release --features force-soft
- run: cargo test --release --features stream,std
Expand Down
2 changes: 2 additions & 0 deletions aes-gcm-siv/tests/aes128gcmsiv.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! AES-128-auth tag-SIV tests

#![cfg(all(feature = "aes", feature = "alloc"))]

#[macro_use]
mod common;

Expand Down
2 changes: 2 additions & 0 deletions aes-gcm-siv/tests/aes256gcmsiv.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! AES-256-auth tag-SIV tests

#![cfg(all(feature = "aes", feature = "alloc"))]

#[macro_use]
mod common;

Expand Down
2 changes: 2 additions & 0 deletions aes-gcm-siv/tests/ctr_wrap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//! The tests use `Aes256GcmSiv` and are crafted to test correct wrapping of
//! the block counter.

#![cfg(all(feature = "aes", feature = "alloc"))]

#[macro_use]
mod common;

Expand Down
2 changes: 1 addition & 1 deletion aes-gcm/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
//!
//! # fn main() -> Result<(), aes_gcm::Error> {
//! // Alternatively, the key can be transformed directly from a byte slice
//! // (panicks on length mismatch):
//! // (panics on length mismatch):
//! # let key: &[u8] = &[42; 32];
//! let key = Key::<Aes256Gcm>::from_slice(key);
//!
Expand Down
2 changes: 2 additions & 0 deletions aes-gcm/tests/aes128gcm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! AES-128-auth tag tests

#![cfg(all(feature = "aes", feature = "alloc"))]

#[macro_use]
mod common;

Expand Down
2 changes: 2 additions & 0 deletions aes-gcm/tests/aes256gcm.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! AES-256-auth tag tests

#![cfg(all(feature = "aes", feature = "alloc"))]

#[macro_use]
mod common;

Expand Down
2 changes: 2 additions & 0 deletions aes-gcm/tests/other_ivlen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
//! Vectors taken from NIST CAVS vectors' `gcmEncryptExtIV128.rsp` file:
//! <https://csrc.nist.gov/Projects/cryptographic-algorithm-validation-program/CAVP-TESTING-BLOCK-CIPHER-MODES>

#![cfg(all(feature = "aes", feature = "alloc"))]

use aead::{
generic_array::{typenum, GenericArray},
Aead, KeyInit,
Expand Down
2 changes: 2 additions & 0 deletions aes-siv/tests/aead.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "alloc")]

#[macro_use]
extern crate hex_literal;

Expand Down
2 changes: 2 additions & 0 deletions aes-siv/tests/siv.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
//! AES-SIV tests for the raw SIV interface

#![cfg(feature = "alloc")]

use aes_siv::aead::generic_array::GenericArray;

/// Test vectors
Expand Down
2 changes: 2 additions & 0 deletions ccm/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#![cfg(feature = "alloc")]

use aead::{generic_array::GenericArray, Aead, AeadInPlace, KeyInit, Payload};
use aes::{Aes128, Aes192, Aes256};
use ccm::{
Expand Down
5 changes: 4 additions & 1 deletion deoxys/tests/deoxys_i_128.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Uses the official test vectors.
//! Uses the official test vectors.

#![cfg(feature = "alloc")]

use deoxys::aead::generic_array::GenericArray;
use deoxys::aead::{Aead, KeyInit, Payload};
use deoxys::DeoxysI128;
Expand Down
5 changes: 4 additions & 1 deletion deoxys/tests/deoxys_i_256.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Uses the official test vectors.
//! Uses the official test vectors.

#![cfg(feature = "alloc")]

use deoxys::aead::generic_array::GenericArray;
use deoxys::aead::{Aead, KeyInit, Payload};
use deoxys::DeoxysI256;
Expand Down
5 changes: 4 additions & 1 deletion deoxys/tests/deoxys_ii_128.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Uses the official test vectors.
//! Uses the official test vectors.

#![cfg(feature = "alloc")]

use deoxys::aead::generic_array::GenericArray;
use deoxys::aead::{Aead, KeyInit, Payload};
use deoxys::DeoxysII128;
Expand Down
5 changes: 4 additions & 1 deletion deoxys/tests/deoxys_ii_256.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
// Uses the official test vectors.
//! Uses the official test vectors.

#![cfg(feature = "alloc")]

use deoxys::aead::generic_array::GenericArray;
use deoxys::aead::{Aead, KeyInit, Payload};
use deoxys::DeoxysII256;
Expand Down
3 changes: 3 additions & 0 deletions mgm/tests/bad_nonce.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
//! Tests for nonce validity checks

#![cfg(feature = "alloc")]

use aead::{generic_array::GenericArray, Aead, KeyInit};
use mgm::Mgm;

Expand Down
2 changes: 2 additions & 0 deletions mgm/tests/rfc9058.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
//! Test vectors from: https://datatracker.ietf.org/doc/html/rfc9058

#![cfg(feature = "alloc")]

aead::new_test!(kuznyechik, "kuznyechik", mgm::Mgm<kuznyechik::Kuznyechik>);
aead::new_test!(magma, "magma", mgm::Mgm<magma::Magma>);

0 comments on commit d80e203

Please sign in to comment.