swift-testing icon indicating copy to clipboard operation
swift-testing copied to clipboard

[WIP] Enable support for the `@_section` experimental attribute.

Open grynspan opened this issue 1 year ago • 8 comments

This PR enables support for @_used and @_section to allow embedding test data directly into its own section in a binary. This means we don't have to look up synthesized test types at runtime.

Limitations:

  1. Test clients must enable support for the experimental "SymbolLinkageMarkers" feature.
  2. The @_section attribute currently doesn't support application to constants of function type, thinking they are non-constant.
  3. We will need to make a change to the Swift runtime on Linux/Windows to add the new section to MetadataSections (or alternatively, the experimental feature needs to provide a different way to discover sections at runtime.) See https://github.com/apple/swift/pull/71509.

:warning: Do not merge: this is a proof-of-concept and work-in-progress.

Checklist:

  • [x] Code and documentation should follow the style of the Style Guide.
  • [x] If public symbols are renamed or modified, DocC references should be updated.

grynspan avatar Feb 09 '24 16:02 grynspan

@swift-ci please test

grynspan avatar Feb 09 '24 16:02 grynspan

@swift-ci please test

grynspan avatar Feb 12 '24 14:02 grynspan

@compnerd says the Windows section needs the suffix "$B".

grynspan avatar Feb 19 '24 18:02 grynspan

@swift-ci please test

grynspan avatar Feb 20 '24 20:02 grynspan

Linux failure is expected right now; the new swift5_tests section needs a newer toolchain.

grynspan avatar Feb 20 '24 22:02 grynspan

Looks like Windows has a compile-time complaint about the constness of C function pointers.

grynspan avatar Feb 21 '24 01:02 grynspan

@swift-ci please test

grynspan avatar Feb 27 '24 01:02 grynspan

@swift-ci please test

grynspan avatar Feb 27 '24 19:02 grynspan