Skip to content

Commit d4ea984

Browse files
committed
test: port Serialization tests to Windows
These changes enable the serialization test suite to pass on Windows.
1 parent 8e38b67 commit d4ea984

10 files changed

+45
-36
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#if !BAD
2-
# import <IndirectlyImported.h>
2+
#include <IndirectlyImported.h>
33
#endif
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
#ifndef INDIRECTLY_IMPORTED_H
2+
#define INDIRECTLY_IMPORTED_H
3+
14
struct IndirectlyImportedStruct {
25
int value;
36
};
7+
8+
#endif
9+

test/Serialization/autolinking-inlinable-inferred.swift

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// RUN: %target-swift-frontend -emit-module %S/Inputs/autolinking_indirect.swift -emit-module-path %t/autolinking_indirect.swiftmodule -module-link-name autolinking_indirect -I %t -swift-version 4
88

99
// RUN: %target-swift-frontend -emit-module %S/Inputs/autolinking_module_inferred.swift -emit-module-path %t/autolinking_module_inferred.swiftmodule -module-link-name autolinking_module_inferred -I %t -swift-version 4
10-
// RUN: %target-swift-frontend -emit-ir %s -I %t -swift-version 4 | %FileCheck %s
10+
// RUN: %target-swift-frontend -emit-ir %s -I %t -swift-version 4 -enable-objc-interop | %FileCheck %s
1111

1212
// Linux uses a different autolinking mechanism, based on
1313
// swift-autolink-extract. This file tests the Darwin mechanism.
@@ -22,15 +22,15 @@ bfunc()
2222

2323
// CHECK: !llvm.linker.options = !{[[MODULE:![0-9]+]], [[PUBLIC:![0-9]+]], [[SWIFTONONESUPPORT:![0-9]+]], [[SWIFTCORE:![0-9]+]], [[PRIVATE:![0-9]+]], [[OTHER:![0-9]+]], [[INDIRECT:![0-9]+]], [[OTHER2:![0-9]+]], [[OBJC:![0-9]+]]}
2424

25-
// CHECK-DAG: [[SWIFTCORE]] = !{!"-lswiftCore"}
26-
// CHECK-DAG: [[SWIFTONONESUPPORT]] = !{!"-lswiftSwiftOnoneSupport"}
27-
// CHECK-DAG: [[MODULE]] = !{!"-lautolinking_module_inferred"}
28-
// CHECK-DAG: [[PUBLIC]] = !{!"-lautolinking_public"}
29-
// CHECK-DAG: [[OTHER]] = !{!"-lautolinking_other"}
30-
// CHECK-DAG: [[OTHER2]] = !{!"-lautolinking_other2"}
31-
// CHECK-DAG: [[OBJC]] = !{!"-lobjc"}
25+
// CHECK-DAG: [[SWIFTCORE]] = !{!{{"-lswiftCore"|"/DEFAULTLIB:swiftCore.lib"}}}
26+
// CHECK-DAG: [[SWIFTONONESUPPORT]] = !{!{{"-lswiftSwiftOnoneSupport"|"/DEFAULTLIB:swiftSwiftOnoneSupport.lib"}}}
27+
// CHECK-DAG: [[MODULE]] = !{!{{"-lautolinking_module_inferred"|"/DEFAULTLIB:autolinking_module_inferred.lib"}}}
28+
// CHECK-DAG: [[PUBLIC]] = !{!{{"-lautolinking_public"|"/DEFAULTLIB:autolinking_public.lib"}}}
29+
// CHECK-DAG: [[OTHER]] = !{!{{"-lautolinking_other"|"/DEFAULTLIB:autolinking_other.lib"}}}
30+
// CHECK-DAG: [[OTHER2]] = !{!{{"-lautolinking_other2"|"/DEFAULTLIB:autolinking_other2.lib"}}}
31+
// CHECK-DAG: [[OBJC]] = !{!{{"-lobjc"|"/DEFAULTLIB:objc.lib"}}}
3232

3333
// We don't actually care about these two. As long as we autolink the libraries
3434
// that get used, we're okay.
35-
// CHECK-DAG: [[PRIVATE]] = !{!"-lautolinking_private"}
36-
// CHECK-DAG: [[INDIRECT]] = !{!"-lautolinking_indirect"}
35+
// CHECK-DAG: [[PRIVATE]] = !{!{{"-lautolinking_private"|"/DEFAULTLIB:autolinking_private.lib"}}}
36+
// CHECK-DAG: [[INDIRECT]] = !{!{{"-lautolinking_indirect"|"/DEFAULTLIB:autolinking_indirect.lib"}}}

