From 16b1d26f28280de2479cc5f0595f936088c515fe Mon Sep 17 00:00:00 2001 From: Thai Duong Date: Wed, 4 Apr 2018 23:32:54 -0700 Subject: [PATCH] Fixing tests that depend on JSON test vectors. Also fixing doc links in open source (see #48). PiperOrigin-RevId: 191699981 GitOrigin-RevId: e5a0caaf2d794dce378d1c4efefe36a36d2048f7 --- BUILD.bazel | 15 +++++++++++++++ README.md | 12 ++++++------ kokoro/continuous.sh | 3 ++- tools/build_defs.bzl | 28 +++++++++++++++------------- 4 files changed, 38 insertions(+), 20 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 9c13790..20a7fee 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,3 +1,7 @@ +testdata = [ + "//testvectors:all", +] + # java java_library( @@ -44,6 +48,7 @@ bouncycastle_all_tests( srcs = ["java/com/google/security/wycheproof/BouncyCastleAllTests.java"] + test_srcs, test_class = "com.google.security.wycheproof.BouncyCastleAllTests", deps = common_deps, + data = testdata, ) java_test( @@ -55,6 +60,7 @@ java_test( tags = ["manual"], test_class = "com.google.security.wycheproof.BouncyCastleAllTests", deps = common_deps + ["@local//:bouncycastle_jar"], + data = testdata, ) # Generates BouncyCastleTest_1_xx target for all available versions, @@ -73,6 +79,7 @@ bouncycastle_tests( srcs = ["java/com/google/security/wycheproof/BouncyCastleTest.java"] + test_srcs, test_class = "com.google.security.wycheproof.BouncyCastleTest", deps = common_deps, + data = testdata, ) java_test( @@ -84,6 +91,7 @@ java_test( tags = ["manual"], test_class = "com.google.security.wycheproof.BouncyCastleTest", deps = common_deps + ["@local//:bouncycastle_jar"], + data = testdata, ) # Spongy Castle tests @@ -106,6 +114,7 @@ spongycastle_all_tests( srcs = ["java/com/google/security/wycheproof/SpongyCastleAllTests.java"] + test_srcs, test_class = "com.google.security.wycheproof.SpongyCastleAllTests", deps = common_deps, + data = testdata, ) # Generates SpongyCastleTest_1_xx target for all available versions, @@ -124,6 +133,7 @@ spongycastle_tests( srcs = ["java/com/google/security/wycheproof/SpongyCastleTest.java"] + test_srcs, test_class = "com.google.security.wycheproof.SpongyCastleTest", deps = common_deps, + data = testdata, ) # Conscrypt tests @@ -134,6 +144,7 @@ conscrypt_tests( srcs = ["java/com/google/security/wycheproof/ConscryptTest.java"] + test_srcs, test_class = "com.google.security.wycheproof.ConscryptTest", deps = common_deps, + data = testdata, ) conscrypt_all_tests( @@ -141,6 +152,7 @@ conscrypt_all_tests( srcs = ["java/com/google/security/wycheproof/ConscryptAllTests.java"] + test_srcs, test_class = "com.google.security.wycheproof.ConscryptAllTests", deps = common_deps, + data = testdata, ) # OpenJDK tests @@ -150,6 +162,7 @@ java_test( srcs = ["java/com/google/security/wycheproof/OpenJDKTest.java"] + test_srcs, test_class = "com.google.security.wycheproof.OpenJDKTest", deps = common_deps, + data = testdata, ) java_test( @@ -158,6 +171,7 @@ java_test( srcs = ["java/com/google/security/wycheproof/OpenJDKAllTests.java"] + test_srcs, test_class = "com.google.security.wycheproof.OpenJDKAllTests", deps = common_deps, + data = testdata, ) # Platform-independent tests @@ -166,6 +180,7 @@ java_test( size = "small", srcs = ["java/com/google/security/wycheproof/ProviderIndependentTest.java"] + test_srcs, deps = common_deps, + data = testdata, ) # WebCrypto Javascript tests diff --git a/README.md b/README.md index 0ca3d0d..07b10fd 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ check their libraries against a large number of known attacks, without having to spend years reading academic papers or become cryptographers themselves. For more information on the goals and strategies of Project Wycheproof, please -check out our [doc](g3doc/). +check out our [doc](doc/). ### Coverage @@ -51,13 +51,13 @@ Project Wycheproof has tests for the most popular crypto algorithms, including - AES-EAX - AES-GCM -- [DH](g3doc/dh.md) +- [DH](doc/dh.md) - DHIES -- [DSA](g3doc/dsa.md) -- [ECDH](g3doc/ecdh.md) +- [DSA](doc/dsa.md) +- [ECDH](doc/ecdh.md) - ECDSA - ECIES -- [RSA](g3doc/rsa.md) +- [RSA](doc/rsa.md) The tests detect whether a library is vulnerable to many attacks, including @@ -159,7 +159,7 @@ slow tests (which are annotated with @SlowTest). Most test targets are failing, and each failure might be a security issue. To learn more about what a failed test means, you might want to check out [our -documentation](g3doc/bugs.md) or the comments on top of the corresponding test +documentation](doc/bugs.md) or the comments on top of the corresponding test function and test class. ### Hall of Bugs diff --git a/kokoro/continuous.sh b/kokoro/continuous.sh index 1c6bff6..93a7e01 100644 --- a/kokoro/continuous.sh +++ b/kokoro/continuous.sh @@ -14,5 +14,6 @@ bazel build ... || exit 1 # Run all tests to generate logs. # We don't care about the test results, thus always return successfully. -bazel test ... || exit 0 +bazel query "kind(test, :all)" | grep AllTests | grep -v Local | xargs bazel \ + --host_javabase="$JAVA_HOME" test --test_output=all || exit 0 diff --git a/tools/build_defs.bzl b/tools/build_defs.bzl index 896d6c9..05b4053 100644 --- a/tools/build_defs.bzl +++ b/tools/build_defs.bzl @@ -2,7 +2,7 @@ """ -def add_tests(name, versions, provider_dep, srcs, deps, size, test_class): +def add_tests(name, versions, provider_dep, srcs, deps, size, test_class, data): """Provider version-specific tests.""" for version in versions: @@ -14,6 +14,7 @@ def add_tests(name, versions, provider_dep, srcs, deps, size, test_class): ], size = size, test_class = test_class, + data = data, ) # Latest stable. @@ -27,6 +28,7 @@ def add_tests(name, versions, provider_dep, srcs, deps, size, test_class): ], size = size, test_class = test_class, + data = data, ) # Bouncy Castle targets @@ -35,46 +37,46 @@ bouncycastle_versions = ["1_%d" % i for i in range(49, 60)] bouncycastle_dep = "@bouncycastle" # These targets run all tests. -def bouncycastle_all_tests(srcs, deps, size, test_class): +def bouncycastle_all_tests(srcs, deps, size, test_class, data): """BouncyCastle version-specific tests.""" - add_tests("BouncyCastleAllTests", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class) + add_tests("BouncyCastleAllTests", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class, data) # These targets exclude @SlowTest -def bouncycastle_tests(srcs, deps, size, test_class): +def bouncycastle_tests(srcs, deps, size, test_class, data): """BouncyCastle version-specific tests.""" - add_tests("BouncyCastleTest", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class) + add_tests("BouncyCastleTest", bouncycastle_versions, bouncycastle_dep, srcs, deps, size, test_class, data) # Spongy Castle targets spongycastle_versions = ["1_50", "1_51", "1_52", "1_53", "1_54", "1_56", "1_58"] spongycastle_dep = "@spongycastle_prov" # These targets run all tests. -def spongycastle_all_tests(srcs, deps, size, test_class): +def spongycastle_all_tests(srcs, deps, size, test_class, data): """SpongyCastle version-specific tests.""" - add_tests("SpongyCastleAllTests", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class) + add_tests("SpongyCastleAllTests", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class, data) # These targets exclude slow tests. -def spongycastle_tests(srcs, deps, size, test_class): +def spongycastle_tests(srcs, deps, size, test_class, data): """SpongyCastle version-specific tests.""" - add_tests("SpongyCastleTest", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class) + add_tests("SpongyCastleTest", spongycastle_versions, spongycastle_dep, srcs, deps, size, test_class, data) # Conscrypt targets conscrypt_versions = ["1_0_1"] conscrypt_dep = "@conscrypt" # These targets run all tests. -def conscrypt_all_tests(srcs, deps, size, test_class): +def conscrypt_all_tests(srcs, deps, size, test_class, data): """Conscrypt version-specific tests.""" - add_tests("ConscryptAllTests", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class) + add_tests("ConscryptAllTests", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class, data) # These targets exclude @SlowTest -def conscrypt_tests(srcs, deps, size, test_class): +def conscrypt_tests(srcs, deps, size, test_class, data): """Conscrypt version-specific tests.""" - add_tests("ConscryptTest", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class) + add_tests("ConscryptTest", conscrypt_versions, conscrypt_dep, srcs, deps, size, test_class, data)