Commit Graph

31 Commits

Author SHA1 Message Date
Slava Pestov
6939740db2 Adjust XFAILs 2024-02-24 07:25:59 -05:00
Kavon Farvardin
f296d8e158 NCGenerics: mass XFAIL tests
It's easier to get a handle on regressions while working through
failures if the tests that are known to not pass are XFAIL'd for
NoncopyableGenerics.
2024-02-20 18:26:05 -05:00
Adrian Prantl
543a2cd685 Fix caching bug in MemoryBufferSerializedModuleLoader
By populating the memory cache before loading the module, we can avoid a cycle
where a module is imported that is an overlay, which then triggers
ClangImporter, which then (redundantly) triggers the import of the overlay
module, which would reimport the module again, since it's import is still
underway and it hasn't been entered into the cache yet.

rdar://118846313
2024-02-15 14:06:28 -08:00
Evan Wilde
8b41d2b003 Reenable compat lib in a couple tests
This patch re-enables the compat library on a couple of tests. The issue
was that the compat library was pulling in compiler-rt symbols for
determining system version. That was fixed with a little dlsym action in
188c7bd626. It was using the symbols to
determine if we had voucher_needs_adopt. It just took a while to
re-enable it in these tests.
2023-07-31 15:00:55 -07:00
Evan Wilde
64b19f7f45 Backdeploy task_wait_future fix to Swift 5.6 (#61254)
* Backdeploy swift_task_future_wait

This patch adds the implementation for `swift_task_future_wait`
entrypoint to the backdeploy library.

This involves pulling in `AsyncTask::waitFuture`, which relies on a fair
bit.

Please note, this pulls in the `StaticMutex` implementation from Swift
5.6. There are some challenges here. The concurrency version of the
`StaticMutex` involves a fairly nasty set of ODR violations in the
normal setup. See `public/Concurrency/Mutex.cpp`, which includes the
Mutex implementations cpp files directly, while defining a single macro
to replace the implementation of swift::fatalError with
swift_concurrency_fatalError. We only need the concurrency mutex (at
least for now), so I have hard-coded the `swift_concurrency_fatalError`
version into this library. If we should need the other implementation,
we are forced to include ODR-related undefined behavior.

We need symbols from C++, so I've added an implicit linker flag whenever
the static library is used, namely, it passes `-lc++` to the linker.
Since we only backdeploy on Apple platforms, this should be fine.

Some of the platform runtimes we need to backdeploy to have the
enter/exitThreadLocalContext functions defined, while others don't. We
define our own backdeploy56 shim function that dlsym's the function
pointer for these symbols if we have exclusivity checking available.
Otherwise, it doesn't do anything. If concurrency exclusivity checking
is available, we'll use it, otherwise we wont'.

The same dlsym check is done for `swift_task_escalate`. Not all
platforms we need to backdeploy to have a concurrency runtime. The
symbols that do need to use pieces of the concurrency runtime should not
be getting hit when deploying to systems that don't have concurrency. In
the event that you've gotten around the language blocking you from
calling these symbols and you've managed to call concurrency pieces
without using concurrency, we'll abort because something is seriously
wrong.

* Backdeploy swift_task_future_wait_throwing

Drop the remaining pieces in for adding
`swift_task_future_wait_throwing`.

* Apply task_wait_future fix

Actually apply the fix from ef80a315f8.

This deviates slightly from the original patch.

AsyncTask::PrivateStorage::_Status() does not exist in the Swift 5.6
library. Instead I am using `AsyncTask::PrivateStorage::Status`.

* Workaround missing compiler-rt linking

Working around the missing link against compiler-rt in these test.
They are a bit brittle as if anything in them uses compiler-rt, they
will start failing. The backdeploy 5.6 library uses some symbols from
compiler-rt, thus causes them to fail to link.

Disabling the runtime compatibility version checking to avoid these
symbols. This should be fine for the MicroStdlib test, but we should fix
'%target-ld' to handle this better in the future.
rdar://100868842
2022-10-07 09:36:17 -07:00
Mishal Shah
1899d2c06b [Apple Silicon] Mark macOS tests that require x86_64 2020-07-02 16:28:41 -07:00
Doug Gregor
a1e8a35754 Update test to link against the Darwin SDK 2020-06-15 14:11:52 -07:00
Adrian Prantl
f20d567633 Fix the hardcoded Swift AST section / segment name for Mach-O
to match the one specified in LLVM's Mach-O parser.
Otherwise LLDB could not possibly find it!

This name is used by the swift -modulewrap subcommand, which is currently unused
on Darwin, and primarily intended for use under Linux. However, it may be useful
to better support static archives (.a) files with Swift debug info in the
future. To fully support this, dsymutil and LLDB need to know to look for Swift
AST sections in Mach-O objects other than .dSYM bundled.

Implementation note: It would be nice to get the section name out of libObject,
but with the current architecture this needs a major refactoring that didn't
seem justified, given that there is an end-to-end test to prevent such a mishap
in the future.

<rdar://problem/63991514>
2020-06-12 18:01:24 -07:00
Slava Pestov
38fdb6b7ff Update various tests to not use Swift 3 code
Completely mechanical changes:

- Explicit @objc in a few places
- Some imported APIs changed
- For the mix-and-match tests, just test version 4/5 instead of 3/4
2018-10-26 20:15:01 -04:00
Adrian Prantl
97cbd3b1cf Deserialize Swift compatibility version in CompilerInvocation::loadFromSerializedAST()
LLDB needs the -swift-version because the -D__swift__ macro affects
how Clang modules are built. This currently has the really odd effect
that when debugging a Swift program that is not using the very latest
Swift version, the first "po" takes several seconds, because the
module cache needs to be rebuilt.

rdar://problem/40241256
2018-08-28 13:04:27 -07:00
Davide Italiano
23d551e655 [lldb-moduleimport-test] Refactor the whole tool.
This is in preparation for fetching informations directly from
the module instead of specifying them on the cmdline. It will
serve us better as it will mimick more accurately the way lldb
is behaving.

This refactoring moves the validation of the modules earlier
so that we can use the validation info to create the CompileUnit.

<rdar://problem/38867076>
2018-03-30 18:04:02 -07:00
Davide Italiano
9ccdbc1cfa [lldb-moduleimport-test] Introduce a --verbose flag.
<rdar://problem/38323564>
2018-03-15 14:49:48 -07:00
Dmitri Gribenko
984210aa53 tests: replace '// RUN: rm -rf' '// RUN: mkdir' pairs with '%empty-directory(...)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Jordan Rose
8f820dea2b [serialization] Diagnose loading modules from older Swifts.
...with a better message than the generic "older version of the
compiler" one, when we know it's actually a different version of
Swift proper.

This still uses the same internal module version numbers to check
if the module is compatible; the presentation of language versions
is a diagnostic thing only.

Speaking of module version numbers, this deliberately does NOT
increment VERSION_MINOR; it's implemented in a backwards-compatible
way.

This will only work going forwards, of course; all existing modules
don't have a short version string, and I don't feel comfortable
assuming all older modules we might encounter are "Swift 2.2".

rdar://problem/25680392
2016-04-29 16:25:33 -07:00
Jordan Rose
4fc6cf28ca Update test for r30500.
Forgot that this also looks at -Xcc options.

Swift SVN r30503
2015-07-22 21:13:50 +00:00
David Farler
91c64fdbb1 Stop re-exporting the Objective-C library
and link it properly. This is needed to embed LLVM bitcode sections
in the standard library and overlays. The linker doesn't support
embedded bitcode and reexport flags (among others).

rdar://problem/20750099

Swift SVN r28052
2015-05-01 22:24:14 +00:00
Dmitri Hrybenko
32dbd0cfef tests: add a %target-ld substitution that is configured with stdlib paths
rdar://20474868

Swift SVN r27183
2015-04-09 22:17:24 +00:00
Dmitri Hrybenko
f87788f218 tests: remove ld-add_ast_path feature
We don't support building Swift with linkers that don't support this feature.

Swift SVN r27180
2015-04-09 21:47:55 +00:00
Dmitri Hrybenko
189eb3251e Revert "tests: use a %target-* substitution instead of calling 'ld' directly"
This reverts commit r27176.  Jordan pointed out an issue with this
approach, I'll make a different fix.

Swift SVN r27179
2015-04-09 21:11:28 +00:00
Dmitri Hrybenko
c6504366ad tests: use a %target-* substitution instead of calling 'ld' directly
rdar://20474868

Swift SVN r27176
2015-04-09 20:47:24 +00:00
Jordan Rose
6e96e26a81 Add CompilerInvocation::loadFromSerializedAST.
This is mainly for the debugger's use, to set up CompilerInvocations that
match how a particular app was compiled in certain important ways. Today
that's the target (which is also in the binary), the SDK path (which in
the long run should probably be an SDK name), and any random -Xcc options
we need to pass (which we should probably attempt to minimize).

