Skip to content

Commit 77f18ee

Browse files
authored
Merge pull request #71153 from apple/egorzhdan/fix-split-libcxx-tests
[cxx-interop] Fix tests with split libc++ module
2 parents 4bc7726 + 997b249 commit 77f18ee

7 files changed

+53
-30
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#include <iostream>
2+
3+
int main() {
4+
#if !defined(_LIBCPP_VERSION)
5+
std::cout << "no libc++ found\n";
6+
return 1;
7+
#endif
8+
9+
#if _LIBCPP_VERSION >= 170006
10+
return 0;
11+
#else
12+
return 1;
13+
#endif
14+
}

test/Interop/Cxx/stdlib/import-string-view-from-std.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ module CxxModule {
1919

2020
import CxxModule
2121

22-
// CHECK: std-{{.*}}.pcm
22+
// CHECK: {{std|std_string_view}}-{{.*}}.pcm

test/Interop/Cxx/stdlib/libcxx-module-interface.swift

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
1-
// RUN: %target-swift-ide-test -print-module -module-to-print=CxxStdlib -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STD
2-
// RUN: %target-swift-ide-test -print-module -module-to-print=CxxStdlib -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t -module-print-submodules | %FileCheck %s -check-prefix=CHECK-STD-WITH-SUBMODULES
3-
// RUN: %target-swift-ide-test -print-module -module-to-print=CxxStdlib.iosfwd -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-IOSFWD
4-
// RUN: %target-swift-ide-test -print-module -module-to-print=CxxStdlib.string -source-filename=x -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STRING
1+
// Only run this test with older libc++, before the top-level std module got split into multiple top-level modules.
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-clangxx %S/Inputs/check-libcxx-version.cpp -o %t/check-libcxx-version
4+
// RUN: %target-codesign %t/check-libcxx-version
5+
6+
// RUN: %target-run %t/check-libcxx-version || %target-swift-ide-test -print-module -module-to-print=CxxStdlib -source-filename=x -enable-experimental-cxx-interop -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STD
7+
// RUN: %target-run %t/check-libcxx-version || %target-swift-ide-test -print-module -module-to-print=CxxStdlib -source-filename=x -enable-experimental-cxx-interop -module-cache-path %t -module-print-submodules | %FileCheck %s -check-prefix=CHECK-STD-WITH-SUBMODULES
8+
// RUN: %target-run %t/check-libcxx-version || %target-swift-ide-test -print-module -module-to-print=CxxStdlib.iosfwd -source-filename=x -enable-experimental-cxx-interop -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-IOSFWD
9+
// RUN: %target-run %t/check-libcxx-version || %target-swift-ide-test -print-module -module-to-print=CxxStdlib.string -source-filename=x -enable-experimental-cxx-interop -module-cache-path %t | %FileCheck %s -check-prefix=CHECK-STRING
510

611
// This test is specific to libc++ and therefore only runs on Darwin platforms.
712
// REQUIRES: OS=macosx || OS=ios
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// Only run this test with older libc++, before the top-level std module got split into multiple top-level modules.
2+
// RUN: %empty-directory(%t)
3+
// RUN: %target-clangxx %S/Inputs/check-libcxx-version.cpp -o %t/check-libcxx-version
4+
// RUN: %target-codesign %t/check-libcxx-version
5+
6+
// RUN: %target-swift-ide-test -print-module -module-to-print=CxxStdlib -source-filename=x -enable-experimental-cxx-interop -enable-objc-interop -module-print-submodules -enable-experimental-feature ImportSymbolicCXXDecls > %t/result.txt
7+
// RUN: %target-run %t/check-libcxx-version || %FileCheck %s --check-prefixes=CHECK,VECTOR --input-file=%t/result.txt
8+
// RUN: %target-run %t/check-libcxx-version || %FileCheck %s --check-prefixes=CHECK,STRING --input-file=%t/result.txt
9+
// RUN: %target-run %t/check-libcxx-version || %FileCheck %s --check-prefixes=CHECK,MAP --input-file=%t/result.txt
10+
11+
// REQUIRES: asserts
12+
// REQUIRES: OS=macosx
13+
14+
// CHECK: enum std {
15+
// CHECK: enum __1 {
16+
17+
// STRING: struct basic_string {
18+
19+
// STRING: typealias string = std.__1.basic_string
20+
21+
// VECTOR: struct vector {
22+
// VECTOR: mutating func push_back(_ __x: Any)
23+
// VECTOR: }
24+
25+
// MAP: struct map {
26+
27+
// CHECK-NOT: enum std

test/Interop/Cxx/stdlib/use-cxxstdlib-types-in-module-interface.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// RUN: %empty-directory(%t)
22
// RUN: split-file %s %t
33

4-
// RUN: %target-swift-ide-test -swift-version 5 -print-module -module-to-print=IncludesCxxStdlib -I %t/Inputs -source-filename=test.swift -enable-experimental-cxx-interop -tools-directory=%llvm_obj_root/bin -module-cache-path %t/cache | %FileCheck %s
4+
// RUN: %target-swift-ide-test -swift-version 5 -print-module -module-to-print=IncludesCxxStdlib -I %t/Inputs -source-filename=test.swift -enable-experimental-cxx-interop -module-cache-path %t/cache | %FileCheck %s
55

66
//--- Inputs/module.modulemap
77
module IncludesCxxStdlib {

test/Interop/Cxx/symbolic-imports/print-libcxx-symbolic-module-interface.swift

Lines changed: 0 additions & 23 deletions
This file was deleted.

test/SourceKit/InterfaceGen/gen_clang_libcxx_sdk_module.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22

33
// REQUIRES: OS=macosx
44

5-
// CHECK: import CxxStdlib.vector
5+
// CHECK: import {{CxxStdlib.vector|std_vector}}
66
// CHECK: extension std.basic_string<CChar, char_traits<CChar>, allocator<CChar>> {

0 commit comments

Comments
 (0)