yonaskolb / yonaskolb/XcodeGen

macOS Unit Test settings variant not present in Unit Tests

Open
#265 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Swift
Stars
8.8k
Forks
908
Avg merge
17d 14h
Merged PRs (30d)
2

Description

version: 1.7.0

Creating Unit Test target applies the same Search Paths across all targets. However, MacOS requires a different path to load XCTest Properly.

XcodeGen Preset:
BUNDLE_LOADER: $(TEST_HOST)
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/Frameworks @loader_path/Frameworks"

Running macOS Test Target produces the following Error:

2018-03-10 12:47:39.308512-0500 xctest[68591:1823752] The bundle “ResultUnitTests” couldn’t be loaded because it is damaged or missing necessary resources. Try reinstalling the bundle.
2018-03-10 12:47:39.308557-0500 xctest[68591:1823752] (dlopen_preflight(/Users/cavellebenjamin/Development/apps/Result/DerivedData/Result/Build/Products/Debug/ResultUnitTests.xctest/Contents/MacOS/ResultUnitTests): Library not loaded: @rpath/libswiftXCTest.dylib
  Referenced from: /Users/cavellebenjamin/Development/apps/Result/DerivedData/Result/Build/Products/Debug/ResultUnitTests.xctest/Contents/MacOS/ResultUnitTests
  Reason: image not found)
Program ended with exit code: 82

macOS requires:
BUNDLE_LOADER: $(TEST_HOST)
LD_RUNPATH_SEARCH_PATHS: "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks"

runs test correctly:

Test Suite 'All tests' started at 2018-03-10 12:48:35.623
Test Suite 'ResultUnitTests.xctest' started at 2018-03-10 12:48:35.625
Test Suite 'AnyErrorTests' started at 2018-03-10 12:48:35.625
Test Case '-[ResultUnitTests.AnyErrorTests testAnyError]' started.
Test Case '-[ResultUnitTests.AnyErrorTests testAnyError]' passed (0.252 seconds).
Test Suite 'AnyErrorTests' passed at 2018-03-10 12:48:35.878.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.252 (0.253) seconds
Test Suite 'NoErrorTests' started at 2018-03-10 12:48:35.879
Test Case '-[ResultUnitTests.NoErrorTests testEquatable]' started.
Test Case '-[ResultUnitTests.NoErrorTests testEquatable]' passed (0.004 seconds).
Test Suite 'NoErrorTests' passed at 2018-03-10 12:48:35.884.
	 Executed 1 test, with 0 failures (0 unexpected) in 0.004 (0.005) seconds
Test Suite 'ResultTests' started at 2018-03-10 12:48:35.884
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError]' started.
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedDescriptionToUnderlyingError]' passed (0.005 seconds).
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError]' started.
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedFailureReasonToUnderlyingError]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError]' started.
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedHelpAnchorToUnderlyingError]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError]' started.
Test Case '-[ResultUnitTests.ResultTests testAnyErrorDelegatesLocalizedRecoverySuggestionToUnderlyingError]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testBimapTransformsFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testBimapTransformsFailures]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testBimapTransformsSuccesses]' started.
Test Case '-[ResultUnitTests.ResultTests testBimapTransformsSuccesses]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheCallingFunction]' started.
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheCallingFunction]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheSourceFile]' started.
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheSourceFile]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheSourceLine]' started.
Test Case '-[ResultUnitTests.ResultTests testErrorsIncludeTheSourceLine]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testFanout]' started.
Test Case '-[ResultUnitTests.ResultTests testFanout]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testInitOptionalFailure]' started.
Test Case '-[ResultUnitTests.ResultTests testInitOptionalFailure]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testInitOptionalSuccess]' started.
Test Case '-[ResultUnitTests.ResultTests testInitOptionalSuccess]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testMapRewrapsFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testMapRewrapsFailures]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testMapTransformsSuccesses]' started.
Test Case '-[ResultUnitTests.ResultTests testMapTransformsSuccesses]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testMaterializeInferrence]' started.
Test Case '-[ResultUnitTests.ResultTests testMaterializeInferrence]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testMaterializeProducesFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testMaterializeProducesFailures]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testMaterializeProducesSuccesses]' started.
Test Case '-[ResultUnitTests.ResultTests testMaterializeProducesSuccesses]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testRecoverProducesLeftForLeftSuccess]' started.
Test Case '-[ResultUnitTests.ResultTests testRecoverProducesLeftForLeftSuccess]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testRecoverProducesRightForLeftFailure]' started.
Test Case '-[ResultUnitTests.ResultTests testRecoverProducesRightForLeftFailure]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesLeftForLeftSuccess]' started.
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesLeftForLeftSuccess]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesRightFailureForLeftFailureAndRightFailure]' started.
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesRightFailureForLeftFailureAndRightFailure]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess]' started.
Test Case '-[ResultUnitTests.ResultTests testRecoverWithProducesRightSuccessForLeftFailureAndRightSuccess]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryCatchProducesFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testTryCatchProducesFailures]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryCatchProducesSuccesses]' started.
Test Case '-[ResultUnitTests.ResultTests testTryCatchProducesSuccesses]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionCatchProducesFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionCatchProducesFailures]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionProducesSuccesses]' started.
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionProducesSuccesses]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures]' started.
Test Case '-[ResultUnitTests.ResultTests testTryCatchWithFunctionThrowingNonAnyErrorCanProducesAnyErrorFailures]' passed (0.000 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryMapProducesFailure]' started.
Test Case '-[ResultUnitTests.ResultTests testTryMapProducesFailure]' passed (0.001 seconds).
Test Case '-[ResultUnitTests.ResultTests testTryMapProducesSuccess]' started.
Test Case '-[ResultUnitTests.ResultTests testTryMapProducesSuccess]' passed (0.001 seconds).
Test Suite 'ResultTests' passed at 2018-03-10 12:48:35.923.
	 Executed 29 tests, with 0 failures (0 unexpected) in 0.020 (0.039) seconds
Test Suite 'ResultUnitTests.xctest' passed at 2018-03-10 12:48:35.923.
	 Executed 31 tests, with 0 failures (0 unexpected) in 0.276 (0.299) seconds
Test Suite 'All tests' passed at 2018-03-10 12:48:35.924.
	 Executed 31 tests, with 0 failures (0 unexpected) in 0.276 (0.301) seconds
Program ended with exit code: 0

Test session log:
	/var/folders/h8/2l1nf2ss5qqfblyby0tnl7sm0000gn/T/com.apple.dt.XCTest/IDETestRunSession-F74C566C-5406-4413-899C-CCBD4F3C7B4E/ResultUnitTests-622BB77C-E83A-405E-9EE1-90C2CF84FDC7/Session-ResultUnitTests-2018-03-10_124833-yGHKAA.log

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the XcodeGen Preset handling that applies Search Paths and unit-test target settings, then reproduce the macOS test-target failure described in the issue. Done means generated macOS test targets use the specified @executable_path/../Frameworks and @loader_path/../Frameworks paths, and the unit tests run successfully without the libswiftXCTest.dylib error.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, testing
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.