Skip to content

Fix API correctness, add tests, license and docs#1

Merged
knobo merged 5 commits into
masterfrom
improve-api-and-tests
May 30, 2026
Merged

Fix API correctness, add tests, license and docs#1
knobo merged 5 commits into
masterfrom
improve-api-and-tests

Conversation

@knobo

@knobo knobo commented May 30, 2026

Copy link
Copy Markdown
Owner

Review-driven cleanup of the cl-sysinfo bindings. All changes were verified by loading the system and running the test suite with SBCL (15/15 checks pass).

Bug fixes

  • Missing exports implemented. sysinfo-list and sysinfo-alist were exported but never defined — they now exist, derived from sysinfo so they stay in sync.
  • Misleading exports removed. The slot-name symbols (uptime, totalram, …) were exported as if they were callable functions; they weren't. package.lisp now exports only the real API.
  • loads type fixed. grovel.lisp declared loads as :long, but the C struct is unsigned long loads[3] and decode-loads reads :ulong. Now declared :ulong.
  • Unused dependency now used. local-time-duration was declared but never referenced; added uptime-duration which returns the uptime as a local-time-duration:duration.

Improvements

  • Typed condition. Generic (error "...") replaced with a sysinfo-error condition (subclass of error) exposing the syscall return code via sysinfo-error-code.
  • Tests. New cl-sysinfo/test system (FiveAM), wired in via asdf:test-system. Checks sane field values and that the plist / alist / list representations agree.
  • Docs. README now documents Linux-only support, the mem_unit byte scaling, and the full API in a field table.
  • License. Added a LICENSE file with the LLGPL preamble.

Verification

Running test suite SYSINFO-SUITE
 Did 15 checks.
    Pass: 15 (100%)  Fail: 0 (0%)

🤖 Generated with Claude Code

knobo added 5 commits May 30, 2026 13:55
- package.lisp: export only the real API; drop the slot-name symbols
  that were never defined as callable functions
- sysinfo.lisp: implement the previously-exported sysinfo-list and
  sysinfo-alist; add uptime-duration (now using the local-time-duration
  dependency); replace the generic error with a typed sysinfo-error
  condition carrying the syscall return code
- grovel.lisp: declare loads as :ulong to match the C struct and the
  reads in decode-loads
- cl-sysinfo.asd: add a FiveAM-based cl-sysinfo/test system wired up via
  test-op
- test/sysinfo-test.lisp: verify sane sysinfo values and that the plist,
  alist and list representations agree
- README.md: document Linux-only support, the mem_unit scaling, and the
  full API
- LICENSE: add the LLGPL preamble
- sysinfo.lisp: derived accessors (sysinfo-alist, sysinfo-list,
  uptime-duration) now take an optional pre-fetched plist, so callers can
  pass a single consistent snapshot (and avoid an extra syscall)
- test/sysinfo-test.lisp: representations-agree now derives all three views
  from one fetch, removing the cross-syscall flakiness; uptime-duration test
  asserts exact second equality; add a test for the sysinfo-error report
- sysinfo.lisp: sysinfo-error now captures C errno (via sb-alien on SBCL,
  NIL elsewhere) and renders strerror() text in its report; export
  sysinfo-error-errno
- sysinfo-list docstring no longer claims a fully flat list
- README: document the optional info arg and sysinfo-error-errno
- add .github/workflows/ci.yml running the suite on SBCL and CCL via Roswell
- .gitignore for fasls, ASDF/Roswell caches and editor cruft
- CHANGELOG.md (Keep a Changelog format)
- .github/dependabot.yml to keep GitHub Actions versions current
- richer .asd metadata (long-description, maintainer, homepage,
  bug-tracker, source-control) for Quicklisp/Ultralisp
- README: CI badge, changelog link, and a note about scripts/run-tests.sh
- scripts/run-tests.sh helper for running the suite locally via Roswell
The 40ants/setup-lisp action requires a LISP env var and qlot
semantics; it failed with 'Env variable LISP was not set.'. Replace it
with a direct Roswell install + ros use + scripts/run-tests.sh, mirroring
the locally-verified test invocation.
Silences the Node 20 deprecation warning.
@knobo knobo force-pushed the improve-api-and-tests branch from c362e9e to c31fd8d Compare May 30, 2026 12:22
@knobo knobo merged commit a73c5f0 into master May 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant