Skip to content

[Testing] Formalize stress tests #15211

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 21, 2018
Merged
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
4 changes: 3 additions & 1 deletion docs/Testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The testsuite is split into four subsets:
* Validation testsuite, located under ``swift/validation-test``.
* Unit tests, located under ``swift/unittests``.
* Long tests, which are marked with ``REQUIRES: long_test``.
* Stress tests, which are marked with ``REQUIRES: stress_test``.

### Running the LLVM lit-based testsuite

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

* ``check-swift``: Runs tests from the ``${SWIFT_SOURCE_ROOT}/test`` directory.
* ``check-swift-only_validation``: Runs tests from the ``${SWIFT_SOURCE_ROOT}/validation-test`` directory.
* ``check-swift-validation``: Runs the primary and validation tests, without the long tests.
* ``check-swift-validation``: Runs the primary and validation tests, without the long tests or stress tests.
* ``check-swift-only_long``: Runs long tests only.
* ``check-swift-only_stress``: Runs stress tests only.
* ``check-swift-all``: Runs all tests (primary, validation, and long).
* ``SwiftUnitTests``: Builds all unit tests. Executables are located under
``${SWIFT_BUILD_DIR}/unittests`` and must be run individually.
Expand Down
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ set(TEST_SUBSETS
all
only_validation
only_long
only_stress
)

if(NOT "${COVERAGE_DB}" STREQUAL "")
Expand Down Expand Up @@ -271,12 +272,14 @@ foreach(SDK ${SWIFT_SDKS})
if((test_subset STREQUAL "primary") OR
(test_subset STREQUAL "validation") OR
(test_subset STREQUAL "only_long") OR
(test_subset STREQUAL "only_stress") OR
(test_subset STREQUAL "all"))
list(APPEND directories "${test_bin_dir}")
endif()
if((test_subset STREQUAL "validation") OR
(test_subset STREQUAL "only_validation") OR
(test_subset STREQUAL "only_long") OR
(test_subset STREQUAL "only_stress") OR
(test_subset STREQUAL "all"))
list(APPEND directories "${validation_test_bin_dir}")
list(APPEND dependencies ${validation_test_dependencies})
Expand Down
4 changes: 4 additions & 0 deletions test/Unit/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,10 @@ elif swift_test_subset == 'only_long':
# FIXME: this doesn't exclude not-long tests from the only_long subset.
# Currently those tests are very fast so it doesn't matter much.
pass
elif swift_test_subset == 'only_stress':
# FIXME: this doesn't exclude not-stress tests from the only_stress subset.
# Currently those tests are very fast so it doesn't matter much.
pass
else:
lit_config.fatal("Unknown test mode %r" % swift_test_subset)

Expand Down
5 changes: 5 additions & 0 deletions test/lit.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,15 @@ if swift_test_subset in ['primary', 'validation', 'only_validation']:
pass
elif swift_test_subset == 'all':
config.available_features.add("long_test")
config.available_features.add("stress_test")
elif swift_test_subset == 'only_long':
config.available_features.add("long_test")
config.limit_to_features.add("long_test")
config.limit_to_features.discard("executable_test")
elif swift_test_subset == 'only_stress':
config.available_features.add("stress_test")
config.limit_to_features.add("stress_test")
config.limit_to_features.discard("executable_test")
else:
lit_config.fatal("Unknown test mode %r" % swift_test_subset)

Expand Down
6 changes: 6 additions & 0 deletions utils/build-presets.ini
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ mixin-preset=
test=0
validation-test=0
long-test=1
stress-test=1
test-optimized=0


Expand Down Expand Up @@ -747,6 +748,7 @@ release
test
validation-test
long-test
stress-test
test-optimized
foundation
libdispatch
Expand Down Expand Up @@ -822,6 +824,7 @@ release
test
validation-test
long-test
stress-test
foundation
lit-args=-v

Expand Down Expand Up @@ -892,6 +895,7 @@ mixin-preset=buildbot_incremental_linux
test=0
validation-test=0
long-test=1
stress-test=1
test-optimized=0