test/Serialization/autolinking.swift

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,25 +29,25 @@
2929
import someModule
3030

3131
// CHECK: !llvm.linker.options = !{
32-
// CHECK-DAG: !{{[0-9]+}} = !{!"-lmagic"}
33-
// CHECK-DAG: !{{[0-9]+}} = !{!"-lmodule"}
32+
// CHECK-DAG: !{{[0-9]+}} = !{!{{"-lmagic"|"/DEFAULTLIB:magic.lib"}}}
33+
// CHECK-DAG: !{{[0-9]+}} = !{!{{"-lmodule"|"/DEFAULTLIB:module.lib"}}}
3434

3535
// FRAMEWORK: !llvm.linker.options = !{
36-
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!"-lmagic"}
37-
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!"-lmodule"}
36+
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!{{"-lmagic"|"/DEFAULTLIB:magic.lib"}}}
37+
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!{{"-lmodule"|"/DEFAULTLIB:module.lib"}}}
3838
// FRAMEWORK-DAG: !{{[0-9]+}} = !{!"-framework", !"someModule"}
3939

4040
// NO-FORCE-LOAD-NOT: FORCE_LOAD
41-
// FORCE-LOAD: define void @"_swift_FORCE_LOAD_$_module"() {
41+
// FORCE-LOAD: define{{( dllexport)?}} void @"_swift_FORCE_LOAD_$_module"() {
4242
// FORCE-LOAD: ret void
4343
// FORCE-LOAD: }
44-
// FORCE-LOAD-HEX: define void @"_swift_FORCE_LOAD_$306d6f64756c65"() {
44+
// FORCE-LOAD-HEX: define{{( dllexport)?}} void @"_swift_FORCE_LOAD_$306d6f64756c65"() {
4545
// FORCE-LOAD-HEX: ret void
4646
// FORCE-LOAD-HEX: }
4747

4848
// FORCE-LOAD-CLIENT: @"_swift_FORCE_LOAD_$_module_$_autolinking" = weak hidden constant void ()* @"_swift_FORCE_LOAD_$_module"
4949
// FORCE-LOAD-CLIENT: @llvm.used = appending global [{{[0-9]+}} x i8*] [
5050
// FORCE-LOAD-CLIENT: i8* bitcast (void ()** @"_swift_FORCE_LOAD_$_module_$_autolinking" to i8*)
5151
// FORCE-LOAD-CLIENT: ], section "llvm.metadata"
52-
// FORCE-LOAD-CLIENT: declare void @"_swift_FORCE_LOAD_$_module"()
52+
// FORCE-LOAD-CLIENT: declare {{(dllimport )?}}void @"_swift_FORCE_LOAD_$_module"()
5353

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,17 @@
11
// RUN: %empty-directory(%t)
22
// RUN: %target-swift-frontend -module-name def_class -emit-module-path %t/def_class.1.swiftmodule %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module -enable-objc-interop
33
// RUN: %target-swift-frontend -module-name def_class -emit-module-path %t/def_class.2.swiftmodule %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module -enable-objc-interop
4-
// RUN: diff <(llvm-bcanalyzer -dump %t/def_class.1.swiftmodule | sed -e 's/\.[0-9]\.swiftmodule/\.x\.swiftmodule/g') <(llvm-bcanalyzer -dump %t/def_class.2.swiftmodule | sed -e 's/\.[0-9]\.swiftmodule/\.x\.swiftmodule/g')
4+
// RUN: llvm-bcanalyzer -dump %t/def_class.1.swiftmodule | sed -e 's/\.[0-9]\.swiftmodule/\.x\.swiftmodule/g' > %t.1
5+
// RUN: llvm-bcanalyzer -dump %t/def_class.2.swiftmodule | sed -e 's/\.[0-9]\.swiftmodule/\.x\.swiftmodule/g' > %t.2
6+
// RUN: cmp %t.1 %t.2
57

68
// Compiling the same set of files twice, without modifying them (and without
79
// generating inlinable SIL) should produce the same swiftmodule. We don't
810
// promise more than that at this time...
911

10-
// RUN: %S/../Inputs/getmtime.py %t/def_class.1.swiftmodule > %t/orig-mtime.txt
12+
// RUN: %{python} %S/../Inputs/getmtime.py %t/def_class.1.swiftmodule > %t/orig-mtime.txt
1113
// RUN: %target-swift-frontend -module-name def_class -emit-module-path %t/def_class.1.swiftmodule %S/Inputs/def_class.swift -disable-objc-attr-requires-foundation-module -enable-objc-interop
12-
// RUN: diff %t/orig-mtime.txt <(%S/../Inputs/getmtime.py %t/def_class.1.swiftmodule)
14+
// RUN: %{python} %S/../Inputs/getmtime.py %t/def_class.1.swiftmodule > %t.3
15+
// RUN: cmp %t/orig-mtime.txt %t.3
1316

