1# Wycheproof tests
2
3java_library(
4    name = "utils",
5    srcs = [
6        "java/com/google/security/wycheproof/EcUtil.java",
7        "java/com/google/security/wycheproof/RandomUtil.java",
8        "java/com/google/security/wycheproof/TestUtil.java",
9    ],
10)
11
12common_deps = [
13    ":utils",
14]
15
16test_srcs = glob(["java/com/google/security/wycheproof/testcases/*.java"]) + ["java/com/google/security/wycheproof/WycheproofRunner.java"]
17
18# These targets run all tests.
19
20load(":build_defs.bzl", "bouncycastle_all_tests", "spongycastle_all_tests")
21
22# Generates BouncyCastleAllTests_1_xx target for all available versions,
23# plus a BouncyCastleAllTests alias for latest stable.
24#
25# To test latest stable:
26# $ bazel test BouncyCastleAllTests
27#
28# To test other versions, e.g., v1.52:
29# $ bazel test BouncyCastleAllTests_1_52
30#
31# To test all known versions (warning, will take a long time):
32# $ bazel test BouncyCastleAllTest_*
33bouncycastle_all_tests(
34    # This test takes a long time, because key generation for DSA and DH generate new parameters.
35    size = "large",
36    srcs = ["java/com/google/security/wycheproof/BouncyCastleAllTests.java"] + test_srcs,
37    test_class = "com.google.security.wycheproof.BouncyCastleAllTests",
38    deps = common_deps,
39)
40
41java_test(
42    name = "BouncyCastleAllTestsLocal",
43    # this target requires specifing a shell variable, thus won't work with the wildcard target patterns.
44    # with tags=["manual"] it'll be excluded from said patterns.
45    tags = ["manual"],
46    size = "large",
47    srcs = ["java/com/google/security/wycheproof/BouncyCastleAllTests.java"] + test_srcs,
48    test_class = "com.google.security.wycheproof.BouncyCastleAllTests",
49    deps = common_deps + ["@local//:bouncycastle_jar"],
50)
51
52# Generates SpongyCastleAllTests_1_xx target for all available versions,
53# plus a SpongyCastleAllTests alias for latest stable.
54#
55# To test latest stable:
56# $ bazel test SpongyCastleAllTests
57#
58# To test other versions, e.g., v1.52.0.0:
59# $ bazel test SpongyCastleAllTests_1_52
60#
61# To test all known versions (warning, will take a long time):
62# $ bazel test SpongyCastleAllTests_*
63spongycastle_all_tests(
64    # This test takes a long time, because key generation for DSA and DH generate new parameters.
65    size = "large",
66    srcs = ["java/com/google/security/wycheproof/SpongyCastleAllTests.java"] + test_srcs,
67    test_class = "com.google.security.wycheproof.SpongyCastleAllTests",
68    deps = common_deps,
69)
70
71# These targets exclude slow tests.
72
73load(":build_defs.bzl", "bouncycastle_tests", "spongycastle_tests")
74
75# Generates BouncyCastleTest_1_xx target for all available versions,
76# plus a BouncyCastleTest alias for latest stable.
77#
78# To test latest stable:
79# $ bazel test BouncyCastleTest
80#
81# To test other versions, e.g., v1.52:
82# $ bazel test BouncyCastleTest_1_52
83#
84# To test all known versions:
85# $ bazel test BouncyCastleTest_*
86bouncycastle_tests(
87    size = "large",
88    srcs = ["java/com/google/security/wycheproof/BouncyCastleTest.java"] + test_srcs,
89    test_class = "com.google.security.wycheproof.BouncyCastleTest",
90    deps = common_deps,
91)
92
93java_test(
94    name = "BouncyCastleTestLocal",
95    # this target requires specifing a shell variable, thus won't work with the wildcard target patterns.
96    # with tags=["manual"] it'll be excluded from said patterns.
97    tags = ["manual"],
98    size = "large",
99    srcs = ["java/com/google/security/wycheproof/BouncyCastleTest.java"] + test_srcs,
100    test_class = "com.google.security.wycheproof.BouncyCastleTest",
101    deps = common_deps + ["@local//:bouncycastle_jar"],
102)
103
104# Generates SpongyCastleTest_1_xx target for all available versions,
105# plus a SpongyCastleTest alias for latest stable.
106#
107# To test latest stable:
108# $ bazel test SpongyCastleTest
109#
110# To test other versions, e.g., v1.52.0.0:
111# $ bazel test SpongyCastleTest_1_52
112#
113# To test all known versions:
114# $ bazel test SpongyCastleTest_*
115spongycastle_tests(
116    size = "large",
117    srcs = ["java/com/google/security/wycheproof/SpongyCastleTest.java"] + test_srcs,
118    test_class = "com.google.security.wycheproof.SpongyCastleTest",
119    deps = common_deps,
120)
121
122# OpenJDK tests
123java_test(
124    name = "OpenJDKTest",
125    size = "large",
126    srcs = ["java/com/google/security/wycheproof/OpenJDKTest.java"] + test_srcs,
127    test_class = "com.google.security.wycheproof.OpenJDKTest",
128    deps = common_deps,
129)
130
131java_test(
132    name = "OpenJDKAllTests",
133    size = "large",
134    srcs = ["java/com/google/security/wycheproof/OpenJDKAllTests.java"] + test_srcs,
135    test_class = "com.google.security.wycheproof.OpenJDKAllTests",
136    deps = common_deps,
137)
138
139# Platform-independent tests
140java_test(
141    name = "ProviderIndependentTest",
142    size = "small",
143    srcs = ["java/com/google/security/wycheproof/ProviderIndependentTest.java"] + test_srcs,
144    deps = common_deps,
145)
146