Skip to content

Commit c3df37c

Browse files
committed
[RemoteMirror] Move interop test to the test directory, run it automatically.
Added a run of the interop test as part of the test suite.
1 parent 96dce95 commit c3df37c

File tree

5 files changed

+27
-2
lines changed

5 files changed

+27
-2
lines changed

unittests/Reflection/RemoteMirrorInterop/test.py renamed to test/RemoteMirror/Inputs/interop.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ def libPath(path):
4545
'-I', '../../../include/',
4646
'-o', '/tmp/test',
4747
'-Wall', '-Wextra',
48-
'-g', 'test.m'])
48+
'-g', 'interop.m'])
4949

5050
# Build a test library with each Swift compiler passed in.
5151
for i, (swiftc, swiftlib) in enumerate(zip(swiftcs, swiftlibs)):
5252
subprocess.check_call(
53-
['xcrun', swiftc, '-emit-library', 'test.swift',
53+
['xcrun', swiftc, '-emit-library', 'interop.swift',
5454
'-o', os.path.join('/tmp', 'libtest' + str(i) + '.dylib'),
5555
'-Xlinker', '-rpath', '-Xlinker', swiftlib])
5656

test/RemoteMirror/README.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
Remote Mirror Tests
2+
===================
3+
4+
This directory contains tests for the remote mirror code. Note in particular
5+
that the interop test that runs from here only tests the version of Swift that
6+
we are currently building. There is a script in the Inputs folder,
7+
"interop.py", that can be used to test multiple versions together.

test/RemoteMirror/interop.swift

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
// REQUIRES: OS=macosx
2+
3+
// RUN: %empty-directory(%t)
4+
// RUN: %target-build-swift %S/Inputs/interop.swift -emit-library -module-name InteropTest -o %t/%target-library-name(InteropTest)
5+
// RUN: %target-clang %S/Inputs/interop.m -framework Foundation -I %S/../../include/swift/SwiftRemoteMirror -I %S/../../include/ -o %t/InteropTest
6+
// RUN: %target-codesign %t/%target-library-name(InteropTest)
7+
// RUN: %target-codesign %t/InteropTest
8+
// RUN: %target-run %t/InteropTest %t/%target-library-name(InteropTest) %platform-module-dir/%target-library-name(swiftRemoteMirror) | %FileCheck %s
9+
10+
// CHECK: Kind:13 Size:{{[0-9]+}} Alignment:{{[0-9]+}} Stride:{{[0-9]+}} NumFields:0
11+
// CHECK-NEXT: Demangled name: InteropTest.C
12+
// CHECK-NEXT: Original metadata: 0x{{[0-9A-Fa-f]+}}
13+
// CHECK-NEXT: Looked up metadata: Metadata=0x{{[0-9A-Fa-f]+}} Library={{[0-9]+}}
14+
// CHECK-NEXT: Kind:17 Size:{{[0-9]+}} Alignment:{{[0-9]+}} Stride:{{[0-9]+}} NumFields:3
15+
// CHECK-NEXT: [0]: x Offset:{{[0-9]+}} Kind:4 Type:Swift.String (Value not displayed)
16+
// CHECK-NEXT: [1]: y Offset:{{[0-9]+}} Kind:4 Type:Swift.Int (Value not displayed)
17+
// CHECK-NEXT: [2]: e Offset:{{[0-9]+}} Kind:5 Type:InteropTest.E Value: two (1)
18+

0 commit comments

Comments
 (0)