1417
// We shouldn't re-emit the module if it hasn't changed.

test/Serialization/load-file-permissions.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// RUN: if [[ -d %t ]]; then chmod -R u+rwx %t && rm -rf %t; fi
1+
// RUN: %empty-directory(%t)
22
// RUN: %empty-directory(%t/good)
33
// RUN: %empty-directory(%t/bad)
44
// RUN: chmod a-rx %t/bad

test/Serialization/load-invalid-arch.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
// RUN: touch %t/new_module.swiftmodule/ppc65.swiftmodule
66
// RUN: touch %t/new_module.swiftmodule/i387.swiftdoc
77
// RUN: touch %t/new_module.swiftmodule/ppc65.swiftdoc
8-
// RUN: not %target-swift-frontend %s -typecheck -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=$(echo %target-swiftmodule-name | cut -d. -f1)
8+
// RUN: not %target-swift-frontend %s -typecheck -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=%target-cpu
99

1010
// RUN: %empty-directory(%t)
1111
// RUN: mkdir -p %t/new_module.framework/Modules/new_module.swiftmodule/
1212
// RUN: touch %t/new_module.framework/Modules/new_module.swiftmodule/i387.swiftmodule
1313
// RUN: touch %t/new_module.framework/Modules/new_module.swiftmodule/ppc65.swiftmodule
14-
// RUN: not %target-swift-frontend %s -F %t -typecheck -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=$(echo %target-swiftmodule-name | cut -d. -f1)
14+
// RUN: not %target-swift-frontend %s -F %t -typecheck -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=%target-cpu
1515

1616
// RUN: %empty-directory(%t)
1717
// RUN: mkdir %t/new_module.swiftmodule
18-
// RUN: not %target-swift-frontend %s -typecheck -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK-EMPTY -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=$(echo %target-swiftmodule-name | cut -d. -f1)
18+
// RUN: not %target-swift-frontend %s -typecheck -I %t -show-diagnostics-after-fatal 2>&1 | %FileCheck %s -check-prefix=CHECK-EMPTY -check-prefix CHECK-ALL -DTARGET_ARCHITECTURE=%target
1919

2020
// CHECK-ALL-NOT: error:
2121
// CHECK: {{.*}} error: could not find module 'new_module' for architecture '[[TARGET_ARCHITECTURE]]'; found: {{ppc65, i387|i387, ppc65}}

test/Serialization/search-paths-relative.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ numeric(42)
1818

1919
// CHECK-LABEL: <OPTIONS_BLOCK
2020
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '-working-directory'
21-
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '{{.+}}/secret'
21+
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '{{.+}}{{/|\\}}secret'
2222
// CHECK: <XCC abbrevid={{[0-9]+}}/> blob data = '-DDUMMY'
2323
// CHECK: </OPTIONS_BLOCK>
2424

2525
// CHECK-LABEL: <INPUT_BLOCK
26-
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=1 op1=0/> blob data = '{{.+}}/secret/../Frameworks'
27-
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=0 op1=0/> blob data = '{{.+}}/secret/.'
26+
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=1 op1=0/> blob data = '{{.+}}{{/|\\}}secret{{/|\\}}../Frameworks'
27+
// CHECK: <SEARCH_PATH abbrevid={{[0-9]+}} op0=0 op1=0/> blob data = '{{.+}}{{/|\\}}secret{{/|\\}}.'
2828
// CHECK: </INPUT_BLOCK>
2929

3030
// NEGATIVE-NOT: '.'

test/Serialization/target-incompatible.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
// RUN: %empty-directory(%t)
22

33
// RUN: %swift -target x86_64-unknown-darwin14 -o %t/mips-template.swiftmodule -parse-stdlib -emit-module -module-name mips %S/../Inputs/empty.swift
4-
// RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 mips64-unknown-darwin14 < %t/mips-template.swiftmodule > %t/mips.swiftmodule
4+
// RUN: %{python} -u %S/Inputs/binary_sub.py x86_64-unknown-darwin14 mips64-unknown-darwin14 < %t/mips-template.swiftmodule > %t/mips.swiftmodule
55
// RUN: not %target-swift-frontend -I %t -typecheck -parse-stdlib %s -DMIPS 2>&1 | %FileCheck -check-prefix=CHECK-MIPS %s
66

