Skip to content

Commit

Permalink
Fix hrtimer CI (#1523)
Browse files Browse the repository at this point in the history
* Fix hrtimer CI

Or try to.

* Add min and max

* See if using q10 is more robust

* Don't run `hrtimer` tests in CI on Windows and MacOS

* Fix formatting

* Add clippy allows for useless_conversion, to be removed when we bump
the MSRV to 1.74.0.

* Fix formatting

* One more clippy allow

* Debug Mac test failure

* MacOS failure seems spurious? Sigh.
  • Loading branch information
larseggert authored Dec 20, 2023
1 parent 9825cc9 commit d1639a4
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 3 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ jobs:
git clone --depth=1 https://github.com/nss-dev/nss "$NSS_DIR"
echo "NSS_DIR=$NSS_DIR" >> "$GITHUB_ENV"
echo "NSPR_DIR=$NSPR_DIR" >> "$GITHUB_ENV"
echo "NSS_JOBS=$NUMBER_OF_PROCESSORS" >> "$GITHUB_ENV"
env:
NSS_DIR: ${{ github.workspace }}/nss
NSPR_DIR: ${{ github.workspace }}/nspr
Expand All @@ -107,7 +106,7 @@ jobs:
RUST_BACKTRACE: 1

- name: Run tests and determine coverage
run: cargo +${{ matrix.rust-toolchain }} llvm-cov test --all-targets --no-fail-fast --lcov --output-path lcov.info
run: cargo +${{ matrix.rust-toolchain }} llvm-cov test --features ci --all-targets --no-fail-fast --lcov --output-path lcov.info
env:
RUST_BACKTRACE: 1
RUST_LOG: neqo=debug
Expand Down
1 change: 1 addition & 0 deletions neqo-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ time = {version = "=0.3.23", features = ["formatting"]}

[features]
deny-warnings = []
ci = []

[target."cfg(windows)".dependencies.winapi]
version = "0.3"
Expand Down
7 changes: 6 additions & 1 deletion neqo-common/src/hrtime.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,12 @@ impl Drop for Time {
}
}

#[cfg(test)]
// Only run these tests in CI on platforms other than MacOS and Windows, where the timer
// inaccuracies are too high to pass the tests.
#[cfg(all(
test,
not(all(any(target_os = "macos", target_os = "windows"), feature = "ci"))
))]
mod test {
use super::Time;
use std::{
Expand Down
2 changes: 2 additions & 0 deletions neqo-crypto/src/ech.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ pub fn generate_keys() -> Res<(PrivateKey, PublicKey)> {

// If we have tracing on, try to ensure that key data can be read.
let insensitive_secret_ptr = if log::log_enabled!(log::Level::Trace) {
#[allow(clippy::useless_conversion)] // TODO: Remove when we bump the MSRV to 1.74.0.
unsafe {
p11::PK11_GenerateKeyPairWithOpFlags(
*slot,
Expand All @@ -126,6 +127,7 @@ pub fn generate_keys() -> Res<(PrivateKey, PublicKey)> {
};
assert_eq!(insensitive_secret_ptr.is_null(), public_ptr.is_null());
let secret_ptr = if insensitive_secret_ptr.is_null() {
#[allow(clippy::useless_conversion)] // TODO: Remove when we bump the MSRV to 1.74.0.
unsafe {
p11::PK11_GenerateKeyPairWithOpFlags(
*slot,
Expand Down
1 change: 1 addition & 0 deletions neqo-crypto/src/hkdf.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub fn import_key(version: Version, buf: &[u8]) -> Res<SymKey> {
return Err(Error::UnsupportedVersion);
}
let slot = Slot::internal()?;
#[allow(clippy::useless_conversion)] // TODO: Remove when we bump the MSRV to 1.74.0.
let key_ptr = unsafe {
PK11_ImportDataKey(
*slot,
Expand Down
5 changes: 5 additions & 0 deletions neqo-crypto/src/hp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ impl HpKey {
let l = label.as_bytes();
let mut secret: *mut PK11SymKey = null_mut();

#[allow(clippy::useless_conversion)] // TODO: Remove when we bump the MSRV to 1.74.0.
let (mech, key_size) = match cipher {
TLS_AES_128_GCM_SHA256 => (CK_MECHANISM_TYPE::from(CKM_AES_ECB), 16),
TLS_AES_256_GCM_SHA384 => (CK_MECHANISM_TYPE::from(CKM_AES_ECB), 32),
Expand Down Expand Up @@ -99,6 +100,8 @@ impl HpKey {

let res = match cipher {
TLS_AES_128_GCM_SHA256 | TLS_AES_256_GCM_SHA384 => {
// TODO: Remove when we bump the MSRV to 1.74.0.
#[allow(clippy::useless_conversion)]
let context_ptr = unsafe {
PK11_CreateContextBySymKey(
mech,
Expand Down Expand Up @@ -171,6 +174,8 @@ impl HpKey {
};
let mut output_len: c_uint = 0;
let mut param_item = Item::wrap_struct(&params);
// TODO: Remove when we bump the MSRV to 1.74.0.
#[allow(clippy::useless_conversion)]
secstatus_to_res(unsafe {
PK11_Encrypt(
**key,
Expand Down
1 change: 1 addition & 0 deletions neqo-crypto/src/p11.rs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ impl PrivateKey {
/// When the values are too large to fit. So never.
pub fn key_data(&self) -> Res<Vec<u8>> {
let mut key_item = Item::make_empty();
#[allow(clippy::useless_conversion)] // TODO: Remove when we bump the MSRV to 1.74.0.
secstatus_to_res(unsafe {
PK11_ReadRawAttribute(
PK11ObjectType::PK11_TypePrivKey,
Expand Down

0 comments on commit d1639a4

Please sign in to comment.