Commit Graph

8 Commits

Author SHA1 Message Date
Alastair Houghton
f02f62f1e3 [Backtracing] Add support for looking up paths for auxiliary executables.
We need to be able to locate `swift-backtrace` relative to the current
location of the runtime library.

This needs to work:

* In a Swift build directory.
* On Darwin, where we're installed in /usr/lib/swift and /usr/libexec/swift.
* On Linux, where we're in /usr/lib/swift/linux and /usr/libexec/swift/linux.
* On Windows, where we may be in a flat directory layout (because of limitations
  of Windows DLL lookups).

rdar://103071801
2023-03-01 13:43:15 +00:00
Alastair Houghton
5cfa1aa22f Make the environment_variables test less flaky.
The test was inadvertently depending on the ordering of output between
stderr and stdout, which makes it break particularly when being run
remotely.

rdar://88335113
2022-02-16 15:53:34 +00:00
Nate Chandler
6efadb051d [Test] Disabled several Runtime tests for back_deployment_runtime.
rdar://76567759
2021-04-13 15:42:33 -07:00
Nate Chandler
03659813ca [Runtime] Scribble on metadata allocations.
Previously, when NDEBUG was not defined, the allocations made for value
metadata records were filled with 0xAA bytes.  Here, that behavior is
both expanded to all metadata records and enabled in release builds when
the environment variable SWIFT_DEBUG_ENABLE_MALLOC_SCRIBBLE is set.
2020-06-16 12:46:43 -07:00
Mike Ash
306cb0d925 [Test] Exclude environment_variables.swift from testing against the OS stdlib.
rdar://problem/64301166
2020-06-12 13:00:41 -04:00
Saleem Abdulrasool
e9622edd51 test: mark test as executable_test
This should repair the android bots.
2020-06-08 18:33:37 -07:00
3405691582
a9007790b1 [stdlib][test] Fix message test expectation.
In #32137 direct environment variable parsing was introduced, the
availability of which is branched by a preprocessor symbol (`ENVIRON`)
if the environment is available directly on the platform, or if getenv
must be used.

The message expectation in the unit test in the however diverged on the
non-`ENVIRON` branch, causing a unit test failure. This PR fixes the
expectation, but also, while we're here, OpenBSD supports the `ENVIRON`
branch anyway.
2020-06-05 00:12:17 -04:00
Mike Ash
f2fb53967c [Runtime] Unify debug variable parsing from the environment and avoid getenv when possible.
There are a few environment variables used to enable debugging options in the
runtime, and we'll likely add more over time. These are implemented with
scattered getenv() calls at the point of use. This is inefficient, as most/all
OSes have to do a linear scan of the environment for each call. It's also not
discoverable, since the only way to find these variables is to inspect the
source.

This commit places all of these variables in a central location.
stdlib/public/runtime/EnvironmentVariables.def defines all of the debug
variables including their name, type, default value, and a help string. On OSes
which make an `environ` array available, the entire array is scanned in a single
pass the first time any debug variable is requested. By quickly rejecting
variables that do not start with `SWIFT_`, we optimize for the common case where
no debug variables are set. We also have a fallback to repeated `getenv()` calls
when a full scan is not possible.

Setting `SWIFT_HELP=YES` will print out all available debug variables along with
a brief description of what they do.
2020-06-04 10:00:06 -04:00