Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14352] Xcode fails to run Swift unittests #56711

Closed
swift-ci opened this issue Mar 13, 2021 · 6 comments
Closed

[SR-14352] Xcode fails to run Swift unittests #56711

swift-ci opened this issue Mar 13, 2021 · 6 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.

Comments

@swift-ci
Copy link
Collaborator

Previous ID SR-14352
Radar rdar://problem/75489702
Original Reporter azarovalex (JIRA User)
Type Bug
Status Resolved
Resolution Done
Environment

macOS 11.2.2 (x86_64)
Xcode 12.4 (12D4e)
I tested on the main branch, commits 78346c2 and 9b016cb from March 13, 2021.

Additional Detail from JIRA
Votes 3
Component/s Project Infrastructure
Labels Bug
Assignee None
Priority Medium

md5: 1422d2edae7cc9892610b9fb8bad3638

Issue Description:

I cloned main branch of the Swift repo and was going through the GettingStarted documentation. On the third step it gives two commands to build toolchain and run tests: via ninja and via Xcode.
The first one works just fine and all tests complete successfully. Xcode builds the toolchain too, however it fails to run the tests.

This is the command I run:

utils/build-script --skip-build-benchmarks \
  --skip-ios --skip-watchos --skip-tvos --swift-darwin-supported-archs "$(uname -m)" \
  --sccache --release-debuginfo --swift-disable-dead-stripping --test \
  --xcode

The error I get is:

TypeLookupError.cpp:14:10: fatal error: 'gtest/gtest.h' file not found

On the other hand, everything is fine when building via ninja (same command, but without --xcode flag), or when building toolchain via Xcode without --test flag.
I've also tried to build the "check-swift-all" scheme in Xcode UI and it fails with the same error.

The full output is on gist: https://gist.github.com/azarovalex/6006f5905f737945fa0f1ed256b17220

@typesanitizer
Copy link

@swift-ci create

@swift-ci
Copy link
Collaborator Author

Comment by Ethan Guan (JIRA)

Sorry for the mistake.
I got the same problem when building the toolchain with the test option, it looks like the `gtest` framework is missing. It's not the business with our system and Xcode.

My environment:

macOS Catalina 10.15.7
Xcode 12.3 (12C33)

@swift-ci
Copy link
Collaborator Author

Comment by Samuel McBroom (JIRA)

Also experiencing this.

Environment:

macOS Catalina 10.15.7

Xcode 12.4 (12D4e)

@swift-ci
Copy link
Collaborator Author

swift-ci commented May 8, 2021

Comment by Justin Fargnoli (JIRA)

Also experiencing this.

Error messages

```

*

**

      • BUILD FAILED ***

The following build commands failed:

CompileC /Users/justinfargnoli/Documents/sources/swift-project/build/Xcode-RelWithDebInfoAssert/swift-macosx-x86_64/unittests/SourceKit/Support/Swift.build/RelWithDebInfo/SourceKitSupportTests.build/Objects-normal/x86_64/ImmutableTextBufferTest.o /Users/justinfargnoli/Documents/sources/swift-project/swift/unittests/SourceKit/Support/ImmutableTextBufferTest.cpp normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

(1 failure)

ERROR: command terminated with a non-zero exit status 65, aborting

```

```

/Users/justinfargnoli/Documents/sources/swift-project/swift/unittests/SourceKit/Support/ImmutableTextBufferTest.cpp:14:10: fatal error:

  **'gtest/gtest.h' file not found**

#include "gtest/gtest.h"

     **^\~\~\~\~\~\~\~\~\~\~\~\~\~\~**

1 error generated.

```

Environment

  • macOS 11.3.1

  • XCode 12.5

Update

I ran `brew install googletest`. This did not solve the problem. I now have the same error message as above, but for `/Users/justinfargnoli/Documents/sources/swift-project/swift/unittests/SIL/SILBitfieldTest.cpp:13:10*`*. Also, after re-running the build command it looks like the file the causes the error is different every time, but the error remains the same.

@LucianoPAlmeida
Copy link
Collaborator

This #36971 could be a fix for that issue

@swift-ci
Copy link
Collaborator Author

Comment by Alex Azarov (JIRA)

As of today the issue is resolved, I cannot reproduce it anymore.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior.
Projects
None yet
Development

No branches or pull requests

3 participants