Commit Graph

73 Commits

Author SHA1 Message Date
Saleem Abdulrasool
e9aaef4bea test: move RangeSet test into validation-test
The RangeSet test depends on the StdlibCollectionUnittest, which is part
of the validation tests.  This should repair the tests.
2020-02-22 17:26:43 -08:00
Daniel Rodríguez Troitiño
8bea502e8d [windows][test] Ensure the ordering of stdout and stderr messages.
It is possible that the rest of the platforms are relying in some not
clearly documented behaviour that the stdout is flushed before stderr
can be used, or something similar. Windows didn't seem to like that, and
was sometimes outputting the stderr messages interlaced with the stdout
messages (specially in the Azure testing for VS2017). The initial
solution was adding -DAG to some CHECK lines, but that doesn't cover all
the possibilities, and wasn't enabled for all the checks.

I tried to fix it in several ways, but none of them were perfect, and
many of them were deadlocking. There's a fundamental difference between
others and Windows and that is that for others stdout seems to have a
little bit of an edge in being treated first. I tried to get the Windows
code closer to that idea, but I have no luck. Some of the approaches
were using the main thread to read from the threads reading stdout and
stderr; using only the main thread and IOCP on the pipes reading from
the child process; and flushing after every output to stdout. None of
them were perfect.

The final solution is a hack, but it seems to not fail when I run the
test repeatedly in my machine, while other approaches were failing at
least once before I discarded them. The solution is including a small
sleep (1 millisecond) in the Windows code. This should yield the
execution time slice to other thread/process, which seems to do the
trick and keep the stdout before the stderr.

Hopefully this fixes the errors in Azure, and doesn't affect the rest of
the testing machines. Being a really small sleep also should not affect
the duration of the test itself.
2019-07-30 15:04:21 -07:00
Saleem Abdulrasool
4c91a3eb60 test: make StdlibUnittest.CrashingTests pass on Windows
The output can be interleaved differently.  Accept either ordering.
2019-06-11 15:38:43 -07:00
Saleem Abdulrasool
12c7cead9d test: make the StdlibUnittest.Common pass on Windows
This adjusts the paths in the test to support the Linux and Windows path
separators.  Loosen the test to accept the interleaved stdout output on
Windows.
2019-06-10 12:25:06 -07:00
Daniel Rodríguez Troitiño
5835cebe99 [android] Do not try to turn EOF into an UInt8
Android is one of those platforms that define the symbol EOF as a
negative number. Trying to turn it into an UInt8 will only crash the
test. Move the transformation after we have checked for EOF first. In my
opinion, in other platforms, having the EOF attached to the getline
result was also invalid, and that's probably why the two test that use
EOF were sending an extra newline.

Even with this, the tests do not pass on Android because it deadlocks
waiting for input/output from the child process, which never happens. I
haven't find why this happens, but only happens if the last test of the
suite closes stdin. I will try to fix that in another PR.
2019-04-19 17:24:45 -07:00
Harlan Haskins
fbce6e7873 [StdlibUnittest] Allow tests to require a new process
When testing runtime lookup changes, we want to make sure each test runs in isolation. Add a new modifier, `.requireOwnProcess()`, to enable tests to guarantee they’re run in isolation.
2019-03-17 17:29:36 -07:00
Daniel Rodríguez Troitiño
d08b46c47e [tests] Standarize the checks for Darwin, Glibc and MSVCRT.
Different tests used different os checks for importing Darwin, Glibc and
MSVCRT. This commit use the same pattern for importing those libraries,
in order to avoid the #else branches of the incorrect patterns to be
applied to the wrong platform. This was very normal for Android, which
normally should follow the Linux branches, but sometimes was trying to
import Darwin or not importing anything.

The standarized pattern imports Darwin for macOS, iOS, tvOS and watchOS.
It imports Glibc for Linux, FreeBSD, PS4, Android, Cygwin and Haiku; and
imports MSVCRT for Windows. If a new platform is introduced, the else
branch will report an error, so the new platform can be added to one of
the branches (or maybe add a new specific branch).

In some cases  the standard pattern was modified because some test required
it (importing extra modules, or extra type aliases), and in some other
cases some branches were removed because the test will not have used
them (but it is not exhaustive, so there might be some unnecessary
branches).

