Skip to content

sm-git: add smrunner tests for the natives and git-admin - #1

Merged
davenonymous merged 1 commit into
mainfrom
ci/smrunner-tests
Nov 27, 2026
Merged

davenonymous merged 1 commit into
mainfrom
ci/smrunner-tests

Conversation

@davenonymous

Copy link
Copy Markdown
Collaborator

Adds SourcePawn tests that run under smrunner, plus their CI wiring.

  • tests/test_git.sp (22 tests) covers:
    • opening and cloning, clone = false, URL normalization and every URL rule (Git_Refused), and fetch;
    • Resolve, ListRefs, Log with a path and since, Diff (added, modified, deleted, sorted, with a path) and ListTree (recursive, top only, a subdirectory, sizes, SHAs, the executable bit);
    • ReadFile with maxBytes, WriteFile (written only when the content differs, changes also on failure), and refusals for the root and .git-tmp names;
    • WriteDir with and without oldRev, and CompareFile (same, different, missing);
    • Git_ListRepositories with its openers and watchers, and Remove while the repository is open or watched;
    • the documented native errors, and result getters refusing a bad index or a handle of another kind.
  • tests/test_git_admin.sp (11 tests) covers sm_git clone, list, status, log, fetch and remove, the hints and usage text, and the root flag.
  • Network and fixture: every test clones https://github.com/ETF2L/sm-git into its own root, so the tests need the network. They read two fixed revisions:
    • v1.0.0;
    • the new tag smrunner-fixture, which points at this PR's commit (82602e6). It gives Log, Diff and WriteDir's deletions a second revision that never moves, and keeps that commit reachable after a squash merge. Keep both tags where they are.
  • CI: the build job runs both suites against the packed stage/ (extension, git-admin.smx, ca-bundle.crt via --file) with smrunner and smrunner64, using davenonymous/sm-runner/setup@v0 and test@v0, before the archive upload. A failure also blocks the release.
  • Lint: the lint job now also checks tests/ and runs pawntidy. scripting/ already passes it unchanged.
  • Docs: the README's Building section describes the tests, the network and tag requirement, and how to run them locally. The layout table lists tests/.

Checked locally with smrunner v0.1.0 against the v1.0.0 release (the same extension code): 22/22 and 11/11 on both runners, and lint is clean.

The unit tests cover the extension's core, but nothing checked the
natives as a plugin calls them, against a real remote: cloning,
reading, the write-out rules, watches, removal and the argument
checks, nor the sm_git command. Under smrunner they now run on every
push against the packed extension and plugin with both runners, and
a failure blocks the release.

The tests clone this repository from GitHub, so they need the
network. They read two fixed revisions: v1.0.0 and the tag
smrunner-fixture, which points at this commit, so the log, diffs
and WriteDir's deletions have a second commit that never moves.

The lint job also checks tests/ and runs pawntidy.

Assisted-By: anthropic/claude-opus-5-5
@davenonymous
davenonymous marked this pull request as ready for review November 27, 2026 13:50
@davenonymous
davenonymous merged commit 8aa32bd into main Nov 27, 2026
9 checks passed
@davenonymous
davenonymous deleted the ci/smrunner-tests branch November 27, 2026 13:50
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