77
// RUN: %swift -target x86_64-unknown-darwin14 -o %t/solaris-template.swiftmodule -parse-stdlib -emit-module -module-name solaris %S/../Inputs/empty.swift
8-
// RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 x86_64-unknown-solaris8 < %t/solaris-template.swiftmodule > %t/solaris.swiftmodule
8+
// RUN: %{python} -u %S/Inputs/binary_sub.py x86_64-unknown-darwin14 x86_64-unknown-solaris8 < %t/solaris-template.swiftmodule > %t/solaris.swiftmodule
99
// RUN: not %target-swift-frontend -I %t -typecheck -parse-stdlib %s -DSOLARIS 2>&1 | %FileCheck -check-prefix=CHECK-SOLARIS %s
1010

1111
// These checks should still hold with -enable-resilience.
1212

1313
// RUN: %swift -target x86_64-unknown-darwin14 -o %t/mips-template.swiftmodule -parse-stdlib -emit-module -module-name mips %S/../Inputs/empty.swift -enable-resilience
14-
// RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 mips64-unknown-darwin14 < %t/mips-template.swiftmodule > %t/mips.swiftmodule
14+
// RUN: %{python} -u %S/Inputs/binary_sub.py x86_64-unknown-darwin14 mips64-unknown-darwin14 < %t/mips-template.swiftmodule > %t/mips.swiftmodule
1515
// RUN: not %target-swift-frontend -I %t -typecheck -parse-stdlib %s -DMIPS 2>&1 | %FileCheck -check-prefix=CHECK-MIPS %s
1616

1717
// RUN: %swift -target x86_64-unknown-darwin14 -o %t/solaris-template.swiftmodule -parse-stdlib -emit-module -module-name solaris %S/../Inputs/empty.swift -enable-resilience
18-
// RUN: %S/Inputs/binary_sub.py x86_64-unknown-darwin14 x86_64-unknown-solaris8 < %t/solaris-template.swiftmodule > %t/solaris.swiftmodule
18+
// RUN: %{python} -u %S/Inputs/binary_sub.py x86_64-unknown-darwin14 x86_64-unknown-solaris8 < %t/solaris-template.swiftmodule > %t/solaris.swiftmodule
1919
// RUN: not %target-swift-frontend -I %t -typecheck -parse-stdlib %s -DSOLARIS 2>&1 | %FileCheck -check-prefix=CHECK-SOLARIS %s
2020

2121
#if MIPS

test/Serialization/xref-nested-clang-type.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,13 @@
44

55
// RUN: %empty-directory(%t)
66
// RUN: cp %S/Inputs/xref-nested-clang-type/NestedClangTypes.h %t
7-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t -import-objc-header %t/NestedClangTypes.h -I %S/Inputs/xref-nested-clang-type/ %s -module-name Lib -DNO_MODULE
8-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %t -I %S/Inputs/xref-nested-clang-type/ -import-objc-header %t/NestedClangTypes.h %s -DCLIENT -verify
7+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %t/NestedClangTypes.h -I %S/Inputs/xref-nested-clang-type/ %s -module-name Lib -DNO_MODULE
8+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %t -I %S/Inputs/xref-nested-clang-type/ -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %t/NestedClangTypes.h %s -DCLIENT -verify
99

1010
// RUN: %empty-directory(%t)
1111
// RUN: cp %S/Inputs/xref-nested-clang-type/NestedClangTypes.h %t
12-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t -import-objc-header %t/NestedClangTypes.h -I %S/Inputs/xref-nested-clang-type/ -pch-output-dir %t/PCHCache %s -module-name Lib -DNO_MODULE
13-
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %t -I %S/Inputs/xref-nested-clang-type/ -pch-output-dir %t/PCHCache -import-objc-header %t/NestedClangTypes.h %s -DCLIENT -verify
12+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -emit-module -o %t -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %t/NestedClangTypes.h -I %S/Inputs/xref-nested-clang-type/ -pch-output-dir %t/PCHCache %s -module-name Lib -DNO_MODULE
13+
// RUN: %target-swift-frontend(mock-sdk: %clang-importer-sdk) -typecheck -I %t -I %S/Inputs/xref-nested-clang-type/ -pch-output-dir %t/PCHCache -enable-objc-interop -disable-objc-attr-requires-foundation-module -import-objc-header %t/NestedClangTypes.h %s -DCLIENT -verify
1414

1515
#if _runtime(_ObjC)
1616
import Foundation

0 commit comments

Comments
 (0)