[preset: buildbot_incremental_linux,llvm-only]
Expand All @@ -901,6 +905,7 @@ build-subdir=buildbot_incremental_llvmonly
test=0
validation-test=0
long-test=0
stress-test=0
test-optimized=0

dash-dash
Expand Down Expand Up @@ -1022,6 +1027,7 @@ watchos
test
validation-test
long-test
stress-test

dash-dash

Expand Down
18 changes: 12 additions & 6 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -154,11 +154,12 @@ class HostSpecificConfiguration(object):
test = False

if build:
# Validation and long tests require building the full standard
# library, whereas the other targets can build a slightly
# smaller subset which is faster to build.
# Validation, long, and stress tests require building the full
# standard library, whereas the other targets can build a
# slightly smaller subset which is faster to build.
if args.build_swift_stdlib_unittest_extra or \
args.validation_test or args.long_test:
args.validation_test or args.long_test or \
args.stress_test:
self.swift_stdlib_build_targets.append(
"swift-stdlib-" + name)
else:
Expand All @@ -184,12 +185,15 @@ class HostSpecificConfiguration(object):
else:
suffix = ""
subset_suffix = ""
if args.validation_test and args.long_test:
if args.validation_test and args.long_test and \
args.stress_test:
subset_suffix = "-all"
elif args.validation_test:
subset_suffix = "-validation"
elif args.long_test:
subset_suffix = "-only_long"
elif args.stress_test:
subset_suffix = "-only_stress"
else:
subset_suffix = ""
self.swift_test_run_targets.append("check-swift{}{}-{}".format(
Expand Down Expand Up @@ -635,7 +639,7 @@ class BuildScriptInvocation(object):
if not args.build_android:
impl_args += ["--skip-build-android"]

if not args.test and not args.long_test:
if not args.test and not args.long_test and not args.stress_test:
impl_args += ["--skip-test-swift"]
if not args.test:
impl_args += ["--skip-test-cmark",
Expand Down Expand Up @@ -677,6 +681,8 @@ class BuildScriptInvocation(object):
impl_args += ["--validation-test"]
if args.long_test:
impl_args += ["--long-test"]
if args.stress_test:
impl_args += ["--stress-test"]
if not args.benchmark:
impl_args += ["--skip-test-benchmarks"]
if not args.test_optimized:
Expand Down
1 change: 1 addition & 0 deletions utils/build-script-impl
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ KNOWN_SETTINGS=(
skip-test-android-host "" "set to skip testing the host parts of the Android toolchain"
validation-test "0" "set to run the validation test suite"
long-test "0" "set to run the long test suite"
stress-test "0" "set to run the stress test suite"
test-paths "" "run tests located in specific directories and/or files"
skip-test-benchmarks "" "set to skip running Swift Benchmark Suite"
skip-test-optimized "" "set to skip testing the test suite in optimized mode"
Expand Down
3 changes: 3 additions & 0 deletions utils/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -703,6 +703,9 @@ def create_argument_parser():
option('--long-test', toggle_true,
help='run the long test suite')

option('--stress-test', toggle_true,
help='run the stress test suite')

option('--host-test', toggle_true,
help='run executable tests on host devices (such as iOS or tvOS)')

Expand Down
2 changes: 2 additions & 0 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,7 @@
'show_sdks': False,
'skip_build': False,
'stdlib_deployment_targets': None,
'stress_test': False,
'swift_analyze_code_coverage': defaults.SWIFT_ANALYZE_CODE_COVERAGE,
'swift_assertions': True,
'swift_build_variant': 'Debug',
Expand Down Expand Up @@ -423,6 +424,7 @@ class IgnoreOption(_BaseOption):
EnableOption('--libicu', dest='build_libicu'),
EnableOption('--long-test'),
EnableOption('--show-sdks'),
EnableOption('--stress-test'),
EnableOption('--test'),
EnableOption('--test-optimize-for-size'),
EnableOption('--test-optimized'),
Expand Down
1 change: 1 addition & 0 deletions utils/build_swift/tests/test_driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -645,6 +645,7 @@ def test_implied_defaults_skip_all_tests(self):
'--test', '0',
'--validation-test', '0',
'--long-test', '0',
'--stress-test', '0',
])

self.assertFalse(namespace.test_linux)
Expand Down
1 change: 1 addition & 0 deletions utils/run-test
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ TEST_SUBSETS = [
'all',
'only_validation',
'only_long',
'only_stress',
]

SWIFT_SOURCE_DIR = os.path.join(SWIFT_SOURCE_ROOT, 'swift')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test

// REQUIRES: stress_test
// REQUIRES: objc_interop

import StdlibUnittest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

import StdlibUnittest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// RUN: %target-build-swift -O %s -module-name=test -Xllvm -sil-disable-pass=FunctionSignatureOpts -emit-sil | %FileCheck %s
// RUN: %target-run %t.out
// REQUIRES: swift_stdlib_no_asserts,optimized_stdlib
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

import StdlibUnittest
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %target-build-swift -target %sanitizers-target-triple -sanitize=thread %s -o %t_binary
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: tsan_runtime
// REQUIRES: objc_interop

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// RUN: not env %env-TSAN_OPTIONS=abort_on_error=0 %target-run %t/tsan-binary 2>&1 | %FileCheck %s
// 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
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: objc_interop
// REQUIRES: tsan_runtime

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %target-swiftc_driver -target %sanitizers-target-triple -sanitize=thread %s -o %t_binary
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: objc_interop
// REQUIRES: tsan_runtime

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// RUN: %target-build-swift -sanitize=thread -target %sanitizers-target-triple %s -o %t_binary
// RUN: %env-TSAN_OPTIONS=ignore_interceptors_accesses=1:halt_on_error=1 %target-run %t_binary
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: tsan_runtime

// https://bugs.swift.org/browse/SR-6622
Expand Down
1 change: 1 addition & 0 deletions validation-test/StdlibUnittest/RaceTest.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %target-build-swift -Xfrontend -disable-access-control -module-name a %s -o %t.out
// RUN: %target-run %t.out | %FileCheck %s
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

import StdlibUnittest
Expand Down
1 change: 1 addition & 0 deletions validation-test/stdlib/ArrayBridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

// REQUIRES: objc_interop
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

import StdlibUnittest
Expand Down
1 change: 1 addition & 0 deletions validation-test/stdlib/AtomicInt.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// RUN: %target-build-swift -module-name a %s -o %t.out -O
// RUN: %target-run %t.out
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

import SwiftPrivate
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
// RUN: %target-build-swift %t/CommandLineStressTest.o %t/CommandLineStressTestSwift.o -o %t/CommandLineStressTest
// RUN: %target-run %t/CommandLineStressTest foo bar baz qux quux corge grault garply waldo fred plugh xyzzy and thud
// REQUIRES: executable_test
// REQUIRES: stress_test
// UNSUPPORTED: nonatomic_rc

// This file is an empty stub to call into the command line stress test which
Expand Down
1 change: 1 addition & 0 deletions validation-test/stdlib/DictionaryBridging.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
// 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
// RUN: %target-run %t.out
// REQUIRES: executable_test
// REQUIRES: stress_test

// REQUIRES: objc_interop
// UNSUPPORTED: nonatomic_rc
Expand Down
1 change: 1 addition & 0 deletions validation-test/stdlib/ErrorProtocol.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: stress_test
// REQUIRES: objc_interop
// UNSUPPORTED: nonatomic_rc

Expand Down
1 change: 1 addition & 0 deletions validation-test/stdlib/StringSlicesConcurrentAppend.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// RUN: %target-run-simple-swift
// REQUIRES: executable_test
// REQUIRES: stress_test

import StdlibUnittest
import SwiftPrivatePthreadExtras
Expand Down