xref: /aosp_15_r20/external/bazel-skylib/tests/diff_test/BUILD (revision bcb5dc7965af6ee42bf2f21341a2ec00233a8c8a)
1*bcb5dc79SHONG Yifan# This package aids testing the 'diff_test' rule.
2*bcb5dc79SHONG Yifan
3*bcb5dc79SHONG Yifanload("//rules:diff_test.bzl", "diff_test")
4*bcb5dc79SHONG Yifan
5*bcb5dc79SHONG Yifanpackage(
6*bcb5dc79SHONG Yifan    default_applicable_licenses = ["//:license"],
7*bcb5dc79SHONG Yifan    default_testonly = 1,
8*bcb5dc79SHONG Yifan)
9*bcb5dc79SHONG Yifan
10*bcb5dc79SHONG Yifanlicenses(["notice"])
11*bcb5dc79SHONG Yifan
12*bcb5dc79SHONG Yifansh_test(
13*bcb5dc79SHONG Yifan    name = "diff_test_tests",
14*bcb5dc79SHONG Yifan    srcs = ["diff_test_tests.sh"],
15*bcb5dc79SHONG Yifan    data = [
16*bcb5dc79SHONG Yifan        "//rules:diff_test",
17*bcb5dc79SHONG Yifan        "//tests:unittest.bash",
18*bcb5dc79SHONG Yifan    ],
19*bcb5dc79SHONG Yifan    # Test marked local because it uses bazel.
20*bcb5dc79SHONG Yifan    tags = ["local"],
21*bcb5dc79SHONG Yifan    deps = ["@bazel_tools//tools/bash/runfiles"],
22*bcb5dc79SHONG Yifan)
23*bcb5dc79SHONG Yifan
24*bcb5dc79SHONG Yifandiff_test(
25*bcb5dc79SHONG Yifan    name = "same_src_src",
26*bcb5dc79SHONG Yifan    file1 = "a.txt",
27*bcb5dc79SHONG Yifan    file2 = "aa.txt",
28*bcb5dc79SHONG Yifan)
29*bcb5dc79SHONG Yifan
30*bcb5dc79SHONG Yifandiff_test(
31*bcb5dc79SHONG Yifan    name = "same_src_gen",
32*bcb5dc79SHONG Yifan    file1 = "a.txt",
33*bcb5dc79SHONG Yifan    file2 = "a-gen.txt",
34*bcb5dc79SHONG Yifan)
35*bcb5dc79SHONG Yifan
36*bcb5dc79SHONG Yifandiff_test(
37*bcb5dc79SHONG Yifan    name = "same_gen_gen",
38*bcb5dc79SHONG Yifan    file1 = "a-gen.txt",
39*bcb5dc79SHONG Yifan    file2 = "aa-gen.txt",
40*bcb5dc79SHONG Yifan)
41*bcb5dc79SHONG Yifan
42*bcb5dc79SHONG Yifangenrule(
43*bcb5dc79SHONG Yifan    name = "gen",
44*bcb5dc79SHONG Yifan    outs = [
45*bcb5dc79SHONG Yifan        "a-gen.txt",
46*bcb5dc79SHONG Yifan        "aa-gen.txt",
47*bcb5dc79SHONG Yifan    ],
48*bcb5dc79SHONG Yifan    cmd = "echo -n 'potato' > $(location a-gen.txt) && echo -n 'potato' > $(location aa-gen.txt)",
49*bcb5dc79SHONG Yifan)
50