Repository navigation
test: Add coverage for TorControl SAFECOOKIE authentication - #36497
winterrdog wants to merge 1 commit into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. External sites
ReviewsSee the guideline and AI policy for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
"Targeted" Test Coverage Improvements
to get these results, i only ran bash script used to get test coverage locally# 1. compile once with coverage baked in
cmake -B build -DCMAKE_BUILD_TYPE=Coverage
cmake --build build -j$(nproc)
# 2. BEFORE: run the merge-base version of the test file
git checkout $(git merge-base HEAD master) -- test/functional/feature_torcontrol.py
find build -name '*.gcda' -delete
python3 test/functional/feature_torcontrol.py --configfile=build/test/config.ini
lcov --capture --directory build --gcov-tool gcov-$(gcc -dumpversion | cut -d. -f1) \
--rc branch_coverage=1 --ignore-errors inconsistent,mismatch,unused,negative \
--output-file base.info
# 3. AFTER: run the PR version of the test file
git checkout HEAD -- test/functional/feature_torcontrol.py
find build -name '*.gcda' -delete
python3 test/functional/feature_torcontrol.py --configfile=build/test/config.ini
lcov --capture --directory build --gcov-tool gcov-$(gcc -dumpversion | cut -d. -f1) \
--rc branch_coverage=1 --ignore-errors inconsistent,mismatch,unused,negative \
--output-file after.info
# 4. keep only the file under test, then build the HTML report
lcov --extract base.info '*/src/torcontrol.cpp' --rc branch_coverage=1 -o base_tor.info
lcov --extract after.info '*/src/torcontrol.cpp' --rc branch_coverage=1 -o after_tor.info
genhtml after_tor.info --baseline-file base_tor.info --branch-coverage -o cov_diff
## DONE...
# opens the system's default browser on linux. on other systems, just open the
# differential coverage report (./cov_diff/index.html) in your browser of choice
xdg-open cov_diff/index.html |
|
ACK 141c4a7 |
|
Concept ACK 6827006 I introduced a few changes in |
6827006 to
88eafcc
Compare
Test successful authentication and failures caused by an unsuccessful `AUTHCHALLENGE`, an invalid server nonce or hash, and a missing or invalid-length cookie file.
88eafcc to
141c4a7
Compare
|
changes:
|
|
crACK 141c4a7 Reviewed against
Together with @mercie-ux's mutation testing, this confirms the six methods are genuine regression coverage rather than just line-hitting: happy path plus the five distinct failure branches, each pinned to a specific log line and an Minor, non-blocking: the six Code-review only — didn't build/run locally. |
|
Tested ACK 141c4a7 Ran the six new methods against a master build (v32.99.0-791173ae), all pass: Upgrading my earlier code-review ACK — together with @mercie-ux's mutation testing this confirms the methods pass on correct code and fail when the checks are broken. |

adds functional test coverage for
SAFECOOKIEauthentication, includingsuccessful authentication,
AUTHCHALLENGEfailure, an invalid servernonce, a mismatched server hash, an invalid-length cookie file, and a
missing cookie file
while working on #35292, i realised we did not have coverage for
SAFECOOKIEauthentication either, so i added it here