Skip to content

Commit d9f5232

Browse files
authored
Merge pull request #15211 from davezarzycki/formalize_stress_tests
[Testing] Formalize stress tests
2 parents c8eb12b + dc22a4d commit d9f5232

27 files changed

+55
-8
lines changed

docs/Testing.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ The testsuite is split into four subsets:
3333
* Validation testsuite, located under ``swift/validation-test``.
3434
* Unit tests, located under ``swift/unittests``.
3535
* Long tests, which are marked with ``REQUIRES: long_test``.
36+
* Stress tests, which are marked with ``REQUIRES: stress_test``.
3637

3738
### Running the LLVM lit-based testsuite
3839

@@ -126,8 +127,9 @@ Besides ``check-swift``, other targets are also available. Here's the full list:
126127

127128
* ``check-swift``: Runs tests from the ``${SWIFT_SOURCE_ROOT}/test`` directory.
128129
* ``check-swift-only_validation``: Runs tests from the ``${SWIFT_SOURCE_ROOT}/validation-test`` directory.
129-
* ``check-swift-validation``: Runs the primary and validation tests, without the long tests.
130+
* ``check-swift-validation``: Runs the primary and validation tests, without the long tests or stress tests.
130131
* ``check-swift-only_long``: Runs long tests only.
132+
* ``check-swift-only_stress``: Runs stress tests only.
131133
* ``check-swift-all``: Runs all tests (primary, validation, and long).
132134
* ``SwiftUnitTests``: Builds all unit tests. Executables are located under
133135
``${SWIFT_BUILD_DIR}/unittests`` and must be run individually.

test/CMakeLists.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ set(TEST_SUBSETS
146146
all
147147
only_validation
148148
only_long
149+
only_stress
149150
)
150151

151152
if(NOT "${COVERAGE_DB}" STREQUAL "")
@@ -271,12 +272,14 @@ foreach(SDK ${SWIFT_SDKS})
271272
if((test_subset STREQUAL "primary") OR
272273
(test_subset STREQUAL "validation") OR
273274
(test_subset STREQUAL "only_long") OR
275+
(test_subset STREQUAL "only_stress") OR
274276
(test_subset STREQUAL "all"))
275277
list(APPEND directories "${test_bin_dir}")
276278
endif()
277279
if((test_subset STREQUAL "validation") OR
278280
(test_subset STREQUAL "only_validation") OR
279281
(test_subset STREQUAL "only_long") OR
282+
(test_subset STREQUAL "only_stress") OR
280283
(test_subset STREQUAL "all"))
281284
list(APPEND directories "${validation_test_bin_dir}")
282285
list(APPEND dependencies ${validation_test_dependencies})

test/Unit/lit.cfg

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ elif swift_test_subset == 'only_long':
5858
# FIXME: this doesn't exclude not-long tests from the only_long subset.
5959
# Currently those tests are very fast so it doesn't matter much.
6060
pass
61+
elif swift_test_subset == 'only_stress':
62+
# FIXME: this doesn't exclude not-stress tests from the only_stress subset.
63+
# Currently those tests are very fast so it doesn't matter much.
64+
pass
6165
else:
6266
lit_config.fatal("Unknown test mode %r" % swift_test_subset)
6367

test/lit.cfg

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -504,10 +504,15 @@ if swift_test_subset in ['primary', 'validation', 'only_validation']:
504504
pass
505505
elif swift_test_subset == 'all':
506506
config.available_features.add("long_test")
507+
config.available_features.add("stress_test")
507508
elif swift_test_subset == 'only_long':
508509
config.available_features.add("long_test")
509510
config.limit_to_features.add("long_test")
510511
config.limit_to_features.discard("executable_test")
512+
elif swift_test_subset == 'only_stress':
513+
config.available_features.add("stress_test")
514+
config.limit_to_features.add("stress_test")
515+
config.limit_to_features.discard("executable_test")
511516
else:
512517
lit_config.fatal("Unknown test mode %r" % swift_test_subset)
513518

utils/build-presets.ini

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ mixin-preset=
236236
test=0
237237
validation-test=0
238238
long-test=1
239+
stress-test=1
239240
test-optimized=0
240241

241242

@@ -747,6 +748,7 @@ release
747748
test
748749
validation-test
749750
long-test
751+
stress-test
750752
test-optimized
751753
foundation
752754
libdispatch
@@ -822,6 +824,7 @@ release
822824
test
823825
validation-test
824826
long-test
827+
stress-test
825828
foundation
826829
lit-args=-v
827830

@@ -892,6 +895,7 @@ mixin-preset=buildbot_incremental_linux
892895
test=0
893896
validation-test=0
894897
long-test=1
898+
stress-test=1
895899
test-optimized=0
896900

897901
[preset: buildbot_incremental_linux,llvm-only]
@@ -901,6 +905,7 @@ build-subdir=buildbot_incremental_llvmonly
901905
test=0
902906
validation-test=0
903907
long-test=0
908+
stress-test=0
904909
test-optimized=0
905910

