about summary refs log tree commit diff
path: root/third_party/bazel/rules_nixpkgs/tests/BUILD
diff options
context:
space:
mode:
authorVincent Ambo <tazjin@google.com>2019-07-04T10·18+0100
committerVincent Ambo <tazjin@google.com>2019-07-04T10·18+0100
commit64275e446e442c9a0a860969501158ed93058441 (patch)
tree482821738cbc68fb1e7c263bc80a2cea4a946a66 /third_party/bazel/rules_nixpkgs/tests/BUILD
parentf723b8b878a3c4a4687b9e337a875500bebb39b1 (diff)
feat(third_party/bazel): Check in rules_nixpkgs from Tweag r/18
Diffstat (limited to 'third_party/bazel/rules_nixpkgs/tests/BUILD')
-rw-r--r--third_party/bazel/rules_nixpkgs/tests/BUILD58
1 files changed, 58 insertions, 0 deletions
diff --git a/third_party/bazel/rules_nixpkgs/tests/BUILD b/third_party/bazel/rules_nixpkgs/tests/BUILD
new file mode 100644
index 000000000000..68e4f4c58079
--- /dev/null
+++ b/third_party/bazel/rules_nixpkgs/tests/BUILD
@@ -0,0 +1,58 @@
+package(default_testonly = 1)
+
+[
+    # All of these tests use the "hello" binary to see
+    # whether different invocations of `nixpkgs_package`
+    # produce a valid bazel repository.
+    sh_test(
+        name = "run-{0}".format(test),
+        timeout = "short",
+        srcs = ["test_bin.sh"],
+        args = ["$(location @{0}//:bin)".format(test)],
+        data = ["@{0}//:bin".format(test)],
+    )
+    for test in [
+        "hello",
+        "expr-test",
+        "attribute-test",
+        "expr-attribute-test",
+        "nix-file-test",
+        "nix-file-deps-test",
+        "nixpkgs-git-repository-test",
+    ]
+] + [
+    # These tests use the nix package generated by ./output.nix
+
+    # Checks whether the `:include` filegroup of `nixpkgs_package`
+    # repositories works as intended
+    # (that the expected number of files are inside the target)
+    sh_test(
+        name = "run-test-include",
+        timeout = "short",
+        srcs = ["test_output.sh"],
+        args = [
+            "2",
+            "$(locations @output-filegroup-test//:include)",
+        ],
+        data = ["@output-filegroup-test//:include"],
+    ),
+
+    # Checks whether specifying a manual filegroup in the
+    # `nixpkgs_package` BUILD file works as well.
+    sh_test(
+        name = "run-test-manual-filegroup",
+        timeout = "short",
+        srcs = ["test_output.sh"],
+        args = [
+            "3",
+            "$(locations @output-filegroup-manual-test//:manual-filegroup)",
+        ],
+        data = ["@output-filegroup-manual-test//:manual-filegroup"],
+    ),
+]
+
+# Test nixpkgs_cc_configure() by building some CC code.
+cc_binary(
+    name = "cc-test",
+    srcs = ["cc-test.cc"],
+)