Skip to content

Commit

Permalink
[RemoteMirror] Move interop test to the test directory, run it automa…
Browse files Browse the repository at this point in the history
…tically.

Added a run of the interop test as part of the test suite.
  • Loading branch information
al45tair committed Jul 13, 2021
1 parent 96dce95 commit c3df37c
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 2 deletions.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ def libPath(path):
'-I', '../../../include/',
'-o', '/tmp/test',
'-Wall', '-Wextra',
'-g', 'test.m'])
'-g', 'interop.m'])

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

Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions test/RemoteMirror/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Remote Mirror Tests
===================

This directory contains tests for the remote mirror code. Note in particular
that the interop test that runs from here only tests the version of Swift that
we are currently building. There is a script in the Inputs folder,
"interop.py", that can be used to test multiple versions together.
18 changes: 18 additions & 0 deletions test/RemoteMirror/interop.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// REQUIRES: OS=macosx

// RUN: %empty-directory(%t)
// RUN: %target-build-swift %S/Inputs/interop.swift -emit-library -module-name InteropTest -o %t/%target-library-name(InteropTest)
// RUN: %target-clang %S/Inputs/interop.m -framework Foundation -I %S/../../include/swift/SwiftRemoteMirror -I %S/../../include/ -o %t/InteropTest
// RUN: %target-codesign %t/%target-library-name(InteropTest)
// RUN: %target-codesign %t/InteropTest
// RUN: %target-run %t/InteropTest %t/%target-library-name(InteropTest) %platform-module-dir/%target-library-name(swiftRemoteMirror) | %FileCheck %s

// CHECK: Kind:13 Size:{{[0-9]+}} Alignment:{{[0-9]+}} Stride:{{[0-9]+}} NumFields:0
// CHECK-NEXT: Demangled name: InteropTest.C
// CHECK-NEXT: Original metadata: 0x{{[0-9A-Fa-f]+}}
// CHECK-NEXT: Looked up metadata: Metadata=0x{{[0-9A-Fa-f]+}} Library={{[0-9]+}}
// CHECK-NEXT: Kind:17 Size:{{[0-9]+}} Alignment:{{[0-9]+}} Stride:{{[0-9]+}} NumFields:3
// CHECK-NEXT: [0]: x Offset:{{[0-9]+}} Kind:4 Type:Swift.String (Value not displayed)
// CHECK-NEXT: [1]: y Offset:{{[0-9]+}} Kind:4 Type:Swift.Int (Value not displayed)
// CHECK-NEXT: [2]: e Offset:{{[0-9]+}} Kind:5 Type:InteropTest.E Value: two (1)

0 comments on commit c3df37c

Please sign in to comment.