Closed ws233 closed 3 years ago
I can't advise you more without seeing the actual project, but if your project doesn't include any primitive operations, like + for Int, your project doesn't have any mutable points.
And also make sure that your testing-target is linked into the test target statically.
It definitely has primitive operations. I used https://github.com/muter-mutation-testing/muter this tools for checking.
It seems it's linked dynamically. Thanks.
How can I link it statically from SPM? Could you propose you test example, which was used to record demo video. StubKitTests.
The demo used https://github.com/kateinoigakukun/StubKit
I've tried with your test project and got the same result
swift build --build-tests \
-Xswiftc -embed-bitcode \
-Xswiftc -tools-directory -Xswiftc /usr/local/opt/mull-xctest/bin/mull-tools
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/BuiltinStubProvider-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/EnumStubProvider-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/StubbableProvider-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/StubKit-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/StubProvider-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/Stubbable-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/Number-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/Injector-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/Decoders-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/Misc-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.l3yvXI/String-1.bc' (No such file or directory)
[23/24] Merging module StubKit
mull-xctest .build/debug/StubKitPackageTests.xctest
[info] Warm up run (threads: 1)
[################################] 1/1. Finished in 178ms
[info] Baseline run (threads: 1)
[################################] 1/1. Finished in 36ms
[info] No mutants found. Mutation score: infinitely high
Do you have any ideas what could be wrong?
Furthermore I've found the way to build SPM with UIKit
using swift build
with the following command:
swift build --build-tests -Xswiftc -embed-bitcode -Xswiftc -tools-directory -Xswiftc /usr/local/opt/mull-xctest/bin/mull-tools -Xswiftc "-sdk" -Xswiftc "`xcrun --sdk iphonesimulator --show-sdk-path`" -Xswiftc "-target" -Xswiftc "x86_64-apple-ios14.0-simulator"
and it also produces a lot of error output of *.bc files
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/FileProviderProtocol-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/TempFileProvider-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/KeychainDataStoring-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/KeychainStorageProtocol-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/Array+SafeIndex-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/ArrayExtensions-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/CharacterSetExtension-1.bc' (No such file or directory)
<unknown>:0: error: error opening input file '/var/folders/wg/4pfx8wbs12n8kqk1pzsrzgr00000gn/T/TemporaryDirectory.LqHETI/CollectionExtension-1.bc' (No such file or directory)
and in the end there is
[249/251] Merging module PSBCore
Thank you for reporting. From my investigation, the latest swift frontend changed bitcode output file path, and it broke the mull-xctest assumption. Xcode 12.4's toolchain 5.3.2 is compatible with the latest mull-xctest, but Swift 5.5 is still incompatible. If I can take time, I'll repair this.
Thanks for your quick answer. Finally I could succeed with Xcode 12.1.
I have a swift packet with UIKit import. Unfortunately there is no way to build it using
swift build
. That's why tried 3 different ways to use mull-xctests.swift package generate-xcodeproj
. Then I build it withxcodebuild build-for-testing -project PSBCore.xcodeproj -scheme PSBCore-Package -destination "platform=iOS Simulator,name=iPhone 11 Pro" OTHER_SWIFT_FLAGS="\$(inherited) -embed-bitcode" OTHER_CFLAGS="\$(inherited) -fembed-bitcode" LD="$(which mull-ld)" OTHER_LDFLAGS="\$(inherited) -Xmull --linker=clang -Xmull --linker-flavor=clang"
. It succeed. Then when I runmull-xctestrun -Xxcodebuild -destination -Xxcodebuild "platform=iOS Simulator,name=iPhone 11 Pro" --test-target PSBCoreTests /path/to/Library/Developer/Xcode/DerivedData/PSBCore-btiytljcqmsisacjtlzuldouejsz/Build/Products/PSBCore-Package_iphonesimulator15.0-x86_64.xctestrun
and get[info] No mutants found. Mutation score: infinitely high
test
instead ofbuilding-for-testing
. After that I triedmull-xctest /path/to/Library/Developer/Xcode/DerivedData/PSBCore-btiytljcqmsisacjtlzuldouejsz/Build/Products/Debug-iphonesimulator/PSBCoreTests.xctest
. It also gives me following:why is there x86_64-apple-ios11.0-simulator? I'm using Xcode 13.0, which doesn't seem to have ios11 simulator.
What I'm doing wrong? Pls, help me.