about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag
diff options
context:
space:
mode:
Diffstat (limited to 'third_party/bazel/rules_haskell/tests/binary-linkstatic-flag')
-rw-r--r--third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/BUILD.bazel118
-rw-r--r--third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/HsLib.hs4
-rw-r--r--third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/Main.hs9
-rw-r--r--third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/c-lib.c1
4 files changed, 0 insertions, 132 deletions
diff --git a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/BUILD.bazel b/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/BUILD.bazel
deleted file mode 100644
index 4e8e7cfa6684..000000000000
--- a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/BUILD.bazel
+++ /dev/null
@@ -1,118 +0,0 @@
-load(
-    "@io_tweag_rules_haskell//haskell:haskell.bzl",
-    "haskell_library",
-    "haskell_test",
-)
-load("//tests:inline_tests.bzl", "sh_inline_test")
-
-# test whether `linkstatic` works as expected
-package(default_testonly = 1)
-
-cc_library(
-    name = "c-lib",
-    srcs = ["c-lib.c"],
-)
-
-haskell_library(
-    name = "HsLib",
-    srcs = ["HsLib.hs"],
-    deps = [
-        "//tests/hackage:base",
-    ],
-)
-
-haskell_test(
-    name = "binary-static",
-    srcs = ["Main.hs"],
-    linkstatic = True,
-    deps = [
-        ":HsLib",
-        ":c-lib",
-        "//tests/hackage:base",
-    ],
-)
-
-haskell_test(
-    name = "binary-dynamic",
-    srcs = ["Main.hs"],
-    linkstatic = False,
-    deps = [
-        ":HsLib",
-        ":c-lib",
-        "//tests/hackage:base",
-    ],
-)
-
-config_setting(
-    name = "debug_build",
-    values = {
-        "compilation_mode": "dbg",
-    },
-)
-
-# Ensure that linkstatic=True only links to static library targets.
-sh_inline_test(
-    name = "test-binary-static-symbols",
-    size = "small",
-    args = [
-        "$(rootpath :binary-static)",
-    ],
-    data = [
-        ":binary-static",
-    ],
-    script = """
-    set -eo pipefail
-    binary="$1"
-    # Symbols are prefixed with underscore on MacOS but not on Linux.
-    if nm -u "$binary" | grep -q "\<_\?value"; then
-        echo "C library dependency not linked statically: ${binary}"
-        exit 1
-    fi
-    if nm -u "$binary" | grep -q HsLib_value_closure; then
-        echo "Haskell library dependency not linked statically ${binary}"
-        exit 1
-    fi
-    """,
-)
-
-# Ensure that linkstatic=False only links to dynamic library targets.
-sh_inline_test(
-    name = "test-binary-dynamic-symbols",
-    size = "small",
-    args = [
-        "$(rootpath :binary-dynamic)",
-    ] + select({
-        ":debug_build": ["dbg"],
-        "//conditions:default": ["rls"],
-    }),
-    data = [
-        ":binary-dynamic",
-    ],
-    script = """
-    set -eo pipefail
-    binary="$1"
-    mode="$2"
-    if [[ $mode = dbg ]]; then
-        # Skip test in debug builds. Debug mode forces static linking.
-        exit 0
-    fi
-    # Symbols are prefixed with underscore on MacOS but not on Linux.
-    if ! nm -u "$binary" | grep -q "\<_\?value"; then
-        echo "C library dependency not linked dynamically"
-        exit 1
-    fi
-    if ! nm -u "$binary" | grep -q HsLib_value_closure; then
-        echo "Haskell library dependency not linked dynamically"
-        exit 1
-    fi
-    """,
-)
-
-test_suite(
-    name = "binary-linkstatic-flag",
-    tests = [
-        ":test-binary-dynamic-symbols",
-        ":test-binary-static-symbols",
-    ],
-    visibility = ["//visibility:public"],
-)
diff --git a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/HsLib.hs b/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/HsLib.hs
deleted file mode 100644
index 68271826d7ee..000000000000
--- a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/HsLib.hs
+++ /dev/null
@@ -1,4 +0,0 @@
-module HsLib (value) where
-
-value :: Int
-value = 13
diff --git a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/Main.hs b/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/Main.hs
deleted file mode 100644
index 7836c2220277..000000000000
--- a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/Main.hs
+++ /dev/null
@@ -1,9 +0,0 @@
-{-# LANGUAGE ForeignFunctionInterface #-}
-
-module Main (main) where
-
-import qualified HsLib
-
-foreign import ccall "value" value :: Int
-
-main = print $ HsLib.value + value
diff --git a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/c-lib.c b/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/c-lib.c
deleted file mode 100644
index 9a1e526017ec..000000000000
--- a/third_party/bazel/rules_haskell/tests/binary-linkstatic-flag/c-lib.c
+++ /dev/null
@@ -1 +0,0 @@
-int value() { return 29; }