Skip to content

Make the test target compile - #111

Open
hannesa2 wants to merge 6 commits into
masterfrom
make-the-test-target-compile
Open

hannesa2 wants to merge 6 commits into
masterfrom
make-the-test-target-compile

Conversation

@hannesa2

@hannesa2 hannesa2 commented Sep 28, 2026 •

Copy link
Copy Markdown

It's the same like #109 but rebased on #80 to run tests on CI

@hannesa2 hannesa2 added the test label Sep 28, 2026
hannesa2 and others added 4 commits September 28, 2026 07:32
The vendored Carthage/Checkouts/xcconfigs Base/Configurations/Debug.xcconfig
hardcodes OTHER_CODE_SIGN_FLAGS = --digest-algorithm=sha1 --timestamp=none
for every Debug build. Current codesign refuses SHA-1 outright:

    error: signing with only SHA1 not allowed. Please remove `sha1`
    from the `--digest-algorithm` code signing flag.

which was breaking ObjectiveGit-MacTests' CodeSign build phase (and
would break the ObjectiveGit-Mac framework and ObjectiveGit-iOS
target the same way, since they share the same project-level Debug
config).

Since Base/Configurations/Debug.xcconfig lives in a separate vendored
git submodule (jspahrsummers/xcconfigs) fetched fresh by
script/bootstrap on every CI run, patching it directly wouldn't
survive a bootstrap. Instead, override OTHER_CODE_SIGN_FLAGS directly
in the project's own Debug build configuration, which takes
precedence over the same key supplied by baseConfigurationReference.
Keeps --timestamp=none (skips the network-dependent Developer ID
timestamp server, still fine for local/CI ad-hoc signing) and just
drops the now-rejected --digest-algorithm=sha1.
The vendored xcconfig caps Mac targets at x86_64, which leaves the test
target with nothing valid to build on Apple Silicon.

- Override VALID_ARCHS with "x86_64 arm64" on all four test
  configurations, matching what the framework target already does.
- Without it the target produces no binary and the build stops at
  "Build input file cannot be found" before compiling a single source
  file, so none of the errors behind it were ever visible.
git_buf dropped its asize member when libgit2 1.x moved the allocated
size into reserved, so the NSData specs stopped compiling.

- Read buffer.reserved instead. git_buf_grow still writes the
  allocation size there, so all three assertions keep the meaning they
  had against 0.28.
- Leave the deprecated git_buf and git_strarray calls around them
  alone; they still resolve through deprecated.h, which carries no
  deprecation attribute, and removing them belongs with the rest of the
  shim cleanup.
Quick 7 turned the spec entry point into a class method, so self in a
spec body is now the spec class rather than the example being run, and
the fixture helpers are instance methods on QuickSpec.

- Send the fixture helpers to QuickSpec.current, the instance XCTest is
  running, so each example still gets its own temp directory.
- Give SwiftSpec the class-method signature so it overrides Quick's
  spec() again. Swift compiles first in a mixed target, so this one
  error hid every Objective-C error behind it.
- Fourteen of these were hard errors. The rest compiled only because
  clang allows any known selector on a bare Class, and would have
  raised unrecognized selector at run time.
@hannesa2
hannesa2 force-pushed the make-the-test-target-compile branch from 9a89e54 to eba1380 Compare September 28, 2026 05:33
Recent Xcode enables parallel test execution by default, running each
Quick Spec class's tests in its own process. All of those processes
share the same NSTemporaryDirectory() though, so they also share
rootTempDirectory and, within it, the cached clean_repository
directory that -setUpRepositoryFixtureIfNeeded: unzips fixtures.zip
into once and reuses across specs.

That caching checked for clean_repository's existence and unzipped
straight into it if missing. With two processes racing, one could see
the directory as soon as the other process created it (mkdir happens
before the archive's contents are fully extracted) and start copying
a fixture out of it before extraction reached that entry, e.g.:

    Couldn't copy directory Error Domain=NSCocoaErrorDomain Code=260
    "The file testrepo.git couldn't be opened because there is no
    such file."

Fix this the same way as any other read-visible-before-fully-written
race: unzip into a private, uniquely named staging directory first,
then publish it under clean_repository with a single atomic rename
(-moveItemAtPath:toPath:error:). The shared name now only ever refers
to a fully extracted directory. If another process already published
clean_repository first, our move fails because the destination
exists; in that case just discard the redundant staging copy and
proceed, since the fixtures are already there.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants