Commit Graph
14 Commits
Author SHA1 Message Date
George Barnett c5957f6760 Support multiple shared files in the allocation counter test framework (#1782)
Motivation:

The allocation counter test framework only supports a single shared
file which is quite limiting, especially if you rely on generated code.

Modifications:

- The '-s' option can now be passed multiple times
- The symlink name for any of the passed files will be the basename of
  the provided file rather than 'shared.swift'

Result:

Allocation counter test framework can use more than one shared file.
2021-03-16 18:38:39 +00:00
Johannes Weiss b021a5a5c6 alloc counters: Use atomic globals instead of thread-locals (#1743)
Motivation:

The alloc counters need to store the pointer to the original libc
implmentations of the hooked functions somewhere. Previously, we would
store them in thread locals. That works fine but creates quite some
overhead (and allocations) per thread (to do dlsym on every thread).

Modifications:

Instead, we now store the libc function pointers in (atomic) globals so
we need to only resolve each function once, no matter how many threads
we use.

Result:

Faster, and more accurate.
2021-02-08 15:28:50 +00:00
Cory Benfield e7880565aa We use main as our development branch now. (#1651) 2020-09-24 18:02:44 +01:00
Johannes WeissandCory Benfield 3a2fc0d39b alloc tests: implement malloc_zone_* (#1569)
Motivation:

The Swift runtime is now using malloc_zone_*, we need to implement
replacements for these too. This is just a first pass, eventually, we
should implement _all_ replacements as `malloc_zone_memalign` which is
powerful enough to implement all others.

Modifications:

Provide new replacements.

Result:

Alloc tests work again on macOS.

Co-authored-by: Cory Benfield <lukasa@apple.com>
2020-06-26 11:04:37 +01:00
Johannes Weiss bf48c2beee make the allocation counter tests more stable (#1476)
Motivation:

The core problem is that we hook the system's allocator (malloc, free,
and friends) to get the most accurate allocation counts. This however
also means that all threads count into our limits which inherently means
we can't be 100% stable always.

Previously, we just waited a fixed 100ms and expected everything to be
as quiesced as it'll get. But we can do better.

Modifications:

- discard runs with negative remaining allocations (clearly bogus,
  quiescing not long enough in a previous run)
- instead of waiting a fixed amount of time, wait until the results
  appear quiesced (stable (for first run) or zero (for subsequent runs)
  remaining allocation counts.

Result:

Allocation counter tests should be much more stable on busier machines.
2020-04-08 14:00:26 +01:00
Johannes Weiss 2bf296958b switch swift-tools-version to 5.0 for integration tests (#1369)
Motivation:

Some integration tests still used swift-tools-version:4.0.

Modifications:

Make it 5.0

Result:

Run the compiler in a sensible mode.
2020-01-29 18:31:37 +00:00
Johannes Weiss 4a2746cbc8 include clang modularised headers last (#1368)
Motivation:

Clang modules seem to mess with stuff like _GNU_SOURCE as soon as
they're included. We do need _GNU_SOURCE (but don't like the
`#define __USE_GNU` hack).

Modifications:

Include the modularised headers last.

Result:

Alloc counter tests work without `#define __USE_GNU`.
2020-01-29 18:31:21 +00:00
Johannes Weissandtomer doron 7f8e96cf02 fix 5.2 builds (#1366)
motivation: tsan is broken on ubuntu 18.04.use 16.04 so 5.2 build can pass

changes:
* change 5.2 docker setup to use 16.04 instead of 18.04
* add the ability to pipe arguments to the integration tests via the docker setup
* skip tests_02 integration tests suite since it broken on 5.2 (swift-pm issue?)

fake the new limits from #1362

Co-authored-by: tomer doron <tomer@apple.com>
2020-01-29 14:39:28 +00:00
Konrad `ktoso` Malawski 8c0e373bf5 Also collect total bytes allocated in alloc tests (#1116)
Motivation:

It is useful/interesting to have an overview about total bytes
allocated, not only the number of malloc calls.

This is not used to fail tests though, more as an informational thing.

Modifications:

Introduce and hit new counter with allocated size whenever allocations
happen.

Result:

It is possible to inspect the total allocated bytes.
2019-11-27 15:43:19 +00:00
Johannes Weiss bf2598d193 iOS & simulator compatibility (#1037)
Motivation:

We should have better iOS compatibility.

Modifications:

- make all OS-conditional imports the same
- don't check TSI_S_ESTABLISHED (which is unavailable on iOS)
- update availability to reflect the OS versions we actually support
- make sure temporary UDS paths aren't too long

Result:

better iOS compatibility
2019-06-18 10:38:39 +01:00
Johannes Weiss a04da61854 alloc test: don't delete tmpdir (#1026)
Motivation:

The allocation tests shouldn't delete their working directory because
that's where you would navigate to debug them. Usually, they're run
through the integration tests which automatically clean up anyway.

Modifications:

Don't delete work dir

Result:

Easier to debug
2019-06-05 06:12:14 -07:00
Johannes Weiss d1c7cd0bac alloc counters: propagate tmp dir (#1000)
Motivation:

The allocation counter tests should default to using the integration
tests' tmp dir.

Modifications:

Propagate the right tmp dir.

Result:

fewer orphaned tmp dirs lying around in case of error.
2019-05-10 17:04:53 +01:00
Johannes Weiss a2ecd50863 don't hardcode NIO modules (#999)
Motivation:

The new allocation counter suite hardcoded a few things:
- the NIO and NIOHTTP1 modules
- no extra dependencies apart from the repo you're in

Modifications:

remove these hardcoded things.

Result:

allocation counter script works for nio-http2
2019-05-10 15:12:21 +01:00
Johannes Weiss 5d1d59868d new alloc counter tests (#996) 2019-05-09 14:27:29 +01:00