Skip to content

Commit 194fb21

Browse files
committed
Reimplement test for new parameter as Python test
Also take the chance to rename a function for clarity
1 parent bbde1af commit 194fb21

File tree

3 files changed

+23
-22
lines changed

3 files changed

+23
-22
lines changed

utils/swift_build_support/swift_build_support/products/swift.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -61,9 +61,9 @@ def __init__(self, args, toolchain, source_dir, build_dir):
6161

6262
# Add experimental string processing flag.
6363
self.cmake_options.extend(self._enable_experimental_string_processing)
64-
64+
6565
# Add freestanding related flags.
66-
self.cmake_options.extend(self._enable_freestanding_is_darwin)
66+
self.cmake_options.extend(self._freestanding_is_darwin)
6767

6868
@classmethod
6969
def is_build_script_impl_product(cls):
@@ -173,9 +173,9 @@ def _enable_stdlib_static_vprintf(self):
173173
def _enable_experimental_string_processing(self):
174174
return [('SWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL',
175175
self.args.enable_experimental_string_processing)]
176-
176+
177177
@property
178-
def _enable_freestanding_is_darwin(self):
178+
def _freestanding_is_darwin(self):
179179
return [('SWIFT_FREESTANDING_IS_DARWIN:BOOL',
180180
self.args.swift_freestanding_is_darwin)]
181181

utils/swift_build_support/tests/products/test_swift.py

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,8 @@ def setUp(self):
6262
enable_experimental_concurrency=False,
6363
enable_experimental_distributed=False,
6464
build_swift_stdlib_static_print=False,
65-
enable_experimental_string_processing=False)
65+
enable_experimental_string_processing=False,
66+
swift_freestanding_is_darwin=False)
6667

6768
# Setup shell
6869
shell.dry_run = True
@@ -97,7 +98,8 @@ def test_by_default_no_cmake_options(self):
9798
'-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=FALSE',
9899
'-DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=FALSE',
99100
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
100-
'-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=FALSE'
101+
'-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=FALSE',
102+
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
101103
]
102104
self.assertEqual(set(swift.cmake_options), set(expected))
103105

@@ -117,7 +119,8 @@ def test_swift_runtime_tsan(self):
117119
'-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY:BOOL=FALSE',
118120
'-DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED:BOOL=FALSE',
119121
'-DSWIFT_STDLIB_STATIC_PRINT=FALSE',
120-
'-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=FALSE'
122+
'-DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING:BOOL=FALSE',
123+
'-DSWIFT_FREESTANDING_IS_DARWIN:BOOL=FALSE',
121124
]
122125
self.assertEqual(set(swift.cmake_options), set(flags_set))
123126

@@ -369,3 +372,16 @@ def test_experimental_string_processing_flags(self):
369372
'TRUE'],
370373
[x for x in swift.cmake_options
371374
if 'DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING' in x])
375+
376+
def test_freestanding_is_darwin_flags(self):
377+
self.args.swift_freestanding_is_darwin = True
378+
swift = Swift(
379+
args=self.args,
380+
toolchain=self.toolchain,
381+
source_dir='/path/to/src',
382+
build_dir='/path/to/build')
383+
self.assertEqual(
384+
['-DSWIFT_FREESTANDING_IS_DARWIN:BOOL='
385+
'TRUE'],
386+
[x for x in swift.cmake_options
387+
if 'SWIFT_FREESTANDING_IS_DARWIN' in x])

validation-test/BuildSystem/swift-freestanding-is-darwin-passed-to-build-script-impl.test

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

0 commit comments

Comments
 (0)