aboutsummaryrefslogtreecommitdiff
path: root/Makefile
Commit message (Collapse)AuthorAgeFilesLines
* build: add compile-file for single-file byte-compile with the project load pathCraig Jennings11 days1-2/+17
| | | | | | Bare emacs -Q --batch byte-compile-file fails on local compile-time requires (undead-buffers for a module, dupre-palette for a theme file) because nothing is on the load path, even though init and the test harness load fine. I added a compile-file target that compiles one file with the project load path (modules, themes, tests, plus package-initialize), and put themes on make compile's path too. Bare emacs -Q stays unsupported by design; compile-file is the documented command, and it guards against a missing FILE. Verified modules/dashboard-config.el and themes/dupre-faces.el both compile through it.
* fix(test): make test-name resilient to load-time cwd changesCraig Jennings14 days1-1/+1
| | | | | | make test-name loads every test file into one Emacs, then selects by name. test-system-defaults-functions.el requires system-defaults at load, which runs (setq default-directory user-home-dir), an intentional config choice. That leaked the cwd into the shared session, so every relative -l tests/X.el load after it resolved against the wrong directory and aborted the whole run with Error 255. I made two changes. test-name now passes absolute paths to -l so loads survive any cwd change, and the test contains the leak by let-binding default-directory around the require. The production setq stays as is.
* fix(coverage): include gptel-tools in instrumentation globCraig Jennings2026-05-161-2/+2
| | | | | | | | | | | | | | | | Undercover now instruments gptel-tools/*.el alongside modules/*.el, so the new git_status / git_log / git_diff / web_fetch tools (and their successors) report coverage instead of reading as zero. The matching pre-coverage clean step deletes gptel-tools/*.elc so stale byte-compiled artifacts don't shadow the .el sources. If Emacs loads the .elc first, undercover's source instrumentation never runs. docs/design/coverage.org gains an Elisp-coverage-producer subsection documenting the glob, the :merge-report dependence (SimpleCov merges cross-process reports, LCOV does not), and the missing-artifact failure mode.
* refactor(build): extract the shared test-runner loop into a make macroCraig Jennings2026-05-121-93/+70
| | | | | | | | `test-unit' and `test-integration' carried the same ~45-line shell loop (run each .el file in its own Emacs with the slow/perf-tagged tests skipped, count "Ran N", collect failures, dump a per-file log, print a ✓/✗ summary banner, exit 1 on any fail), differing only in the file list and the label. The `:perf' tag filter had to be added in both last week, which is the kind of drift this invites. Now a `define run-el-tests' macro (parametrized by the file list and the lowercase/uppercase labels) holds the loop once, and the two targets are one `@$(call run-el-tests,...)' line each. The banner string moved to a `BANNER' variable. No behavior change: `make test-unit', `make test-integration', and `make test' produce the same output. `coverage' keeps its own loop. It uses `run-coverage-file.el' instead of `-l ert', skips the pass-count and the per-file log, has a much shorter summary, and is bracketed by the .elc cleanup and the coverage-file check. Folding it in would need three more parameters and conditionals, which would cost more clarity than the duplication does.
* test(scripts): add bats coverage for setup-email.sh password helpersCraig Jennings2026-05-121-2/+20
| | | | | | `setup-email.sh' ran top to bottom, so the only way to exercise `install_encrypted_password' / `decrypt_password' was to run the whole new-machine setup (mbsync, mu init). Its procedural body now lives in a `main()' function guarded by the usual `[[ "${BASH_SOURCE[0]}" == "${0}" ]]' check, so sourcing the script just defines the helpers, and running it directly is unchanged. New `tests/test-setup-email.bats' sources the script, points the password dirs at a per-test tmpdir, and covers both helpers across the normal / skip-existing / missing-source / (for decrypt) gpg-failure paths, stubbing `gpg' so no real key is needed. `make test-bash' runs the bats files, and `make test' picks them up after the Elisp suite when bats is installed.
* build: add make benchmark target and skip :perf tests by defaultCraig Jennings2026-05-121-10/+21
| | | | | | `make test', `make coverage', and the editor's PostToolUse test runner all selected `(not (tag :slow))', which let the now-`:perf'-tagged benchmark suite run alongside the unit tests. Each of those three filters now also excludes `:perf', and a new `make benchmark' target runs the benchmark file on its own. `make test-file' and `make test-name' keep their old filters so the suite stays reachable for ad-hoc runs. `COVERAGE_EXCLUDE' loses `test-lorem-optimum-benchmark.el'. The tag filter handles it now, so the only entry left is `test-all-comp-errors.el', which byte-compiles modules and can't run under undercover's instrumentation.
* docs: clarify the coverage-exclude and token-seed commentsCraig Jennings2026-05-111-2/+3
| | | | The Makefile's `COVERAGE_EXCLUDE' comment said why `test-all-comp-errors.el' is excluded but not why `test-lorem-optimum-benchmark.el' is. It now notes that undercover's instrumentation slows execution enough to fail the benchmark's wall-clock assertions. And `cj/markov-generate' now has a comment explaining why `tokens' is seeded reversed (`(list w2 w1)'): the list is built with `push' and `nreverse'd at the end, so without the note the reversed seed reads like a bug at a glance.
* build(make): exclude the lorem-optimum benchmark from coverage runsCraig Jennings2026-05-111-1/+3
| | | | `test-lorem-optimum-benchmark.el' runs under undercover during `make coverage', and the instrumentation slows the path enough to fail the benchmark's timing assertions. Added it to `COVERAGE_EXCLUDE' alongside `test-all-comp-errors.el'. It still runs in the normal `make test' flow.
* Make batch Emacs prefer newer sourcesCraig Jennings2026-05-101-1/+1
| | | | Set load-prefer-newer for Makefile batch/test invocations. This matches normal startup and keeps tests from accidentally loading stale .elc files instead of the edited source.
* fix: make test scratch paths sandbox-friendlyCraig Jennings2026-05-031-1/+2
| | | | | | | | | | | | `tests/testutil-general.el` hard-coded `~/.temp-emacs-tests/` as the test root. That worked locally but blew up under sandboxed `make` runs and CI environments that can't write outside the repo or `/tmp`. A clean sandbox `make test` run reported 32 failing test files purely from the home-directory write attempt, even though the same suite passed when run with normal write permission. I rewrote `cj/test-base-dir` to honor `CJ_EMACS_TEST_DIR` if set, otherwise create a unique directory under `temporary-file-directory` via `make-temp-file`. So sandbox and CI paths just work, and a stable local debug root is still one env-var away. I also tightened the path-containment checks. The old `(string-prefix-p base fullpath)` was a textual hack. Relative paths and weird trailing slashes could fool it. I extracted `cj/test--assert-inside-base` using `file-in-directory-p`, which is the proper API. While I was there, I added `cj/test--safe-base-dir-p` so `cj/delete-test-base-dir` refuses to recursively wipe `/`, `~/`, `temporary-file-directory`, `user-emacs-directory`, `default-directory`, or any path of length under six characters. That guards against an env-var typo or a misaligned `let` binding accidentally deleting something important. I updated the Makefile's `clean-tests` target to nuke the new `$TMPDIR/cj-emacs-tests-*` pattern plus an explicit `CJ_EMACS_TEST_DIR` (if set) and the legacy `~/.temp-emacs-tests` directory. I added `tests/test-testutil-general.el` with five tests: default base lives under `temporary-file-directory`, env override resolves correctly, parent-escape paths are rejected, broad roots are refused for deletion, and a specific selected root is cleaned cleanly.
* feat(coverage): wire make coverage target + simplecov pipelineCraig Jennings2026-04-221-0/+61
| | | | | | | | | | | | | | | | Completes the coverage v1 pipeline by adding the Makefile target, the undercover driver script, the exclusion list, and the .gitignore entry. Uses simplecov JSON rather than LCOV as the collection format. The LCOV vs simplecov choice: Undercover's :merge-report t option only supports simplecov. Since the pipeline runs tests per-file (matching test-unit's isolation pattern) and accumulates coverage across runs, merge-report is required. LCOV is better-supported by external coverage viewers, but for a primarily interactive workflow the on-disk format is an internal detail. Other moves in this commit: - Renamed cj/--coverage-parse-lcov to cj/--coverage-parse-simplecov and rewrote its tests for the JSON schema. Same signature, same semantics (file to set of covered lines), different parser. - Renamed the backend protocol's :lcov-path key to :report-path, format-neutral and matching the renamed cj/--coverage-elisp-report-path function. - The coverage target deletes modules/*.elc before running so undercover can instrument the .el sources. Without this, byte-compiled versions shadow the instrumentation and only a handful of pre-loaded modules end up with coverage data. - Excluded tests/test-all-comp-errors.el from make coverage runs. That test byte-compiles every module, which fails under undercover's instrumentation. Excluded only from coverage. Normal make test still runs it. - Updated docs/design/coverage.org to reflect the simplecov pivot with a historical note on why we moved off LCOV. Verified end-to-end: make coverage produces .coverage/simplecov.json with 2717 of 4559 executable lines hit across 44 tracked modules.
* fix: load freshness, wttrin path, compile-time package initCraig Jennings2026-04-221-0/+1
| | | | | | | | Set load-prefer-newer in early-init.el. Emacs was loading the older .elc files even when the .el source was newer, warning on every load but still using the stale byte code. Point weather-config.el's wttrin :load-path at /home/cjennings/code/emacs-wttrin. The previous value was /home/cjennings/code/wttrin, which does not exist, so use-package could not load the package. Add (package-initialize) to the Makefile compile target. Without it, batch byte-compile cannot see ELPA packages like git-gutter, git-timemachine, forge, and difftastic, which produced "Cannot load" warnings on every run.
* chore: remove install-hooks target, rulesets install handles itCraig Jennings2026-04-191-10/+1
|
* chore(hooks): add tracked pre-commit hook via githooks/Craig Jennings2026-04-191-1/+10
| | | | | | | | | | | | | Portable setup: pre-commit lives in githooks/ (tracked), activated by `make install-hooks` which sets core.hooksPath. Survives fresh clones. The hook does two things on staged changes: - Scans added lines for common credential patterns (AWS keys, sk-* tokens, BEGIN PRIVATE KEY blocks, api_key/password literals) - Runs check-parens on staged .el files Bypass with `git commit --no-verify` for confirmed false positives.
* chore(Makefile): add targets alias for helpCraig Jennings2026-01-241-1/+4
|
* feat(tests): Improve test failure reporting in MakefileCraig Jennings2025-11-151-9/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Major improvements to test output clarity and failure diagnostics: Output Improvements: - Clean aligned output showing test file + pass/fail status - Show test count for passing files: "✓ (11 tests)" - Clear "✗ FAILED" marker for failures (no verbose noise) - Suppress passing test details (reduces output by ~95%) Failure Summary: - Clear visual separator box for failures - List all failed files with bullet points - Show specific failed test names with line numbers - Provide copy-paste commands to re-run failures Technical Changes: - Capture test output and only display on failure - Extract test count from ERT output for passing tests - Save failure details to temp files for summary - Apply same improvements to both unit and integration tests Benefits: - Instantly see which tests failed (no scrolling) - Know exactly which test names failed - Get line numbers for debugging - Copy-paste commands to re-run specific failures - Dramatically reduced output verbosity Example summary: Failed test files: • test-mousetrap-mode--get-profile-for-mode.el Errors: FAILED test-foo (line 15) Run individual failing tests with: make test-file FILE=test-mousetrap-mode--get-profile-for-mode.el
* refactor: Remove ANSI color codes from MakefileCraig Jennings2025-11-121-45/+40
| | | | | | | | | | | | | | | | | | | | Replaced colored output with plain text symbols for better portability: - Removed all COLOR_* variable definitions - Replaced color-wrapped text with plain text - Added simple text markers: - [i] for informational messages - [!] for warnings - ✓ for success (kept from before) - ✗ for errors (kept from before) - ⚠ for warnings (kept from before) Benefits: - Works in all terminals and CI environments - No escape code littering when piped or logged - Simpler, more maintainable code - Cleaner output that's easier to read Changes: 40 insertions, 45 deletions
* test: Exclude slow tests from batch executionsCraig Jennings2025-11-091-3/+3
| | | | | Update the test commands to skip tests tagged with :slow during batch execution, improving testing efficiency.
* feat: Add comprehensive Makefile for testing and validationCraig Jennings2025-11-031-0/+301
Add Makefile adapted from chime.el with targets for: Testing: - make test - Run all tests (unit + integration) - make test-unit - Run unit tests only - make test-integration - Run integration tests only - make test-file FILE=<filename> - Run specific test file - make test-name TEST=<pattern> - Run tests matching pattern Validation: - make validate-parens - Check for unbalanced parentheses - make validate-modules - Load all modules to verify compilation - make compile - Byte-compile all modules - make lint - Run checkdoc, package-lint, elisp-lint Utilities: - make profile - Profile Emacs startup - make clean - Remove test artifacts and compiled files - make clean-compiled - Remove .elc/.eln files only - make clean-tests - Remove test artifacts only - make reset - Reset to first launch (destructive!) Default target is 'make help' which displays all available targets. Inline scripts from scripts/ directory: - delete-elisp-compiled-files.sh → make clean-compiled - profile-dotemacs.sh → make profile - reset-to-first-launch.sh → make reset Delete inlined scripts to reduce duplication.