about summary refs log tree commit diff
path: root/third_party/bazel/rules_haskell/tests/unit-tests/BUILD.bazel
blob: 990035af685f96f66d49a12f551aaf6b34c7ae95 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
load(
    ":tests.bzl",
    "create_rpath_entry_test",
    "dedup_on_test",
    "parent_dir_path_test",
)

parent_dir_path_test(
    name = "parent_dir_just_file",
    filename = "foo",
    output = ["."],
)

parent_dir_path_test(
    name = "parent_dir",
    filename = "foo/",
    output = ["foo"],
)

parent_dir_path_test(
    name = "parent_dir_file",
    filename = "foo/bar",
    output = ["foo"],
)

parent_dir_path_test(
    name = "parent_dir_file_dots",
    filename = "foo/../bar",
    output = [
        "foo",
        "..",
    ],
)

parent_dir_path_test(
    name = "parent_dir_rooted",
    filename = "/foo/bar",
    output = [
        "",
        "foo",
    ],
)

create_rpath_entry_test(
    name = "rpath_entry_simple",
    binary_short_path = "foo/a.so",
    dependency_short_path = "bar/b.so",
    output = "../bar",
)

# checks that a binary in //:bin works properly
create_rpath_entry_test(
    name = "rpath_entry_binary_root",
    binary_short_path = "bin",
    dependency_short_path = "xyz/b.so",
    output = "xyz",
)

# same for dependency
create_rpath_entry_test(
    name = "rpath_entry_dep_root",
    binary_short_path = "lib/bin",
    dependency_short_path = "b.so",
    output = "..",
)

create_rpath_entry_test(
    name = "rpath_entry_simple_filename",
    binary_short_path = "foo/a.so",
    dependency_short_path = "bar/b.so",
    keep_filename = True,
    output = "../bar/b.so",
)

create_rpath_entry_test(
    name = "rpath_entry_prefix",
    binary_short_path = "foo/a.so",
    dependency_short_path = "bar/b.so",
    output = "$ORIGIN/../bar",
    prefix = "$ORIGIN",
)

# if the short-paths have leading dots, they are in `external`

create_rpath_entry_test(
    name = "rpath_entry_binary_leading_dots_dep",
    # non-external
    binary_short_path = "foo/a.so",
    # external dep
    dependency_short_path = "../bar/b.so",
    output = "../external/bar",
)

create_rpath_entry_test(
    name = "rpath_entry_binary_leading_dots_bin",
    # external dep
    binary_short_path = "../foo/a.so",
    # non-external
    dependency_short_path = "bar/b.so",
    # back through `external`
    output = "../../bar",
)

create_rpath_entry_test(
    name = "rpath_entry_binary_leading_dots_both",
    # external dep
    binary_short_path = "../foo/a.so",
    # external dep
    dependency_short_path = "../bar/b.so",
    # stay in `external`
    output = "../bar",
)

# we have no idea how to handle internal dots, should they arise
# create_rpath_entry_test(
#     name = "rpath_entry_binary_internal_dots",
#     binary_short_path = "foo/../../a.so",
#     dependency_short_path = "../bar/../b.so",
#     # but that doesn’t change anything for the runpath
#     output = "../bar",
# )

dedup_on_test(
    name = "dedup_on_test",
)