906911
dash-dash
@@ -1022,6 +1027,7 @@ watchos
10221027
test
10231028
validation-test
10241029
long-test
1030+
stress-test
10251031

10261032
dash-dash
10271033

utils/build-script

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,12 @@ class HostSpecificConfiguration(object):
154154
test = False
155155

156156
if build:
157-
# Validation and long tests require building the full standard
158-
# library, whereas the other targets can build a slightly
159-
# smaller subset which is faster to build.
157+
# Validation, long, and stress tests require building the full
158+
# standard library, whereas the other targets can build a
159+
# slightly smaller subset which is faster to build.
160160
if args.build_swift_stdlib_unittest_extra or \
161-
args.validation_test or args.long_test:
161+
args.validation_test or args.long_test or \
162+
args.stress_test:
162163
self.swift_stdlib_build_targets.append(
163164
"swift-stdlib-" + name)
164165
else:
@@ -184,12 +185,15 @@ class HostSpecificConfiguration(object):
184185
else:
185186
suffix = ""
186187
subset_suffix = ""
187-
if args.validation_test and args.long_test:
188+
if args.validation_test and args.long_test and \
189+
args.stress_test:
188190
subset_suffix = "-all"
189191
elif args.validation_test:
190192
subset_suffix = "-validation"
191193
elif args.long_test:
192194
subset_suffix = "-only_long"
195+
elif args.stress_test:
196+
subset_suffix = "-only_stress"
193197
else:
194198
subset_suffix = ""
195199
self.swift_test_run_targets.append("check-swift{}{}-{}".format(
@@ -635,7 +639,7 @@ class BuildScriptInvocation(object):
635639
if not args.build_android:
636640
impl_args += ["--skip-build-android"]
637641

638-
if not args.test and not args.long_test:
642+
if not args.test and not args.long_test and not args.stress_test:
639643
impl_args += ["--skip-test-swift"]
640644
if not args.test:
641645
impl_args += ["--skip-test-cmark",
@@ -677,6 +681,8 @@ class BuildScriptInvocation(object):
677681
impl_args += ["--validation-test"]
678682
if args.long_test:
679683
impl_args += ["--long-test"]
684+
if args.stress_test:
685+
impl_args += ["--stress-test"]
680686
if not args.benchmark:
681687
impl_args += ["--skip-test-benchmarks"]
682688
if not args.test_optimized:

utils/build-script-impl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ KNOWN_SETTINGS=(
153153
skip-test-android-host "" "set to skip testing the host parts of the Android toolchain"
154154
validation-test "0" "set to run the validation test suite"
155155
long-test "0" "set to run the long test suite"
156+
stress-test "0" "set to run the stress test suite"
156157
test-paths "" "run tests located in specific directories and/or files"
157158
skip-test-benchmarks "" "set to skip running Swift Benchmark Suite"
158159
skip-test-optimized "" "set to skip testing the test suite in optimized mode"

utils/build_swift/driver_arguments.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,9 @@ def create_argument_parser():
703703
option('--long-test', toggle_true,
704704
help='run the long test suite')
705705

706+
option('--stress-test', toggle_true,
707+
help='run the stress test suite')
708+
706709
option('--host-test', toggle_true,
707710
help='run executable tests on host devices (such as iOS or tvOS)')
708711

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@
149149
'show_sdks': False,
150150
'skip_build': False,
151151
'stdlib_deployment_targets': None,
152+
'stress_test': False,
152153
'swift_analyze_code_coverage': defaults.SWIFT_ANALYZE_CODE_COVERAGE,
153154
'swift_assertions': True,
154155
'swift_build_variant': 'Debug',
@@ -423,6 +424,7 @@ class IgnoreOption(_BaseOption):
423424
EnableOption('--libicu', dest='build_libicu'),
424425
EnableOption('--long-test'),
425426
EnableOption('--show-sdks'),
427+
EnableOption('--stress-test'),
426428
EnableOption('--test'),
427429
EnableOption('--test-optimize-for-size'),
428430
EnableOption('--test-optimized'),

utils/build_swift/tests/test_driver_arguments.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,7 @@ def test_implied_defaults_skip_all_tests(self):
645645
'--test', '0',
646646
'--validation-test', '0',
647647
'--long-test', '0',
648+
'--stress-test', '0',
648649
])
649650

650651
self.assertFalse(namespace.test_linux)

utils/run-test

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ TEST_SUBSETS = [
4242
'all',
4343
'only_validation',
4444
'only_long',
45+
'only_stress',
4546
]
4647

4748
SWIFT_SOURCE_DIR = os.path.join(SWIFT_SOURCE_ROOT, 'swift')

test/Runtime/weak-reference-racetests-dispatch.swift renamed to validation-test/Runtime/weak-reference-racetests-dispatch.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3-
3+
// REQUIRES: stress_test
44
// REQUIRES: objc_interop
55

66
import StdlibUnittest

test/Runtime/weak-reference-racetests.swift renamed to validation-test/Runtime/weak-reference-racetests.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3+
// REQUIRES: stress_test
34
// UNSUPPORTED: nonatomic_rc
45

56
import StdlibUnittest

test/SILOptimizer/string_switch.swift renamed to validation-test/SILOptimizer/string_switch.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// RUN: %target-build-swift -O %s -module-name=test -Xllvm -sil-disable-pass=FunctionSignatureOpts -emit-sil | %FileCheck %s
33
// RUN: %target-run %t.out
44
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
5+
// REQUIRES: stress_test
56
// UNSUPPORTED: nonatomic_rc
67

78
import StdlibUnittest

test/Sanitizers/tsan-ignores-arc-locks.swift renamed to validation-test/Sanitizers/tsan-ignores-arc-locks.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-build-swift -target %sanitizers-target-triple -sanitize=thread %s -o %t_binary
22
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
33
// REQUIRES: executable_test
4+
// REQUIRES: stress_test
45
// REQUIRES: tsan_runtime
56
// REQUIRES: objc_interop
67

test/Sanitizers/tsan-inout.swift renamed to validation-test/Sanitizers/tsan-inout.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: not env %env-TSAN_OPTIONS=abort_on_error=0 %target-run %t/tsan-binary 2>&1 | %FileCheck %s
77
// RUN: not env %env-TSAN_OPTIONS=abort_on_error=0:ignore_interceptors_accesses=0 %target-run %t/tsan-binary 2>&1 | %FileCheck %s --check-prefix CHECK-INTERCEPTORS-ACCESSES
88
// REQUIRES: executable_test
9+
// REQUIRES: stress_test
910
// REQUIRES: objc_interop
1011
// REQUIRES: tsan_runtime
1112

test/Sanitizers/tsan-type-metadata.swift renamed to validation-test/Sanitizers/tsan-type-metadata.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-swiftc_driver -target %sanitizers-target-triple -sanitize=thread %s -o %t_binary
22
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
33
// REQUIRES: executable_test
4+
// REQUIRES: stress_test
45
// REQUIRES: objc_interop
56
// REQUIRES: tsan_runtime
67

test/Sanitizers/witness_table_lookup.swift renamed to validation-test/Sanitizers/witness_table_lookup.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-build-swift -sanitize=thread -target %sanitizers-target-triple %s -o %t_binary
22
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
33
// REQUIRES: executable_test
4+
// REQUIRES: stress_test
45
// REQUIRES: tsan_runtime
56

67
// https://bugs.swift.org/browse/SR-6622

validation-test/StdlibUnittest/RaceTest.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-build-swift -Xfrontend -disable-access-control -module-name a %s -o %t.out
22
// RUN: %target-run %t.out | %FileCheck %s
3+
// REQUIRES: stress_test
34
// UNSUPPORTED: nonatomic_rc
45

56
import StdlibUnittest

validation-test/stdlib/ArrayBridging.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88

99
// REQUIRES: objc_interop
1010
// REQUIRES: executable_test
11+
// REQUIRES: stress_test
1112
// UNSUPPORTED: nonatomic_rc
1213

1314
import StdlibUnittest

validation-test/stdlib/AtomicInt.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
// RUN: %target-build-swift -module-name a %s -o %t.out -O
44
// RUN: %target-run %t.out
55
// REQUIRES: executable_test
6+
// REQUIRES: stress_test
67
// UNSUPPORTED: nonatomic_rc
78

89
import SwiftPrivate

test/stdlib/CommandLine.swift renamed to validation-test/stdlib/CommandLine.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
// RUN: %target-build-swift %t/CommandLineStressTest.o %t/CommandLineStressTestSwift.o -o %t/CommandLineStressTest
77
// RUN: %target-run %t/CommandLineStressTest foo bar baz qux quux corge grault garply waldo fred plugh xyzzy and thud
88
// REQUIRES: executable_test
9+
// REQUIRES: stress_test
910
// UNSUPPORTED: nonatomic_rc
1011

1112
// This file is an empty stub to call into the command line stress test which

validation-test/stdlib/DictionaryBridging.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
// RUN: %target-build-swift -Xfrontend -disable-access-control -I %S/Inputs/SlurpFastEnumeration/ %t/main.swift %S/Inputs/DictionaryKeyValueTypes.swift %S/Inputs/DictionaryKeyValueTypesObjC.swift -Xlinker %t/SlurpFastEnumeration.o -o %t.out -O
66
// RUN: %target-run %t.out
77
// REQUIRES: executable_test
8+
// REQUIRES: stress_test
89

910
// REQUIRES: objc_interop
1011
// UNSUPPORTED: nonatomic_rc

validation-test/stdlib/ErrorProtocol.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3+
// REQUIRES: stress_test
34
// REQUIRES: objc_interop
45
// UNSUPPORTED: nonatomic_rc
56

validation-test/stdlib/StringSlicesConcurrentAppend.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
3+
// REQUIRES: stress_test
34

45
import StdlibUnittest
56
import SwiftPrivatePthreadExtras

0 commit comments

Comments
 (0)