Skip to content

Commit f9af700

Browse files
committed
chore: rely on nss-rs for NSS initialization and test DB
Delegate NSS init in `fixture_init` to `nss-rs`'s own `test-fixture` crate instead of duplicating the logic. Remove `test-fixture/db` — the NSS database now comes from `nss-rs`, which exposes `TEST_FIXTURE_DB` as the default path for `neqo-server --db`. Update CI and scripts accordingly.
1 parent 7c2a6a3 commit f9af700

21 files changed

Lines changed: 54 additions & 61 deletions

File tree

.github/actions/build-neqo/action.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,9 @@ runs:
9999
cp -L /usr/lib/*/lib${lib}.so* dist/lib/ 2>/dev/null || true
100100
done
101101
fi
102-
cp -r neqo/test-fixture dist/
102+
NSS_DB=$(cd neqo && cargo metadata --format-version 1 | jq -r 'first(.packages[] | select(.name == "test-fixture" and (.source // "" | startswith("git+"))) | .manifest_path | rtrimstr("/Cargo.toml"))')/db
103+
mkdir -p dist/test-fixture
104+
cp -r "$NSS_DB" dist/test-fixture/
103105
104106
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
105107
with:

.github/actions/check-android/action.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ runs:
8383
while [ -z "$(adb shell getprop sys.boot_completed | tr -d '\r')" ]; do sleep 1; done
8484
any_failures=0
8585
TMP=/data/local/tmp
86-
[ -e "$WD/test-fixture/db" ] && adb push "test-fixture/db" "$TMP/"
86+
NSS_DB=$(cargo metadata --format-version 1 | jq -r 'first(.packages[] | select(.name == "test-fixture" and (.source // "" | startswith("git+"))) | .manifest_path | rtrimstr("/Cargo.toml"))')/db
87+
adb push "$NSS_DB" "$TMP/db"
8788
[ "$LD_LIBRARY_PATH" ] && adb push "$LD_LIBRARY_PATH" "$TMP/"
8889
for test in $(find $WD/target/$TARGET/debug/deps/ -type f -executable ! -name "*.so" -name "*-*"); do
8990
adb push "$test" "$TMP/"

.github/scripts/perfcompare.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,8 @@ def verify(cfg, tmp, client, server_cmd, client_cmd):
188188
def _sudo_nice_env() -> list[str]:
189189
"""Prefix for elevated-priority subprocesses: sudo resets env, so restore
190190
the vars that neqo binaries need to find NSS libraries and certificates."""
191-
env_vars = {k: os.environ[k] for k in ("LD_LIBRARY_PATH", "NSS_DB_PATH") if k in os.environ}
191+
# TODO: Remove NSS_DB_PATH once baseline uses nss-rs >= 0.11.0
192+
env_vars = {k: os.environ[k] for k in ("LD_LIBRARY_PATH", "TEST_FIXTURE_DB", "NSS_DB_PATH") if k in os.environ}
192193
env_args = [f"{k}={v}" for k, v in env_vars.items()]
193194
return ["sudo", "nice", "-n", "-20"] + (["env"] + env_args if env_args else [])
194195

.github/workflows/bench.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ jobs:
9797
cp dist/neqo-baseline/* binaries/neqo-baseline/
9898
{
9999
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/dist/lib:$LD_LIBRARY_PATH"
100-
echo "NSS_DB_PATH=$GITHUB_WORKSPACE/dist/test-fixture/db"
100+
echo "TEST_FIXTURE_DB=$GITHUB_WORKSPACE/dist/test-fixture/db"
101+
echo "NSS_DB_PATH=$GITHUB_WORKSPACE/dist/test-fixture/db" # TODO: Remove once baseline uses nss-rs >= 0.11.0
101102
} >> "$GITHUB_ENV"
102103
103104
# Disable turboboost, hyperthreading, use performance governor, and isolate CPUs with cset.
@@ -111,7 +112,8 @@ jobs:
111112
env:
112113
BENCH_SET: ${{ steps.cpu-tuning.outputs.bench-set }}
113114
run: |
114-
bench_exec() { sudo nice -n -20 env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" "NSS_DB_PATH=$NSS_DB_PATH" setarch --addr-no-randomize cset proc --set="$BENCH_SET" --exec "$@"; }
115+
# TODO: Remove NSS_DB_PATH once baseline uses nss-rs >= 0.11.0
116+
bench_exec() { sudo nice -n -20 env "LD_LIBRARY_PATH=$LD_LIBRARY_PATH" "TEST_FIXTURE_DB=$TEST_FIXTURE_DB" "NSS_DB_PATH=$NSS_DB_PATH" setarch --addr-no-randomize cset proc --set="$BENCH_SET" --exec "$@"; }
115117
filter_cset() { grep -v '^cset' || test $? = 1; }
116118
shopt -s extglob nullglob
117119

.github/workflows/perfcompare.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,8 @@ jobs:
173173
build-msquic/* build-google/* build-quiche/* build-s2n/*
174174
{
175175
echo "LD_LIBRARY_PATH=$GITHUB_WORKSPACE/build-neqo/lib:$LD_LIBRARY_PATH"
176-
echo "NSS_DB_PATH=$GITHUB_WORKSPACE/build-neqo/test-fixture/db"
176+
echo "TEST_FIXTURE_DB=$GITHUB_WORKSPACE/build-neqo/test-fixture/db"
177+
echo "NSS_DB_PATH=$GITHUB_WORKSPACE/build-neqo/test-fixture/db" # TODO: Remove once baseline uses nss-rs >= 0.11.0
177178
} >> "$GITHUB_ENV"
178179
179180
# Disable turboboost, hyperthreading, use performance governor, and isolate CPUs with cset.
@@ -189,7 +190,6 @@ jobs:
189190
- name: Compare QUIC implementations
190191
env:
191192
WORKSPACE: ${{ github.workspace }}
192-
NSS_DB_PATH: ${{ github.workspace }}/build-neqo/test-fixture/db
193193
SERVER_SET: ${{ steps.cpu-tuning.outputs.server-set }}
194194
CLIENT_SET: ${{ steps.cpu-tuning.outputs.client-set }}
195195
run: |

.github/workflows/profile.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ jobs:
8282

8383
- name: Run benchmark with perf
8484
env:
85-
NSS_DB_PATH: ${{ github.workspace }}/test-fixture/db
8685
BENCH: ${{ matrix.bench.bench }}
8786
run: |
8887
# shellcheck disable=SC2086
@@ -191,8 +190,6 @@ jobs:
191190
run: sudo sysctl -w kernel.perf_event_paranoid=-1
192191

193192
- name: Record server perf
194-
env:
195-
NSS_DB_PATH: ${{ github.workspace }}/test-fixture/db
196193
run: |
197194
# shellcheck disable=SC2086
198195
perf $PERF_OPT -o "$BENCH_NAME.server.perf" -- $SERVER_CMD &
@@ -201,8 +198,6 @@ jobs:
201198
202199
- name: Record client perf
203200
working-directory: /tmp
204-
env:
205-
NSS_DB_PATH: ${{ github.workspace }}/test-fixture/db
206201
run: |
207202
# shellcheck disable=SC2086
208203
perf $PERF_OPT -o "$BENCH_NAME.client.perf" -- $CLIENT_CMD || true

AGENTS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,11 @@ cargo test --locked --features ci
144144

145145
3. **Feature flags**: The `ci` feature exists for CI-specific functionality. The `gecko` feature is for Firefox integration (excluded from some checks). The `bench` feature enables benchmarks.
146146

147-
4. **Test utilities**: Use `test-fixture` crate for common test setup (NSS database, connection creation, assertions). NSS_DB_PATH defaults to `test-fixture/db`.
147+
4. **Test utilities**: Use `test-fixture` crate for common test setup (connection creation, assertions). NSS initialization is handled automatically via `fixture_init()`.
148148

149149
5. **Logging**: Use `RUST_LOG` env var for debug output (e.g., `RUST_LOG=debug`) via the logging macros in `neqo-common/src/log.rs`.
150150

151-
6. **NSS Database**: Tests require NSS database at `test-fixture/db` (committed to repo). Client/server tools can use it with `--db ./test-fixture/db`.
151+
6. **NSS Database**: Tests use the NSS database from the `nss-rs` dependency automatically. The `neqo-server` binary defaults to this database; override with `--db`.
152152

153153
## Common Failure Scenarios
154154

Cargo.lock

Lines changed: 19 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,8 @@ hex = { version = "0.4", default-features = false }
3636
http = { version = "1", default-features = false, features = ["std"] }
3737
libc = { version = "0.2", default-features = false }
3838
log = { version = "0.4", default-features = false }
39-
nss = { rev = "0.10.0", package = "nss-rs", git = "https://github.com/mozilla/nss-rs" }
39+
nss = { rev = "0.11.0", package = "nss-rs", git = "https://github.com/mozilla/nss-rs" }
40+
nss-test-fixture = { rev = "0.11.0", package = "test-fixture", git = "https://github.com/mozilla/nss-rs" }
4041
qlog = { version = "0.16.0", default-features = false }
4142
quinn-udp = { version = "0.6", default-features = false, features = ["log", "fast-apple-datapath"] }
4243
rustc-hash = { version = "2.1", default-features = false, features = [ "std" ]}
@@ -45,6 +46,7 @@ strum = { version = "0.27", default-features = false, features = ["derive"] }
4546
thiserror = { version = "2.0.12", default-features = false }
4647
windows = { version = ">=0.60,<0.63", default-features = false }
4748

49+
4850
[patch.crates-io]
4951
# TODO: Remove this once Gecko switches back to the official mio crate.
5052
# See <https://bugzilla.mozilla.org/show_bug.cgi?id=2024485> for details.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ something has changed.
153153
154154
### Connect with Firefox to local neqo-server
155155
156-
1. Run `neqo-server` via `cargo run --bin neqo-server -- 'localhost:12345' --db ./test-fixture/db`.
156+
1. Run `neqo-server` via `cargo run --bin neqo-server -- 'localhost:12345'`.
157157
2. On Firefox, set `about:config` preferences:
158158
- `network.http.http3.alt-svc-mapping-for-testing` to `localhost;h3=":12345"`
159159
- `network.http.http3.disable_when_third_party_roots_found` to `false`

0 commit comments

Comments
 (0)