Skip to content
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

Linkstatic shell tests #488

Merged
merged 6 commits into from
Nov 23, 2018
Merged

Linkstatic shell tests #488

merged 6 commits into from
Nov 23, 2018

Conversation

Profpatsch
Copy link
Contributor

Building upon #487 this adds two tests to check whether the generated ELF binaries are actually linked as we expect them to be.

Adds a primitive to read a Skylark string into a single-file target (candidate for some bazel-focused library, akin to build-support in nixpkgs?) and a shell_inline_test wrapper around shell_test to make small test scripts less cluttered to write and read.

Adds a `provides` field to haskell_library and haskell_binary to tell
users about our custom providers (and possibly throw better error
messages).

As a related change, the `load` targets for `providers.bzl` are made
absolute to work around
bazelbuild/bazel#3115
Like sh_test, but takes a (multiline) string to specify the shell
script inline instead of a different file.
Adds two shell tests that use readelf to check that the `linkstatic`
option has the expected behavior:
- When it’s set to True it only produces static libraries (.a)
- When it’s set to False it produces both .a and .so
- .a is a static ELF (no interpreter) and .so is a dynamic ELF
  (interpreter appears in the ELF header INTERP field)
@Profpatsch Profpatsch force-pushed the linkstatic-shell-tests branch from 1a53ecf to bc1ce90 Compare November 22, 2018 15:10
@Profpatsch
Copy link
Contributor Author

Meh, skydoc barfs at the provides attribute, similar to how it didn’t like doc until it was fixed by Mathieu (but that is not upstreamed yet it looks like).

I can just revert that part of the change, it’s not crucial.

Similar to bazelbuild/skydoc#59 it also
doesn’t support `provides`.
Since `provides` is just nice-to-have, we drop it for now.
@Profpatsch Profpatsch requested a review from mboes November 22, 2018 16:00
@@ -8,7 +8,7 @@ load(
"target_unique_name",
)
load(
":private/providers.bzl",
"@io_tweag_rules_haskell//haskell:private/providers.bzl",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Necessary?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly yes, to navigate around bazelbuild/bazel#3115

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you add a note inline about this at the top of providers.bzl about this?

Copy link
Member

@mboes mboes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Minor nit.

skylark/sh_inline_test.bzl Outdated Show resolved Hide resolved
@Profpatsch Profpatsch merged commit 0621cfc into master Nov 23, 2018
@Profpatsch Profpatsch deleted the linkstatic-shell-tests branch January 14, 2019 09:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants