Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ if(NOT "${COVERAGE_DB}" STREQUAL "")
COMMENT "Touching covering tests")
endif()

include(CheckIncludeFileCXX)
check_include_file_cxx("span" HAVE_STD_SPAN)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@etcwilde @egorzhdan Could you check my logic here - is this approach sound? Or does this need to be checked for every test target? Is CMake aware of multiple different SDKs when testing multiple different targets?

Perhaps I'm overthinking it - I never use multiple test targets, so that feature is a bit outside my wheelhouse. I can't think of a case where we would realistically test against one target without std::span and one with, but I thought I'd highlight it.


foreach(SDK ${SWIFT_SDKS})
foreach(ARCH ${SWIFT_SDK_${SDK}_ARCHITECTURES})
# macCatalyst needs to run two sets of tests: one with the normal macosx target triple
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// REQUIRES: rdar162106643

// RUN: rm -rf %t
// RUN: split-file %s %t

// RUN: %target-swift-frontend -emit-ir -I %swift_src_root/lib/ClangImporter/SwiftBridging -plugin-path %swift-plugin-dir %t/blessed.swift -module-name main -I %t/Inputs -o %t/out -Xcc -std=c++20 -cxx-interoperability-mode=default -enable-experimental-feature SafeInteropWrappers -verify

// REQUIRES: swift_feature_SafeInteropWrappers
// REQUIRES: std_span

//--- Inputs/swiftify-non-public.h
#pragma once
Expand Down
1 change: 1 addition & 0 deletions test/Interop/Cxx/class/safe-interop-mode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

// REQUIRES: objc_interop
// REQUIRES: swift_feature_LifetimeDependence
// REQUIRES: std_span

//--- Inputs/module.modulemap
module Test {
Expand Down
2 changes: 1 addition & 1 deletion test/Interop/Cxx/stdlib/std-span-interface.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

// REQUIRES: swift_feature_SafeInteropWrappers
// REQUIRES: swift_feature_Lifetimes
// REQUIRES: rdar161999174
// REQUIRES: std_span

#if !BRIDGING_HEADER
import StdSpan
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// REQUIRES: rdar162106653

// RUN: %target-run-simple-swift(-plugin-path %swift-plugin-dir -I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -swift-version 6 -Xfrontend -disable-availability-checking -Xcc -std=c++20 -enable-experimental-feature LifetimeDependence -enable-experimental-feature SafeInteropWrappers)

// TODO: test failed in Windows PR testing: rdar://144384453
Expand All @@ -9,6 +7,7 @@
// REQUIRES: swift_feature_LifetimeDependence

// REQUIRES: executable_test
// REQUIRES: std_span

#if !BRIDGING_HEADER
import StdSpan
Expand Down
3 changes: 1 addition & 2 deletions test/Interop/Cxx/stdlib/use-std-span-typechecker.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// REQUIRES: rdar162106722

// RUN: %target-typecheck-verify-swift -I %S/Inputs -enable-experimental-cxx-interop -Xcc -std=c++20 2>&1
// REQUIRES: std_span

import StdSpan

Expand Down
3 changes: 1 addition & 2 deletions test/Interop/Cxx/stdlib/use-std-span.swift
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
// REQUIRES: rdar162106580

// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20)
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -enable-experimental-cxx-interop -Xcc -std=c++20 -Xcc -D_LIBCPP_HARDENING_MODE=_LIBCPP_HARDENING_MODE_DEBUG)

// TODO: test failed in Windows PR testing: rdar://144384453
// UNSUPPORTED: OS=windows-msvc

// REQUIRES: executable_test
// REQUIRES: std_span

import StdlibUnittest
#if !BRIDGING_HEADER
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// REQUIRES: rdar162106619

// REQUIRES: swift_feature_SafeInteropWrappers
// REQUIRES: std_span

// RUN: %empty-directory(%t)
// RUN: split-file %s %t
Expand Down
3 changes: 1 addition & 2 deletions test/Interop/Cxx/swiftify-import/span-in-ctor.swift
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// REQUIRES: rdar162106747

// REQUIRES: swift_feature_SafeInteropWrappers
// REQUIRES: std_span

// RUN: rm -rf %t
// RUN: split-file %s %t
Expand Down
4 changes: 2 additions & 2 deletions test/Interop/CxxToSwiftToCxx/span/span-execution.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@
// RUN: %target-run %t/swift-cxx-execution | %FileCheck %s

// REQUIRES: executable_test

// REQUIRES: OS=macosx || rdar-161999258
// REQUIRES: std_span

//--- header.h
#include <cstdint>
#include <string>
#include <span>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

// RUN: %target-swift-frontend %s -enable-experimental-cxx-interop -I %S/Inputs -Xcc -std=c++20 -swift-version 5 -module-name main -disable-availability-checking -typecheck -plugin-path %swift-plugin-dir -dump-macro-expansions -verify -strict-memory-safety 2>&1 | %FileCheck --match-full-lines %s

// FIXME swift-ci linux tests do not support std::span
// UNSUPPORTED: OS=linux-gnu
// REQUIRES: std_span

import CxxStdlib
import StdSpan
Expand Down
3 changes: 1 addition & 2 deletions test/Macros/SwiftifyImport/CxxSpan/NoEscapeSpan.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

// RUN: %target-swift-frontend %s -cxx-interoperability-mode=default -I %S/Inputs -Xcc -std=c++20 -swift-version 5 -module-name main -disable-availability-checking -typecheck -enable-experimental-feature Lifetimes -plugin-path %swift-plugin-dir -strict-memory-safety -warnings-as-errors -dump-macro-expansions 2>&1 | %FileCheck --match-full-lines %s

// FIXME swift-ci linux tests do not support std::span
// UNSUPPORTED: OS=linux-gnu
// REQUIRES: std_span

import CxxStdlib
import StdSpan
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// Now make sure we emit the correct interface for std::span if C++20 is enabled.
// RUN: %sourcekitd-test -req=interface-gen -module UsesCXX20 -- -cxx-interoperability-mode=default -Xfrontend -disable-implicit-concurrency-module-import -Xfrontend -disable-implicit-string-processing-module-import -I %S/Inputs -target %target-triple -sdk %sdk -Xcc -std=c++20 | %FileCheck %s

// FIXME: older libstdc++ version on Swift CI does not support C++20
// UNSUPPORTED: OS=linux-gnu
// REQUIRES: std_span

// CHECK: public typealias MySpanOfInt = std.span<
3 changes: 3 additions & 0 deletions test/lit.site.cfg.in
Original file line number Diff line number Diff line change
Expand Up @@ -182,3 +182,6 @@ if config.test_exec_root is None:
lit_config.load_config(config, os.path.join(config.test_exec_root, "lit.swift-features.cfg"))
lit_config.load_config(
config, os.path.join(config.swift_src_root, "test", "lit.cfg"))

if '@HAVE_STD_SPAN@' == '1':
config.available_features.add('std_span')