]> Nutra Git (v1) - gamesguru/git-remote-gcrypt.git/commitdiff
fixups/tweaks
authorShane Jaroch <chown_tee@proton.me>
Wed, 7 Jan 2026 21:03:11 +0000 (16:03 -0500)
committerShane Jaroch <chown_tee@proton.me>
Wed, 7 Jan 2026 21:03:11 +0000 (16:03 -0500)
.envrc
Makefile
tests/coverage_report.py

diff --git a/.envrc b/.envrc
index 0c60dc431800797bc7c807d9d17d668cf6f2b401..125610a8dfa222f61365f2ab874656bec86042a5 100644 (file)
--- a/.envrc
+++ b/.envrc
@@ -1,3 +1,8 @@
-# NOTE: for fish add .fish on end
+#!/bin/bash
+
+# in kilobytes
+export GCRYPT_TEST_REPACK_SCENARIO_BLOB_SIZE=100
+
+# NOTE: for fish add .fish on end; zsh has its own script, too
 source ./completions/$(basename $SHELL)/git-remote-gcrypt
 
index 63dd83903860d8d75e73a86095df850d14610f4a..8aea4b50defc4250b8ed4b1f2fc07909a626cd85 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -26,7 +26,7 @@ _all: lint test/installer test/system
 
 .PHONY: vars
 vars:  ##H Display all Makefile variables (simple)
-       @echo "=== Makefile Variables (file/command/line origin) ==="
+       $(info === Makefile Variables (file/command/line origin) ===)
        @$(foreach V,$(sort $(.VARIABLES)), \
                $(if $(filter file command line,$(origin $(V))), \
                        $(info $(shell printf "%-30s" "$(V)") = $(value $(V))) \
@@ -124,22 +124,25 @@ test/system: check/deps   ##H Run coverage tests (Dynamic Bash)
         trap - EXIT
 
 
-define CHECK_COVERAGE
-XML_FILE=$$(find $(1) -name "cobertura.xml" 2>/dev/null | grep "merged" | head -n 1); \
-[ -z "$$XML_FILE" ] && XML_FILE=$$(find $(1) -name "cobertura.xml" 2>/dev/null | head -n 1); \
-if [ -f "$$XML_FILE" ]; then \
-       echo ""; \
-       echo "Report for: file://$$(dirname "$$XML_FILE")/index.html"; \
-       XML_FILE="$$XML_FILE" PATT="$(2)" FAIL_UNDER="$(3)" python3 tests/coverage_report.py; \
-else \
-       echo ""; \
-       echo "Error: No coverage report found for $(2) in $(1)"; \
-       exit 1; \
-fi
-endef
+# Find coverage XML: preference for "merged" > any other (search depth: 2 subdirs)
+find_coverage_xml = $(or \
+       $(filter %/merged/cobertura.xml, $(wildcard $(1)/cobertura.xml $(1)/*/cobertura.xml $(1)/*/*/cobertura.xml)), \
+       $(firstword $(wildcard $(1)/cobertura.xml $(1)/*/cobertura.xml $(1)/*/*/cobertura.xml)) \
+)
+
+CHECK_COVERAGE = $(if $(call find_coverage_xml,$(1)), \
+       echo "" ; \
+       echo "Report for: file://$(abspath $(dir $(call find_coverage_xml,$(1))))/index.html" ; \
+       XML_FILE="$(call find_coverage_xml,$(1))" PATT="$(2)" FAIL_UNDER="$(3)" python3 tests/coverage_report.py, \
+       echo "" ; \
+       echo "Error: No coverage report found for $(2) in $(1)" ; \
+       exit 1)
 
-.PHONY: test/cov
+.PHONY: test/cov _test_cov_internal
 test/cov:      ##H Show coverage gaps
+       $(MAKE) _test_cov_internal
+
+_test_cov_internal:
        @err=0; \
        $(call CHECK_COVERAGE,$(COV_SYSTEM),git-remote-gcrypt,60) || err=1; \
        $(call CHECK_COVERAGE,$(COV_INSTALL),install.sh,80) || err=1; \
index 7e310aeb1a05c8f2ea251355b9911d474581b6f0..b7ba1274b5b66c67e7c44326d2fc276443741997 100644 (file)
@@ -34,7 +34,9 @@ if total_lines > 0:
 else:
     print(f"Coverage: N/A (0 lines found for {patt})")
     if int(os.environ.get("FAIL_UNDER") or 0) > 0:
-        print(f"\033[31;1mFAIL: Coverage N/A is below threshold {os.environ.get('FAIL_UNDER')}%\033[0m")
+        print(
+            f"\033[31;1mFAIL: Coverage N/A is below threshold {os.environ.get('FAIL_UNDER')}%\033[0m"
+        )
         sys.exit(1)
 
 
@@ -50,5 +52,7 @@ if missed:
 fail_under = int(os.environ.get("FAIL_UNDER") or 0)
 if total_lines > 0:
     if pct < fail_under:
-        print(f"\033[31;1mFAIL: Coverage {pct:.1f}% is below threshold {fail_under}%\033[0m")
+        print(
+            f"\033[31;1mFAIL: Coverage {pct:.1f}% is below threshold {fail_under}%\033[0m"
+        )
         sys.exit(1)