Skip to content

Commit 461a25c

Browse files
committed
[embedded] Add %linux_rng_support_c_if_needed lit substitution
1 parent e80cc2f commit 461a25c

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

test/embedded/linkage-mergeable4.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
// RUN: %target-swift-frontend -mergeable-symbols -num-threads 2 -O -c -emit-module -o %t/MyModule.o %t/MyModule.swift -enable-experimental-feature Embedded -parse-as-library
55
// RUN: %target-swift-frontend -mergeable-symbols -num-threads 2 -O -c -o %t/MainA.o -o %t/MainB.o %t/MainA.swift %t/MainB.swift -I %t -enable-experimental-feature Embedded -parse-as-library
6-
// RUN: %target-clang %t/MainA.o %t/MainB.o %t/MyModule.o -o %t/a.out
6+
// RUN: %target-clang %linux_rng_support_c_if_needed %t/MainA.o %t/MainB.o %t/MyModule.o -o %t/a.out
77
// RUN: %target-run %t/a.out | %FileCheck %s
88

99
// REQUIRES: swift_in_compiler

test/embedded/lit.local.cfg

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,9 @@ if config.available_features.intersection(set(supported_test_os_list)) == set():
2828
config.environment = dict(config.environment)
2929
if 'SWIFT_USE_OLD_DRIVER' in config.environment: del config.environment['SWIFT_USE_OLD_DRIVER']
3030
if 'SWIFT_AVOID_WARNING_USING_OLD_DRIVER' in config.environment: del config.environment['SWIFT_AVOID_WARNING_USING_OLD_DRIVER']
31+
32+
# (5) Provide some useful substitutions to simplify writing tests that work across platforms (macOS, Linux, etc.)
33+
if "OS=linux-gnu" in config.available_features:
34+
config.substitutions.append(("%linux_rng_support_c_if_needed", "%S/Inputs/linux-rng-support.c"))
35+
else:
36+
config.substitutions.append(("%linux_rng_support_c_if_needed", ""))

0 commit comments

Comments
 (0)