diff --git a/fuzz/build.rs b/fuzz/build.rs new file mode 100644 index 0000000000..47615132f1 --- /dev/null +++ b/fuzz/build.rs @@ -0,0 +1,9 @@ +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rustc-check-cfg=cfg(fuzzing)"); +} diff --git a/neqo-common/Cargo.toml b/neqo-common/Cargo.toml index a70b3738d5..dc4997bcf1 100644 --- a/neqo-common/Cargo.toml +++ b/neqo-common/Cargo.toml @@ -1,6 +1,5 @@ [package] name = "neqo-common" -build = "build.rs" authors.workspace = true homepage.workspace = true repository.workspace = true diff --git a/neqo-crypto/Cargo.toml b/neqo-crypto/Cargo.toml index 85b2630404..b16c098fab 100644 --- a/neqo-crypto/Cargo.toml +++ b/neqo-crypto/Cargo.toml @@ -1,6 +1,5 @@ [package] name = "neqo-crypto" -build = "build.rs" authors.workspace = true homepage.workspace = true repository.workspace = true diff --git a/neqo-crypto/build.rs b/neqo-crypto/build.rs index 2dd4543797..5080f89d03 100644 --- a/neqo-crypto/build.rs +++ b/neqo-crypto/build.rs @@ -421,6 +421,7 @@ fn setup_for_gecko() -> Vec { } fn main() { + println!("cargo:rustc-check-cfg=cfg(nss_nodb)"); let flags = if cfg!(feature = "gecko") { setup_for_gecko() } else if let Ok(nss_dir) = env::var("NSS_DIR") { diff --git a/neqo-http3/src/server.rs b/neqo-http3/src/server.rs index 8fce803fb3..e5fb5e1ae5 100644 --- a/neqo-http3/src/server.rs +++ b/neqo-http3/src/server.rs @@ -1271,11 +1271,11 @@ mod tests { while let Some(event) = hconn.next_event() { match event { Http3ServerEvent::Headers { stream, .. } => { - assert!(!requests.contains_key(&stream)); - requests.insert(stream, 0); + assert!(!requests.contains_key(&stream.stream_id())); + requests.insert(stream.stream_id(), 0); } Http3ServerEvent::Data { stream, .. } => { - assert!(requests.contains_key(&stream)); + assert!(requests.contains_key(&stream.stream_id())); } Http3ServerEvent::DataWritable { .. } | Http3ServerEvent::StreamReset { .. } diff --git a/neqo-http3/tests/httpconn.rs b/neqo-http3/tests/httpconn.rs index 8b9e7b42e8..801668af9f 100644 --- a/neqo-http3/tests/httpconn.rs +++ b/neqo-http3/tests/httpconn.rs @@ -522,14 +522,12 @@ fn fetch_noresponse_will_idletimeout() { let mut done = false; while !done { while let Some(event) = hconn_c.next_event() { - if let Http3ClientEvent::StateChange(state) = event { - match state { - Http3State::Closing(error_code) | Http3State::Closed(error_code) => { - assert_eq!(error_code, CloseReason::Transport(Error::IdleTimeout)); - done = true; - } - _ => {} - } + if let Http3ClientEvent::StateChange( + Http3State::Closing(error_code) | Http3State::Closed(error_code), + ) = event + { + assert_eq!(error_code, CloseReason::Transport(Error::IdleTimeout)); + done = true; } } diff --git a/neqo-transport/build.rs b/neqo-transport/build.rs new file mode 100644 index 0000000000..47615132f1 --- /dev/null +++ b/neqo-transport/build.rs @@ -0,0 +1,9 @@ +// Licensed under the Apache License, Version 2.0 or the MIT license +// , at your +// option. This file may not be copied, modified, or distributed +// except according to those terms. + +fn main() { + println!("cargo:rustc-check-cfg=cfg(fuzzing)"); +} diff --git a/qns/Dockerfile b/qns/Dockerfile index c4bbd2a79e..dde601f574 100644 --- a/qns/Dockerfile +++ b/qns/Dockerfile @@ -1,27 +1,51 @@ FROM martenseemann/quic-network-simulator-endpoint@sha256:12596544531465e77bdede50dd1e85b2c46c00f1634b3445eed277ca177666db AS buildimage RUN apt-get update && apt-get install -y --no-install-recommends \ - curl git mercurial coreutils \ - build-essential libclang-dev lld \ - gyp ninja-build zlib1g-dev python \ + git coreutils build-essential libclang-dev lld gyp ninja-build zlib1g-dev python \ && apt-get autoremove -y && apt-get clean -y \ && rm -rf /var/lib/apt/lists/* -ARG RUST_VERSION=stable +# From https://github.com/rust-lang/docker-rust/blob/cc31986e1dfe94671c639231ecf0503942c121d9/1.78.0/bookworm/slim/Dockerfile ENV RUSTUP_HOME=/usr/local/rustup \ CARGO_HOME=/usr/local/cargo \ - PATH=/usr/local/cargo/bin:$PATH + PATH=/usr/local/cargo/bin:$PATH \ + RUST_VERSION=1.78.0 -ADD --checksum=sha256:a3d541a5484c8fa2f1c21478a6f6c505a778d473c21d60a18a4df5185d320ef8 \ - https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init x86_64_rustup - -ADD --checksum=sha256:76cd420cb8a82e540025c5f97bda3c65ceb0b0661d5843e6ef177479813b0367 \ - https://static.rust-lang.org/rustup/dist/aarch64-unknown-linux-gnu/rustup-init aarch64_rustup +RUN set -eux; \ + apt-get update; \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + gcc \ + libc6-dev \ + wget \ + ; \ + dpkgArch="$(dpkg --print-architecture)"; \ + case "${dpkgArch##*-}" in \ + amd64) rustArch='x86_64-unknown-linux-gnu'; rustupSha256='a3d541a5484c8fa2f1c21478a6f6c505a778d473c21d60a18a4df5185d320ef8' ;; \ + armhf) rustArch='armv7-unknown-linux-gnueabihf'; rustupSha256='7cff34808434a28d5a697593cd7a46cefdf59c4670021debccd4c86afde0ff76' ;; \ + arm64) rustArch='aarch64-unknown-linux-gnu'; rustupSha256='76cd420cb8a82e540025c5f97bda3c65ceb0b0661d5843e6ef177479813b0367' ;; \ + i386) rustArch='i686-unknown-linux-gnu'; rustupSha256='cacdd10eb5ec58498cd95dbb7191fdab5fa4343e05daaf0fb7cdcae63be0a272' ;; \ + ppc64el) rustArch='powerpc64le-unknown-linux-gnu'; rustupSha256='b152711fb15fd629f0d4c2731cbf9167e6352da0ffcb2210447d80c010180f96' ;; \ + s390x) rustArch='s390x-unknown-linux-gnu'; rustupSha256='4ff9e7963ed0457e64cbb29d2b5a37496d1fa303f9300adc5251ee3c16bd3b30' ;; \ + *) echo >&2 "unsupported architecture: ${dpkgArch}"; exit 1 ;; \ + esac; \ + url="https://static.rust-lang.org/rustup/archive/1.27.0/${rustArch}/rustup-init"; \ + wget "$url"; \ + echo "${rustupSha256} *rustup-init" | sha256sum -c -; \ + chmod +x rustup-init; \ + ./rustup-init -y --no-modify-path --profile minimal --default-toolchain $RUST_VERSION --default-host ${rustArch}; \ + rm rustup-init; \ + chmod -R a+w $RUSTUP_HOME $CARGO_HOME; \ + rustup --version; \ + cargo --version; \ + rustc --version; \ + apt-get remove -y --auto-remove \ + wget \ + ; \ + rm -rf /var/lib/apt/lists/*; -RUN mv $(uname -m)_rustup rustup-init && \ - chmod +x rustup-init && \ - ./rustup-init -y -q --no-modify-path --profile minimal --default-toolchain $RUST_VERSION +# End of copy from https://github.com/rust-lang/docker-rust... ENV NSS_DIR=/nss \ NSPR_DIR=/nspr \