Commit Graph

40 Commits

Author SHA1 Message Date
Henrik G. Olsson
2fceb9a41d Merge pull request #84863 from ramonasuncion/test-moduleinterface-replace-find
[Test][ModuleInterface] Replace find with find_files utility
2025-10-15 23:30:37 -07:00
Ramon Asuncion
f99260cfa7 [Test][ModuleInterface] Replace find with find_files utility 2025-10-13 10:49:09 -07:00
Henrik G. Olsson
bc6a034a94 Update ModuleInterface/ModuleCache/SDKDependencies.swift (NFC)
This one `DEPCHANGE-DAG: SDKDependencies.swift` used to match because
the expansion of the `%t` temp dir contained the substring
"SDKDependencies.swift", but this is now sanitized to `TMP_DIR`.
2025-10-12 23:09:10 -07:00
Alexis Laferrière
f8d6bedfae Serialization: Consider the C++ interop use in module cache hash
It is expected to rebuild modules from swiftinterface when the C++
interop is enabled in clients. The swiftmodule produced is different.
Make sure the rebuilt module is kept under a distinct cache key to avoid
reusing previously compiled modules in an incompatible mode.
2025-08-01 16:39:28 -07:00
Alastair Houghton
71abe6f26b [Tests] Disable backtracing in some tests.
These tests can be negatively affected by the warnings about unsupported
Swift backtracer settings.

rdar://144497613
2025-02-25 10:53:28 +00:00
Meghana Gupta
b7c4ef44e0 Update some test configs where stdlib is loaded later 2024-11-12 12:05:19 -08:00
Pavel Yaskevich
2d8751badf [Frontend] Always print current compiler version in swiftinterface flags
Swiftinterface files are always built with "current" compiler version,
which means that `-swift-compiler-version` has no effect in this context.
2024-10-25 09:53:47 -07:00
Steven Wu
1eab3b585b [ModuleCache] Prefer module cache passed on the command-line for checker
When setting up the ModuleInterfaceChecker, prefer using the module
cache path from command-line invocation `-module-cache-path` before
falling back to clang options.

Usually those two yield the same result, except for LLDB under direct
cc1 argument mode and explicit module build. Under such mode, the cc1
option for module cache path will be stripped since the output PCMs are
explicit passed as output. When LLDB attempted to do an implicit module
compilation for the swift interface, it will not be able to locate the
module cache path from cc1 arguments. On the other hand, the module
cache option has already be inherited by the sub-instance so it can just
directly be located there.

rdar://137610484
2024-10-16 09:14:47 -07:00
Doug Gregor
e3c2162be2 Cope with change to default diagnostic style 2024-02-19 02:48:36 -10:00
Alexis Laferrière
86ea594f21 Serialization: apply the SDK build version as part of the cache hash
The SDK build version is a decent heuristic for expected changes in the
SDK. Any change in SDK, to clang headers in particular, can break
references from cached swiftmodules.

Track the SDK build version as part of the swiftmodule cache hash. This
will ensure we rebuild from swiftinterfaces on SDK updates.

rdar://122655978
2024-02-12 12:35:03 -08:00
Tristan Labelle
3c51106fad Fix tests on Windows CI with vs2022 2023-06-09 16:41:05 -04:00
Tristan Labelle
8155f07ca6 Fix test failure on Windows due to path separators being treated as escapes 2023-03-29 12:03:43 -04:00
Saleem Abdulrasool
4075d706a2 stdlib: remove the dependency on the injected modules
Inject the necessary module maps and apinotes via the VFS.  This cleans
up the developer build in preparation for a secondary change to remove
this need for deployed scenarios as well.  Injecting the content via the
VFS will enable us restore the ability to work with a pristine
installation of Visual Studio, dropping the custom action for the Swift
installer, and open the pathway to per-user installation of Swift.

Thanks to @bnbarham for the help and discussion in resolving the test
issues.
2023-02-28 09:40:51 -08:00
Anthony Latsis
6da51d2b2f Gardening: Migrate test suite to GH issues: ModuleInterface 2022-09-01 06:41:44 +03:00
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Josh Soref
760343f478 Spelling test moduleinterface (#58579)
* spelling: because

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: flaky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-05 16:58:25 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
Alexis Laferrière
b9eb90b443 [ModuleCache] Disable flaky module-cache-diagnostics test on Windows 2022-02-14 10:28:06 -08:00
Saleem Abdulrasool
849d5f0aaf Serialization: normalize the path before use
This normalizes the path so that we always have the mapping in normal
form.  This fixes a bug in the cross-module import tracing, allowing us
to finally enable the test on Windows.
2021-12-22 08:41:17 -08:00
Doug Gregor
568e943115 Enable import of the _Concurrency module by default. 2021-04-13 23:14:06 -07:00
Arnold Schwaighofer
9286ece71c Revert "Enable import of the _Concurrency module by default." 2021-04-09 13:20:30 -07:00
Doug Gregor
95fd3ede09 Update tests and testing tools for implicit _Concurrency import 2021-04-06 14:08:41 -07:00
Alexis Laferrière
b79c7b627b [ModuleInterface] Update wording of the "failed to build module" error
The error shown when the compiler fails to build a module from its
textual interface has been creating some confusion. This is a proposal
to make it more useful to the programmer not working in the SDK, insist
on looking at the previous errors first, put less emphasis on possible
compiler bugs, and always show alternatives to the incompatible
compilers issue as this is the most common case now.
2021-01-26 15:36:46 -08:00
Xi Ge
028a75572c ModuleInterface: remark potential version differences between SDK and prebuilt modules
Prebuilt-module directory now contains a SystemVersion.plist file copied from the SDK
it's built from. This patch teaches the compiler to remark this version and the SDK version
when -Rmodule-interface-rebuild is specified. The difference between these versions could
help us debug unusable prebuilt modules.
2020-09-04 11:45:05 -07:00
Hamish Knight
241c5d95e3 Merge pull request #32461 from hamishknight/its-all-linked 2020-07-08 11:07:17 -07:00
Mishal Shah
92ca9fc924 [Apple Silicon] Generalize tests for other macOS architectures
Most of the changes fall into a few categories:
* Replace explicit "x86_64" with %target-cpu in lit tests
* Cope with architecture differences in IR/asm/etc. macOS-specific tests
2020-07-02 16:27:46 -07:00
Hamish Knight
b3dcef9796 Avoid unnecessary linking in SIL tools
Previously we were linking in all SIL entities
if the input was a serialized non-SIB AST, and
`-disable-sil-linking` wasn't specified. However
none of the tests appear to want this behaviour.

Stop calling `SerializedSILLoader::getAll`, and
remove the `-disable-sil-linking` option, as this
is now the default behaviour.
2020-07-01 23:14:01 -07:00
3405691582
c8ba437444 [test] Handle architecture aliasing for OpenBSD.
Swift calls the architecture x86_64, OpenBSD calls it amd64. If we use
run_cpu in lit.cfg as-is, then we may need to duplicate lines in each
test for 'x86_64' and 'amd64', which puts a maintenance burden on unit
test developers to ensure they are duplicating changes to each line.

Instead, alias 'amd64' to 'x86_64' for `run_cpu`, but keep the platform
module path referring to 'amd64', in order to distinguish the target
architecture name and the Swift architecture name. This is particularly
relevant for the %target-.*-name pseudovariables used, which should
reference the Swift architecture names.

However, some unit tests are directly referencing %target-cpu directly,
which would break the aliasing. This is done only for swiftinterface
files, so a new substitution is defined in lit.cfg for these variables,
and the affected unit test cases are migrated.
2020-06-12 21:06:37 -04:00
Varun Gandhi
a1716fe2a6 [Diagnostics] Update compiler diagnostics to use less jargon. (#31315)
Fixes rdar://problem/62375243.
2020-04-28 14:11:39 -07:00
Brent Royal-Gordon
e7bd60494a Revert "[ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch."
This reverts commit 412ee0a922.
2020-04-24 13:45:05 -07:00
Doug Gregor
94e9153878 Merge pull request #31170 from DougGregor/build-module-triples
[CMake] Use proper module triples for the names of standard library modules
2020-04-23 23:57:50 -07:00
Varun Gandhi
412ee0a922 [ModuleLoader] Emit a better diagnostic for swiftinterfaces with wrong arch.
Before this change, we would emit the warning only for swiftmodules; however,
it may be the case that only a swiftinterface (of a different arch) is present
but no swiftmodule is present.

Fixes rdar://problem/50905075.
2020-04-22 23:58:54 -07:00
Doug Gregor
b27b4d4bb6 [CMake] Use proper module triples for the names of standard library modules.
The standard library (and other Swift modules built by our CMake build system)
has been building module files with an architecture only (e.g., x86_64.swiftmodule)
rather than a proper module triple (x86_86-apple-macosx10.15,
x86_64-apple-ios13.0-simulator, etc.), unlike every other build
system. There are hacks in the compiler and other tools to cope with
this unnecessary build difference. Fix the module file names so we'll
be able to remove the hacks later.

Fixes rdar://problem/49071536.
2020-04-20 21:16:14 -07:00
Brent Royal-Gordon
a7a5e340aa Improve diagnostic for broken module interfaces
Currently, when a swiftinterface file fails to load, we emit the specific diagnostics for the failures, followed by a generic “failed to load module ‘Foo’” message. This PR improves that final diagnostic, particularly when the cause may be that the interface was emitted by a newer compiler using backwards-incompatible syntax.
2020-03-13 20:31:55 -07:00
Arnold Schwaighofer
3a520e674e Disable test that fails spuriously
This test fails sometimes with something like:

SOURCE_DIR/test/ModuleInterface/ModuleCache/prebuilt-module-cache-forwarding.swift:47:8: error: malformed compiled module: BUILD_DIR/test-macosx-x86_64/ModuleInterface/ModuleCache/Output/prebuilt-module-cache-forwarding.swift.tmp/MCP/Lib-2XZQCTV44N470.swiftmodule

rdar://58578342
2020-01-15 06:04:41 -08:00
Michael Gottesman
269762eee3 [ownership] Enable ownership lowering /after/ the diagnostic passes.
I also updated the last group of straggling tests.
2019-11-17 11:34:43 -08:00
Daniel Rodríguez Troitiño
eaae6f73d7 XFAIL SDKDependencies test in Windows.
Windows paths attack again. Some paths from the dependency tracker have
mixed folder separators, so comparing textually fail. Additionally some
paths seems to be extended paths (\\?\) which seems not to be liked by
LLVM path utilities.
2019-10-17 10:09:51 -07:00
Varun Gandhi
903add2c3f [Frontend] Make the module trace emission more robust.
✔ More informative error messages in case of crashes.
✔ Handling and documenting different cases.
✔ Test cases for different cases.
✔ Make SDKDependencies.swift pass again.
2019-10-15 15:44:26 -07:00
Varun Gandhi
f969320883 Emit traces related to sdk dependencies and mark test case failing.
Exposes the issue in rdar://problem/55752426.
2019-10-11 17:23:07 -07:00
Harlan Haskins
d3b8ce7ae2 [test] Update ParseableInterface to ModuleInterface
Also remove uses of -emit-parseable-module-interface from tests
2019-09-13 14:55:48 -07:00