Because there's only one target and SDK per context, and because -Xcc
options can easily conflict, this is only intended to be used once per
CompilerInvocation.

Note that search paths are not covered by this; they are already being
added at the time the module is loaded. See r24545.

Completes rdar://problem/17670778.

Swift SVN r25227
2015-02-12 05:32:37 +00:00
Jordan Rose
de8a05b293 [Serialization] Serialize the SDK path and -Xcc arguments for an app.
...so that the debugger has the best possible chance of being able to load
the app properly.

We don't do this for frameworks today because we don't want to leak this
information into the public module; once we have a distinction between
"the module that ships with the framework" and "the module that goes into
the debug info" we can do this for frameworks as well.

Part of rdar://problem/17670778

Swift SVN r25204
2015-02-11 23:07:48 +00:00
Dmitri Hrybenko
6058d291ca CMake: allow the SDK overlay to be built separately from the compiler
and the stdandard library

rdar://19703353

Swift SVN r25139
2015-02-10 21:57:03 +00:00
Dmitri Hrybenko
3b04d1b013 tests: reorganize tests so that they actually use the target platform
Most tests were using %swift or similar substitutions, which did not
include the target triple and SDK.  The driver was defaulting to the
host OS.  Thus, we could not run the tests when the standard library was
not built for OS X.

