Skip to content

Commit 03829ce

Browse files
committed
Updated tests
1 parent 056b17d commit 03829ce

8 files changed

+22
-19
lines changed

test/ModuleInterface/ossa-modules/Inputs/sdk-test-stdlib-no-ossa-referent-with-rebuild-remark.swift

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11

22
import Swift // expected-remark {{rebuilding module 'Swift'}}
3+
// expected-note @-1 {{compiled module is out of date}}
4+
// expected-note @-2 {{unable to load compiled module}}
5+
// expected-note @-3 {{prebuilt module is out of date}}
6+
// expected-note @-4 {{unable to load compiled module}}
37

48
func main() {
59
let f = foo() // expected-warning {{initialization of immutable value 'f' was never used}}

test/ModuleInterface/ossa-modules/different-modes-have-different-hashes.swift

+4-3
Original file line numberDiff line numberDiff line change
@@ -68,16 +68,18 @@
6868
// RUN: %target-swift-frontend -typecheck -sdk '' -module-cache-path %t/MCP.default -parse-stdlib -I %t %t/test.default.remark.swift -Rmodule-interface-rebuild -verify
6969
// RUN: ls %t/MCP.default | count 3
7070
// RUN: %target-swift-frontend -typecheck -sdk '' -module-cache-path %t/MCP.default -parse-stdlib -I %t %t/test.default.swift -Rmodule-interface-rebuild -verify
71-
// RUN: %target-sil-opt -module-name SwiftModuleDefault %t/MCP.default/*.swiftmodule | grep '@$s18SwiftModuleDefault3fooAA5KlassCyF' | grep '[[]ossa[]]'
71+
// RUN: %target-sil-opt -module-name SwiftModuleDefault %t/MCP.default/*.swiftmodule > %t/MCP.default/old/first.sil
72+
// RUN: cat %t/MCP.default/old/first.sil | grep '@$s18SwiftModuleDefault3fooAA5KlassCyF' | grep '[[]ossa[]]'
7273
// RUN: mv %t/MCP.default/*.swiftmodule %t/MCP.default/old
7374
// RUN: ls %t/MCP.default | count 2
7475
// RUN: %target-swift-frontend -typecheck -sdk '' -enable-ossa-modules -module-cache-path %t/MCP.default -parse-stdlib -I %t %t/test.default.remark.swift -Rmodule-interface-rebuild -verify
7576
// RUN: ls %t/MCP.default | count 3
7677
// RUN: %target-swift-frontend -typecheck -sdk '' -enable-ossa-modules -module-cache-path %t/MCP.default -parse-stdlib -I %t %t/test.default.swift -Rmodule-interface-rebuild -verify
7778
// RUN: ls %t/MCP.default | count 3
79+
// RUN: %target-sil-opt -module-name SwiftModuleDefault %t/MCP.default/*.swiftmodule > %t/MCP.default/second.sil
7880
//
7981
// These should be the same.
80-
// RUN: diff -u %t/MCP.default/*.swiftmodule %t/MCP.default/old/*.swiftmodule
82+
// RUN: diff -u %t/MCP.default/old/first.sil %t/MCP.default/second.sil
8183
//
8284
// But their actual names should be different since the hash is in the file name.
8385
// RUN: cd %t/MCP.default && ls *.swiftmodule > %t/MCP.default/firstFile
@@ -103,7 +105,6 @@
103105
// RUN: ls %t/MCP.Onone | count 3
104106
//
105107
// These should be the same.
106-
// RUN: diff -u %t/MCP.Onone/*.swiftmodule %t/MCP.Onone/old/*.swiftmodule
107108
//
108109
// But their name should be different
109110
// RUN: cd %t/MCP.Onone && ls *.swiftmodule > %t/MCP.Onone/firstFile

test/ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift

+2-6
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,9 @@
2121

2222
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify
2323

24-
// In this case, we should rebuild.
24+
// In this case also, we should not rebuild.
2525

26-
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-with-rebuild-remark.swift -verify -enable-ossa-modules
27-
28-
// Make sure the rebuild is in OSSA.
29-
30-
// RUN: %target-sil-opt -module-name Swift %t/PreBuiltSDKModules/Swift.swiftmodule/*.swiftmodule | grep '@$ss3foos5KlassCyF' | grep '[[]ossa[]]'
26+
// RUN: %target-swift-frontend -typecheck -sdk '%t/SDK' -prebuilt-module-cache-path '%t/PreBuiltSDKModules' -module-cache-path %t/TempModuleCacheOther -resource-dir '' -parse-stdlib -Rmodule-interface-rebuild %S/Inputs/sdk-test-stdlib-no-ossa-referent-no-rebuild-remark.swift -verify -enable-ossa-modules
3127

3228
// Flacky hangs: rdar://77288690
3329
// UNSUPPORTED: CPU=arm64, CPU=arm64e

unittests/ClangImporter/ClangImporterTests.cpp

+2-1
Original file line numberDiff line numberDiff line change
@@ -70,14 +70,15 @@ TEST(ClangImporterTest, emitPCHInMemory) {
7070
// Set up the importer and emit a bridging PCH.
7171
swift::LangOptions langOpts;
7272
langOpts.Target = llvm::Triple("x86_64", "apple", "darwin");
73+
swift::SILOptions silOpts;
7374
swift::TypeCheckerOptions typeckOpts;
7475
INITIALIZE_LLVM();
7576
swift::SearchPathOptions searchPathOpts;
7677
swift::symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
7778
swift::SourceManager sourceMgr;
7879
swift::DiagnosticEngine diags(sourceMgr);
7980
std::unique_ptr<ASTContext> context(
80-
ASTContext::get(langOpts, typeckOpts, searchPathOpts, options,
81+
ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts, options,
8182
symbolGraphOpts, sourceMgr, diags));
8283
auto importer = ClangImporter::create(*context);
8384

unittests/FrontendTool/ModuleLoadingTests.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -103,9 +103,8 @@ class ModuleInterfaceLoaderTest : public testing::Test {
103103
ClangImporterOptions clangImpOpts;
104104
symbolgraphgen::SymbolGraphOptions symbolGraphOpts;
105105
SILOptions silOpts;
106-
auto ctx =
107-
ASTContext::get(langOpts, typeckOpts, searchPathOpts, clangImpOpts,
108-
symbolGraphOpts, sourceMgr, diags);
106+
auto ctx = ASTContext::get(langOpts, typeckOpts, silOpts, searchPathOpts,
107+
clangImpOpts, symbolGraphOpts, sourceMgr, diags);
109108

110109
ctx->addModuleInterfaceChecker(
111110
std::make_unique<ModuleInterfaceCheckerImpl>(*ctx, cacheDir,
@@ -149,7 +148,8 @@ class ModuleInterfaceLoaderTest : public testing::Test {
149148
ASSERT_TRUE(bufOrErr);
150149

151150
auto bufData = (*bufOrErr)->getBuffer();
152-
auto validationInfo = serialization::validateSerializedAST(bufData);
151+
auto validationInfo = serialization::validateSerializedAST(
152+
bufData, silOpts.EnableOSSAModules);
153153
ASSERT_EQ(serialization::Status::Valid, validationInfo.status);
154154
ASSERT_EQ(bufData, moduleBuffer->getBuffer());
155155
}

unittests/Parse/TokenizerTests.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ class TokenizerTest : public ::testing::Test {
8282
}
8383

8484
std::vector<Token> parseAndGetSplitTokens(unsigned BufID) {
85-
swift::ParserUnit PU(SM, SourceFileKind::Main, BufID,
86-
LangOpts, TypeCheckerOptions(), "unknown");
85+
swift::ParserUnit PU(SM, SourceFileKind::Main, BufID, LangOpts,
86+
TypeCheckerOptions(), SILOptions(), "unknown");
8787
SmallVector<Decl *, 8> decls;
8888
PU.getParser().parseTopLevel(decls);
8989
return PU.getParser().getSplitTokens();

unittests/Sema/SemaFixture.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ using namespace swift::unittest;
2929
using namespace swift::constraints::inference;
3030

3131
SemaTest::SemaTest()
32-
: Context(*ASTContext::get(LangOpts, TypeCheckerOpts, SearchPathOpts,
33-
ClangImporterOpts, SymbolGraphOpts,
34-
SourceMgr, Diags)) {
32+
: Context(*ASTContext::get(LangOpts, TypeCheckerOpts, SILOpts,
33+
SearchPathOpts, ClangImporterOpts,
34+
SymbolGraphOpts, SourceMgr, Diags)) {
3535
INITIALIZE_LLVM();
3636

3737
registerParseRequestFunctions(Context.evaluator);

unittests/Sema/SemaFixture.h

+1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ class SemaTestBase : public ::testing::Test {
3838
public:
3939
LangOptions LangOpts;
4040
TypeCheckerOptions TypeCheckerOpts;
41+
SILOptions SILOpts;
4142
SearchPathOptions SearchPathOpts;
4243
ClangImporterOptions ClangImporterOpts;
4344
symbolgraphgen::SymbolGraphOptions SymbolGraphOpts;

0 commit comments

Comments
 (0)