about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/library-linkstatic-flag
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-08-15T15·11+0100
committerVincent Ambo <tazjin@google.com>2019-08-15T15·11+0100
commit128875b501bc2989617ae553317b80faa556d752 (patch)
tree9b32d12123801179ebe900980556486ad4803482 /third_party/bazel/rules_haskell/tests/library-linkstatic-flag
parenta20daf87265a62b494d67f86d4a5199f14394973 (diff)
chore: Remove remaining Bazel-related files r/31
Diffstat (limited to 'third_party/bazel/rules_haskell/tests/library-linkstatic-flag')
-rw-r--r--third_party/bazel/rules_haskell/tests/library-linkstatic-flag/BUILD.bazel112
-rw-r--r--third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Lib.hs5
-rw-r--r--third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Main.hs3
-rw-r--r--third_party/bazel/rules_haskell/tests/library-linkstatic-flag/get_library_files.bzl28
4 files changed, 0 insertions, 148 deletions
diff --git a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/BUILD.bazel b/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/BUILD.bazel
deleted file mode 100644
index 0b7cae3d7a65..000000000000
--- a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/BUILD.bazel
+++ /dev/null
@@ -1,112 +0,0 @@
-load(
-    "@io_tweag_rules_haskell//haskell:haskell.bzl",
-    "haskell_library",
-)
-load("//tests:inline_tests.bzl", "sh_inline_test")
-load(":get_library_files.bzl", "get_libraries_as_runfiles")
-
-# test whether `linkstatic` works as expected
-package(default_testonly = 1)
-
-# only .a files
-haskell_library(
-    name = "library-static-only",
-    srcs = ["Lib.hs"],
-    linkstatic = True,  # <--
-    visibility = ["//visibility:public"],
-    deps = [
-        "//tests/hackage:base",
-        "//tests/hackage:bytestring",
-    ],
-)
-
-# both .a and .so files
-haskell_library(
-    name = "library-static-and-dynamic",
-    srcs = ["Lib.hs"],
-    linkstatic = False,  # <--
-    visibility = ["//visibility:public"],
-    deps = [
-        "//tests/hackage:base",
-        "//tests/hackage:bytestring",
-    ],
-)
-
-# extract all libraries from the haskell_library
-get_libraries_as_runfiles(
-    name = "library-static-only-libraries",
-    library = ":library-static-only",
-)
-
-get_libraries_as_runfiles(
-    name = "library-static-and-dynamic-libraries",
-    library = ":library-static-and-dynamic",
-)
-
-# sh_test’s `data` doesn’t add stuff to runfiles :(
-# sh_library can bundle different targets as runfiles for sh_test
-# TODO(Profpatsch): add functionality to sh_inline_test by default?
-sh_library(
-    name = "bundled-dependency-files-static-only",
-    data = [":library-static-only-libraries"],
-)
-
-sh_library(
-    name = "bundled-dependency-files-static-and-dynamic",
-    data = [":library-static-and-dynamic-libraries"],
-)
-
-# ensure that linkstatic=True only creates only .a, no .so
-sh_inline_test(
-    name = "library-linkstatic-flag",
-    size = "small",
-    # pass the file names as arguments
-    args = ["$(rootpaths :library-static-only-libraries)"],
-    data = [
-        # for rootpaths
-        ":library-static-only-libraries",
-        # to actually get the files …
-        ":bundled-dependency-files-static-only",
-    ],
-    script = """
-set -euo pipefail
-for f in "$@"; do
-    if ! [[ "$f" =~ .a$ ]]; then
-      echo "not a static library: $f"
-      exit 1
-    fi
-done
-""",
-)
-
-# test whether .so is linked dynamically and .a statically
-sh_inline_test(
-    name = "test-libraries-static-and-dynamic",
-    size = "small",
-    # pass the file names as arguments
-    args = ["$(rootpaths :library-static-and-dynamic-libraries)"],
-    data = [
-        # for rootpaths
-        ":library-static-and-dynamic-libraries",
-        # to actually get the files …
-        ":bundled-dependency-files-static-and-dynamic",
-    ],
-    script = """
-set -euo pipefail
-is_dynamic () {
-    # taken from https://github.com/NixOS/nixpkgs/blob/0b3f50f844e2a6b507b18d7c5259bb850b382f87/pkgs/build-support/setup-hooks/auto-patchelf.sh#L167-L170
-    readelf -l -- "$1" | grep -q "^ *INTERP\\>"
-}
-
-for f in "$@"; do
-    if [[ "$f" =~ .a$ ]] && is_dynamic "$f"; then
-        echo "should be a static executable: $f"
-        exit 1
-    fi
-    if [[ "$f" =~ .so$ ]] && ! is_dynamic "$f"; then
-        echo "should be a dynamic executable: $f"
-        exit 1
-    fi
-done
-""",
-)
diff --git a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Lib.hs b/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Lib.hs
deleted file mode 100644
index 66a2161a19c4..000000000000
--- a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Lib.hs
+++ /dev/null
@@ -1,5 +0,0 @@
-module Lib (message) where
-
-import qualified Data.ByteString.Char8 as B
-
-message = B.pack "hello, world"
diff --git a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Main.hs b/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Main.hs
deleted file mode 100644
index 2048dbdecd9a..000000000000
--- a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/Main.hs
+++ /dev/null
@@ -1,3 +0,0 @@
-module Main where
-
-main = putStrLn "hello world"
diff --git a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/get_library_files.bzl b/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/get_library_files.bzl
deleted file mode 100644
index 31702bfcfa07..000000000000
--- a/third_party/bazel/rules_haskell/tests/library-linkstatic-flag/get_library_files.bzl
+++ /dev/null
@@ -1,28 +0,0 @@
-load(
-    "@io_tweag_rules_haskell//haskell:providers.bzl",
-    "HaskellInfo",
-    "HaskellLibraryInfo",
-)
-load("//haskell:private/set.bzl", "set")
-
-def _get_libraries_as_runfiles_impl(ctx):
-    """Extract all library files from a haskell_library target
-    and put them in this target’s files"""
-    bi = ctx.attr.library[HaskellInfo]
-    return [DefaultInfo(
-        # not necessarily complete
-        files = depset(
-            direct = bi.static_libraries,
-            transitive = [set.to_depset(bi.dynamic_libraries)],
-        ),
-    )]
-
-get_libraries_as_runfiles = rule(
-    _get_libraries_as_runfiles_impl,
-    attrs = {
-        "library": attr.label(
-            mandatory = True,
-            providers = [HaskellInfo, HaskellLibraryInfo],
-        ),
-    },
-)