aboutsummaryrefslogtreecommitdiff
path: root/decrepit/ripemd
diff options
context:
space:
mode:
authorDavid Benjamin <davidben@google.com>2017-01-19 19:05:47 -0500
committerDavid Benjamin <davidben@google.com>2017-01-21 00:17:05 +0000
commit966284337d8cd531e6475c9afefbe1bb03e1cb64 (patch)
tree7de713071c9efcc227a5cac2a02bebba309e7854 /decrepit/ripemd
parentd1263b05a9fa89ebac3bd43bfe739dc719831d00 (diff)
downloadboringssl-966284337d8cd531e6475c9afefbe1bb03e1cb64.zip
boringssl-966284337d8cd531e6475c9afefbe1bb03e1cb64.tar.gz
boringssl-966284337d8cd531e6475c9afefbe1bb03e1cb64.tar.bz2
Do a cursory conversion of a few tests to GTest.
For now, this is the laziest conversion possible. The intent is to just get the build setup ready so that we can get everything working in our consumers. The intended end state is: - The standalone build produces three test targets, one per library: {crypto,ssl,decrepit}_tests. - Each FOO_test is made up of: FOO/**/*_test.cc crypto/test/gtest_main.cc test_support - generate_build_files.py emits variables crypto_test_sources and ssl_test_sources. These variables are populated with FindCFiles, looking for *_test.cc. - The consuming file assembles those variables into the two test targets (plus decrepit) from there. This avoids having generate_build_files.py emit actual build rules. - Our standalone builders, Chromium, and Android just run the top-level test targets using whatever GTest-based reporting story they have. In transition, we start by converting one of two tests in each library to populate the three test targets. Those are added to all_tests.json and all_tests.go hacked to handle them transparently. This keeps our standalone builder working. generate_build_files.py, to start with, populates the new source lists manually and subtracts them out of the old machinery. We emit both for the time being. When this change rolls in, we'll write all the build glue needed to build the GTest-based tests and add it to consumers' continuous builders. Next, we'll subsume a file-based test and get the consumers working with that. (I.e. make sure the GTest targets can depend on a data file.) Once that's all done, we'll be sure all this will work. At that point, we start subsuming the remaining tests into the GTest targets and, asynchronously, rewriting tests to use GTest properly rather than cursory conversion here. When all non-GTest tests are gone, the old generate_build_files.py hooks will be removed, consumers updated to not depend on them, and standalone builders converted to not rely on all_tests.go, which can then be removed. (Unless bits end up being needed as a malloc test driver. I'm thinking we'll want to do something with --gtest_filter.) As part of this CL, I've bumped the CMake requirements (for target_include_directories) and added a few suppressions for warnings that GTest doesn't pass. BUG=129 Change-Id: I881b26b07a8739cc0b52dbb51a30956908e1b71a Reviewed-on: https://boringssl-review.googlesource.com/13232 Reviewed-by: Adam Langley <agl@google.com>
Diffstat (limited to 'decrepit/ripemd')
-rw-r--r--decrepit/ripemd/CMakeLists.txt12
-rw-r--r--decrepit/ripemd/ripemd_test.cc12
2 files changed, 5 insertions, 19 deletions
diff --git a/decrepit/ripemd/CMakeLists.txt b/decrepit/ripemd/CMakeLists.txt
index 0714a8f..d3dd284 100644
--- a/decrepit/ripemd/CMakeLists.txt
+++ b/decrepit/ripemd/CMakeLists.txt
@@ -7,15 +7,3 @@ add_library(
ripemd.c
)
-
-add_executable(
- ripemd_test
-
- ripemd_test.cc
-
- $<TARGET_OBJECTS:test_support>
-)
-
-target_link_libraries(ripemd_test crypto)
-target_link_libraries(ripemd_test decrepit)
-add_dependencies(all_tests ripemd_test)
diff --git a/decrepit/ripemd/ripemd_test.cc b/decrepit/ripemd/ripemd_test.cc
index e39c893..5c54196 100644
--- a/decrepit/ripemd/ripemd_test.cc
+++ b/decrepit/ripemd/ripemd_test.cc
@@ -19,6 +19,8 @@
#include <stdio.h>
#include <string.h>
+#include <gtest/gtest.h>
+
#include "../../crypto/internal.h"
#include "../../crypto/test/test_util.h"
@@ -53,7 +55,8 @@ static const RIPEMDTestCase kRIPEMDTestCases[] = {
0xd3, 0x32, 0x3c, 0xab, 0x82, 0xbf, 0x63, 0x32, 0x6b, 0xfb}},
};
-int main(void) {
+// TODO(davidben): Convert this file to GTest properly.
+TEST(RIPEMDTest, RunTest) {
unsigned test_num = 0;
int ok = 1;
@@ -111,10 +114,5 @@ int main(void) {
ok = 0;
}
- if (!ok) {
- return 1;
- }
-
- printf("PASS\n");
- return 0;
+ EXPECT_EQ(1, ok);
}