This should, at least, fix three tests for Android (the three
dynamic_replacement*.swift ones).
2019-02-06 10:51:55 -08:00
Maxim Moiseev
ca51626fd3 [stdlib] Move _stdlib_AtomicInt and friends out of the stdlib 2018-11-06 09:53:58 -08:00
Ben Cohen
e338344bae Remove overloads that were needed pre-conditional conformance 2018-09-11 21:00:36 -07:00
Arnold Schwaighofer
7e4ce9a575 Codesign more tests 2018-08-10 06:58:40 -07:00
David Zarzycki
283713d61d [Testing] Formalize stress tests
Stress tests are, by definition, stressful. They intentionally burn a
lot of resources by using randomness to hopefully surface state machine
bugs. Additionally, many stress tests are multi-threaded these days and
they may attempt to use all of the available CPUs to better uncover
bugs. In isolation, this is not a problem, but the test suite as a whole
assumes that individual tests are single threaded and therefore running
multiple stress tests at once can quickly spiral out of control.

This change formalizes stress tests and then treats them like long
tests, i.e. tested via 'check-swift-all' and otherwise opt-in.

Finally, with this change, the CI build bots might need to change if
they are still only testing 'validation' instead of all of the tests.
I see three options:

1) Run all of the tests. -- There are very few long tests left these
   days, and the additional costs seems small relative to the cost of
   the whole validation test suite before this change.
2) Continue checking 'validation', now sans stress tests.
3) Check 'validation', *then* the stress tests. If the former doesn't
   pass, then there is no point in the latter, and by running the stress
   tests separately, they stand a better chance of uncovering bugs and
   not overwhelming build bot resources.