Swift SVN r24504
2015-01-19 06:52:49 +00:00
Dmitri Hrybenko
1eea220932 Use one module cache directory for all the lit tests to speed them up
Doing so is safe even though we have mock SDK.  The include paths for
modules with the same name in the real and mock SDKs are different, and
the module files will be distinct (because they will have a different
hash).

This reduces test runtime on OS X by 30% and brings it under a minute on
a 16-core machine.

This also uncovered some problems with some tests -- even when run for
iOS configurations, some tests would still run with macosx triple.  I
fixed the tests where I noticed this issue.

rdar://problem/19125022

Swift SVN r23683
2014-12-04 11:21:48 +00:00
Jordan Rose
79224874eb [Driver] Switch debug info to use ld's new -add_ast_path option.
Rather than embed AST info directly in binaries, we now include a special
symbol table entry that points to the serialized AST as a separate file.
This requires a very recent version of ld.

We still want to support the __SWIFT,__ast section in a binary because
that's how it's modeled in dSYM, so manually test both modes in
ASTSection_linker.swift.

Part of <rdar://problem/15796201>.

Swift SVN r20421
2014-07-23 18:04:10 +00:00
Jordan Rose
c72fe37e48 [test] Drop the ability to set a custom 'ld'.
It wasn't being honored by the Swift driver anyway. Use a custom PATH instead.

Swift SVN r20420
2014-07-23 18:04:08 +00:00
Ted Kremenek
fad874708e Adjust test cases.
Swift SVN r17964
2014-05-12 22:01:52 +00:00
Greg Parker
7361d116c0 [test] Add %target-cpu and %target-os substitutions. Adopt them in a few tests.
Swift SVN r13465
2014-02-05 01:05:17 +00:00