diff --git a/.github/workflows/check-vm.yml b/.github/workflows/check-vm.yml new file mode 100644 index 0000000000..041206bb4c --- /dev/null +++ b/.github/workflows/check-vm.yml @@ -0,0 +1,167 @@ +name: CI VM +on: + push: + branches: ["main"] + paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] + pull_request: + branches: ["main"] + paths-ignore: ["*.md", "*.png", "*.svg", "LICENSE-*"] + merge_group: + workflow_dispatch: +env: + CARGO_TERM_COLOR: always + RUST_BACKTRACE: 1 + RUST_LOG: trace + +concurrency: + group: ${{ github.workflow }}-${{ github.ref_name }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + check-vm: + strategy: + fail-fast: false + matrix: + os: [freebsd, openbsd, netbsd, solaris] + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - id: nss-version + run: echo "minimum=$(cat neqo-crypto/min_version.txt)" >> "$GITHUB_OUTPUT" + + - run: curl -o rustup.sh --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs + + - if: matrix.os == 'freebsd' + uses: vmactions/freebsd-vm@debf37ca7b7fa40e19c542ef7ba30d6054a706a4 + with: + usesh: true + envs: "CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG GITHUB_ACTIONS" + prepare: | # This executes as root + set -e + pkg install -y curl llvm nss pkgconf + run: | # This executes as user + set -e + # FIXME: We're only comparing the NSS minor version here. + NSS_MINOR_VERSION="$(pkg-config --modversion nss | cut -d. -f2)" + NSS_MINIMUM_VERSION="$(echo ${{ steps.nss-version.outputs.minimum }} | cut -d. -f2)" + if [ "$NSS_MINOR_VERSION" -lt "$NSS_MINIMUM_VERSION" ]; then + echo "System NSS package too old (minorversion $NSS_MINOR_VERSION < $NSS_MINIMUM_VERSION); skipping checks" + exit 0 + fi + sh rustup.sh --default-toolchain stable --profile minimal --component clippy llvm-tools -y + . "$HOME/.cargo/env" + cargo check --all-targets + cargo clippy -- -D warnings + cargo install cargo-llvm-cov --locked + cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info + cargo test --no-fail-fast --release + rm -rf target # Don't sync this back to host + + - if: matrix.os == 'openbsd' + uses: vmactions/openbsd-vm@0cfe06e734a0ea3a546fca7ebf200b984b94d58a + with: + usesh: true + envs: "CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG GITHUB_ACTIONS" + prepare: | # This executes as root + set -e + pkg_add rust rust-clippy llvm-16.0.6p30 nss pkgconf # rustup doesn't support OpenBSD at all + run: | # This executes as user + set -e + # FIXME: We're only comparing the NSS minor version here. + NSS_MINOR_VERSION="$(pkg-config --modversion nss | cut -d. -f2)" + NSS_MINIMUM_VERSION="$(echo ${{ steps.nss-version.outputs.minimum }} | cut -d. -f2)" + if [ "$NSS_MINOR_VERSION" -lt "$NSS_MINIMUM_VERSION" ]; then + echo "System NSS package too old (minorversion $NSS_MINOR_VERSION < $NSS_MINIMUM_VERSION); skipping checks" + exit 0 + fi + export LIBCLANG_PATH=/usr/local/llvm16/lib + cargo check --all-targets + cargo clippy -- -D warnings + # FIXME: No profiler support in openbsd currently, error is: + # > error[E0463]: can't find crate for `profiler_builtins` + # > = note: the compiler may have been built without the profiler runtime + # export LLVM_COV=/usr/local/llvm16/bin/llvm-cov + # export LLVM_PROFDATA=/usr/local/llvm16/bin/llvm-profdata + # cargo install cargo-llvm-cov --locked + # cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info + cargo test --no-fail-fast # Remove this once profiler is supported + cargo test --no-fail-fast --release + rm -rf target # Don't sync this back to host + + - if: matrix.os == 'netbsd' + uses: vmactions/netbsd-vm@7c9086fdb4cc1aa814cda6e305390c2b966551a9 + with: + usesh: true + envs: "CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG GITHUB_ACTIONS" + prepare: | # This executes as root + set -e + /usr/sbin/pkg_add pkgin + pkgin -y install curl clang nss pkgconf + run: | # This executes as user + set -e + # FIXME: We're only comparing the NSS minor version here. + NSS_MINOR_VERSION="$(pkg-config --modversion nss | cut -d. -f2)" + NSS_MINIMUM_VERSION="$(echo ${{ steps.nss-version.outputs.minimum }} | cut -d. -f2)" + if [ "$NSS_MINOR_VERSION" -lt "$NSS_MINIMUM_VERSION" ]; then + echo "System NSS package too old (minorversion $NSS_MINOR_VERSION < $NSS_MINIMUM_VERSION); skipping checks" + exit 0 + fi + sh rustup.sh --default-toolchain stable --profile minimal --component clippy llvm-tools -y + . "$HOME/.cargo/env" + # FIXME: Why do we need to set this on NetBSD? + export LD_LIBRARY_PATH=/usr/pkg/lib/nss:/usr/pkg/lib/nspr + cargo check --all-targets + cargo clippy -- -D warnings + # FIXME: No profiler support in netbsd currently, error is: + # > error[E0463]: can't find crate for `profiler_builtins` + # > = note: the compiler may have been built without the profiler runtime + # cargo install cargo-llvm-cov --locked + # cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info + cargo test --no-fail-fast # Remove this once profiler is supported + cargo test --no-fail-fast --release + rm -rf target # Don't sync this back to host + + - if: matrix.os == 'solaris' + uses: vmactions/solaris-vm@a89b9438868c70db27e41625f0a5de6ff5e90809 + with: + release: "11.4-gcc" + usesh: true + envs: "CARGO_TERM_COLOR RUST_BACKTRACE RUST_LOG GITHUB_ACTIONS" + prepare: | # This executes as root + set -e + pkg install clang-libs nss pkg-config + run: | # This executes as also as root on Solaris + set -e + # FIXME: We're only comparing the NSS minor version here. + NSS_MINOR_VERSION="$(pkg-config --modversion nss | cut -d. -f2)" + NSS_MINIMUM_VERSION="$(echo ${{ steps.nss-version.outputs.minimum }} | cut -d. -f2)" + if [ "$NSS_MINOR_VERSION" -lt "$NSS_MINIMUM_VERSION" ]; then + echo "System NSS package too old (minorversion $NSS_MINOR_VERSION < $NSS_MINIMUM_VERSION); skipping checks" + exit 0 + fi + source <(curl -s https://raw.githubusercontent.com/psumbera/solaris-rust/refs/heads/main/sh.rust-web-install) || true # This doesn't exit with zero on success + export LIBCLANG_PATH="/usr/lib/amd64" + cargo check --all-targets + cargo clippy -- -D warnings + # FIXME: No profiler support in openbsd currently, error is: + # > error[E0463]: can't find crate for `profiler_builtins` + # > = note: the compiler may have been built without the profiler runtime + # cargo install cargo-llvm-cov --locked + # cargo llvm-cov test --no-fail-fast --lcov --output-path lcov.info + cargo test --no-fail-fast # Remove this once profiler is supported + cargo test --no-fail-fast --release + rm -rf target # Don't sync this back to host + + - uses: codecov/codecov-action@015f24e6818733317a2da2edd6290ab26238649a # v5.0.7 + with: + files: lcov.info + fail_ci_if_error: false + token: ${{ secrets.CODECOV_TOKEN }} + verbose: true + env: + CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} diff --git a/neqo-common/src/hrtime.rs b/neqo-common/src/hrtime.rs index 8fc0b5270f..b4f23d73cf 100644 --- a/neqo-common/src/hrtime.rs +++ b/neqo-common/src/hrtime.rs @@ -370,14 +370,9 @@ impl Drop for Time { } } -// 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")), - // Sanitizers are too slow to uphold timing assumptions. - not(neqo_sanitize), -))] +// Only run these tests in CI on Linux, where the timer accuracies are OK enough to pass the tests, +// but only when not running sanitizers. +#[cfg(all(test, target_os = "linux", not(neqo_sanitize)))] mod test { use std::{ thread::{sleep, spawn},