2018-03-20 21:45:28 -04:00
Michael Gottesman
e567bc9028 [+0-all-args] Enable +0 normal arguments.
rdar://34222540
2018-03-19 20:25:31 -07:00
Ben Cohen
85d190cd7d [stdlib] Replace various uses of BlahSlice with Slice to reduce warnings (#13263)
* Kill the slice variants from the gybbed collection test types

* Handful more SDK instances

* Fix SequencesCollections.swift.gyb
2017-12-05 19:09:56 -08:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Dmitri Gribenko
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Mikio Takeuchi
3a46ecb7f0 Use UNSUPPORTED to skip race tests 2017-02-27 12:17:53 +09:00
Mikio Takeuchi
dfeca11403 Disable race tests if nonatomic reference counting is used 2017-02-27 12:17:53 +09:00
Maxim Moiseev
16eb32f539 [validation-test] Marking a few stdlibunittest validation tests as unsupported on watchos (#7731) 2017-02-24 13:44:32 -08:00
Han Sangjin
a8dec7fa43 [stdlib] Fixed for Cygwin
- CYGWIN symbol is used to distinguish Cygwin environment from other OS
  and other environment in Windows.
- Added windows and windowsCygnus to OSVersion in StdlibUnittest
2017-01-17 02:31:16 +09:00
David Farler
b7d17b25ba Rename -parse flag to -typecheck
A parse-only option is needed for parse performance tracking and the
current option also includes semantic analysis.
2016-11-28 10:50:55 -08:00
Greg Parker
9666d8d39a [test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift. (#4815)
[test] Add a timeout to runRaceTest(). Use it to limit test AtomicInt.swift.

This cuts AtomicInt.swift's execution time from several hours to
about ten minutes on slow hardware and slow build configurations.
2016-09-19 21:46:25 -07:00
Dmitri Gribenko
b8a475be72 StdlibUnittest: rename 'expectEmpty()' and 'expectNotEmpty()' to 'expectNil()' and 'expectNotNil()'
The new names are what people generally expect.  The old names made more
sense in the old times when the 'Optional.None' case could not be
created with the 'nil' keyword.
2016-09-10 20:05:42 -07:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Dmitri Gribenko
08c772fdac StdlibUnittest: add an allowBrokenTransitivity flag to checkEquatable()
This will be used for testing Swift errors bridged to NSErrors.
2016-08-09 00:49:20 -07:00
Dmitri Gribenko
fd627ff015 StdlibUnittest: add expectEqual(_: Any.Type, _: Any.Type) 2016-08-08 17:56:05 -07:00
Dmitri Gribenko
f45565ca6c StdlibUnittest: add a new overload of expectEqual() 2016-08-07 13:46:31 -07:00
Robert Widmann
35fe7c7ad6 Cleanup validation tests after SE-0089 2016-07-28 18:01:44 -07:00
Dmitri Gribenko
9ac1bb108a StdlibUnitttest: optimize checkEquatable()
checkEquatable() used to be O(n^3), now it is O(n^2).
2016-07-26 03:10:52 -07:00
Joe Groff
21c15d8fe9 Update validation tests for id-as-Any. 2016-07-25 06:40:37 -07:00
Tony Parker
f65c1390cb Rename Process to CommandLine
Rename Process to CommandLine [SE-0086].
2016-07-18 17:02:02 -07:00
Tony Parker
8e814ac875 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-17 09:42:37 -07:00
Andrew Trick
888ff1ae99 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 46a9f57329.

This broke Swift CI, OSS incremental RA:

./swift/stdlib/public/SDK/Foundation/TimeZone.swift:228:45: error: 'NSTimeZone' is not implicitly convertible to 'TimeZone'; did you mean to use 'as' to explicitly convert?
        return lhs._wrapped.isEqual(to: rhs._wrapped)
2016-07-16 18:34:32 -07:00
Tony Parker
46a9f57329 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 17:58:27 -07:00
Andrew Trick
7b5723b9a5 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 9c1f21bdf0.

This breaks swift-ci for everyone:

stdlib/public/SDK/Foundation/Calendar.swift:426:74: error: 'DateInterval' is only available on iOS 10.0 or newer
    public func dateInterval(of component: Component, for date: Date) -> DateInterval? {
2016-07-16 17:08:06 -07:00
Tony Parker
9c1f21bdf0 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 15:48:08 -07:00
Mishal Shah
23b646eed2 Update master to build with Xcode 8 beta 2, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs 2016-07-06 10:48:45 -07:00
Dmitri Gribenko
fd7f55d5a2 stdlib: replace 'forAllPermutations()' with a non-recursive implementation 2016-07-06 02:53:27 -07:00
Saleem Abdulrasool
83901998c9 Port for PS4
Add support for the PS4 OS.  Update the standard library and add a target unit
test.
2016-06-30 20:14:50 -07:00
rintaro ishizaki
4b51d85abb [test] Add %target-run-simple-swiftgyb
* Utilize %target-run-simple-swiftgyb where possible
2016-06-15 11:49:44 +09:00
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -07:00
Rintaro Ishizaki
1bdce7ced6 [lit] Add substitutions: %utils and %line-directive
%utils => ${SWIFT_SOURCE_DIR}/utils
%line-directive => ${SWIFT_SOURCE_DIR}/utils/line-directive
2016-06-11 02:41:15 +09:00
Brian Gesiak
b946d69112 [validation-test] Expand Glibc import check
Glibc needs to be imported on all non-Darwin platforms.
Besides Linux, this includes FreeBSD and Android as well.
2016-06-07 11:39:15 -04:00
Dmitri Gribenko
8f118750a4 StdlibUnittest: add tests for expectEqual() on tuples 2016-06-04 02:33:30 -07:00
Dmitri Gribenko
9574d03dfa StdlibUnittest: ask the child process to terminate, and check its termination status
If a child process crashes outside of a test context, the parent process
should signal test failure. This behavior is a sign of something bad
happening in the child (for example, memory corruption), and should not
go unnoticed.
2016-05-22 17:17:16 -07:00
Dmitri Gribenko
d872098fbc StdlibUnittest: clarify what a test does 2016-05-22 14:37:53 -07:00
Dmitri Gribenko
227cfa1695 StdlibUnittest: add a simple API for race tests 2016-05-20 14:23:31 -07:00
Jordan Rose
54e4b59c59 StdlibUnittest: Fix NSException catching (broken by SE-0054).
Previously, the callback for objc_setUncaughtExceptionHandler
took a parameter of type 'AnyObject!', which was implicitly
unwrapped at all uses inside the closure. When that became
'AnyObject?', we started getting an extra layer of Optional in
the printed output.

This reverts the tests to their pre-4d540c2a state.
2016-05-04 14:17:15 -07:00
Chris Willmore
4d540c2a24 Fix up missed test cases for SE-0054. 2016-05-03 14:59:58 -07:00
Dave Abrahams
9bee5d182f [stdlib] location/formLocation => index/formIndex 2016-04-26 17:46:16 -07:00