From e9730f8eaed88cc742e6db34786b19bb712b5866 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Fri, 19 Jun 2026 10:26:22 +0200 Subject: perf: scan single nvchecker entry with -e for single-package checks When --check is given exactly one package, and when --hintfile suggests a version without -v, run `nvchecker -e ` so only that entry is scanned instead of the whole nvchecker.toml. Two+ packages or no args still do one full scan, since nvchecker -e accepts only a single entry. Add T42/T43 (mock nvchecker now logs its args), and update CLAUDE.md and README.md (including the previously undocumented -R/--review and -l highlight). Co-Authored-By: Claude Opus 4.8 --- tests/mkhint_test.sh | 37 +++++++++++++++++++++++++++++++++++-- 1 file changed, 35 insertions(+), 2 deletions(-) (limited to 'tests/mkhint_test.sh') diff --git a/tests/mkhint_test.sh b/tests/mkhint_test.sh index e95b529..4ee3059 100755 --- a/tests/mkhint_test.sh +++ b/tests/mkhint_test.sh @@ -163,9 +163,10 @@ EOF mock_nvchecker_tools() { mkdir -p "$MOCK_BASE/bin" - # nvchecker: no-op success (keyfile is pre-seeded by setup/tests) - cat > "$MOCK_BASE/bin/nvchecker" << 'EOF' + # nvchecker: record invocations, no-op success (keyfile pre-seeded by setup/tests) + cat > "$MOCK_BASE/bin/nvchecker" << EOF #!/bin/bash +echo "nvchecker \$*" >> "$MOCK_BASE/nvchecker.log" exit 0 EOF chmod +x "$MOCK_BASE/bin/nvchecker" @@ -838,6 +839,38 @@ echo "$out" | grep -q "nothing to review" \ && { echo " PASS: nothing-to-review message"; (( PASS++ )); } \ || { echo " FAIL: message missing"; echo "$out" | sed 's/^/ /'; (( FAIL++ )); ERRORS+=("T41 msg"); } +# ── T42: --check single package → nvchecker called with -e ────────────── +echo "" +echo "T42: --check one package runs nvchecker -e " +rm -f "$MOCK_HINT"/*.hint "$MOCK_HINT"/*.bak "$MOCK_BASE/nvchecker.log" 2>/dev/null +cat > "$MOCK_BASE/new_ver.json" << 'EOF' +{ "version": 2, "data": { "curl": { "version": "8.5.0" } } } +EOF +cat > "$MOCK_HINT/curl.hint" << 'EOF' +VERSION="8.5.0" +ARCH="x86_64" +DOWNLOAD="https://curl.se/download/curl-8.5.0.tar.gz" +MD5SUM="abc123def456abc123def456abc123de" +EOF +run_mkhint -C curl < <(printf '\n') > /dev/null 2>&1 +assert_contains "nvchecker run with -e curl" "$MOCK_BASE/nvchecker.log" '\-e curl' + +# ── T43: --check two packages → nvchecker scans all (no -e) ─────────────────── +echo "" +echo "T43: --check two packages runs nvchecker without -e (full scan)" +rm -f "$MOCK_BASE/nvchecker.log" 2>/dev/null +cat > "$MOCK_BASE/new_ver.json" << 'EOF' +{ "version": 2, "data": { "curl": { "version": "8.5.0" }, "clion": { "version": "2025.4" } } } +EOF +cat > "$MOCK_HINT/clion.hint" << 'EOF' +VERSION="2025.4" +ARCH="x86_64" +DOWNLOAD="UNSUPPORTED" +MD5SUM="" +EOF +run_mkhint -C curl clion < <(printf '\n') > /dev/null 2>&1 +assert_not_contains "two-pkg check has no -e" "$MOCK_BASE/nvchecker.log" '\-e ' + # ─── SUMMARY ────────────────────────────────────────────────────────────────── teardown -- cgit v1.2.3