Add pki test files for android, adapt PathService fillin. Change-Id: Ie5cb298398c1944704c74b63f51323800f6dc5b0 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/61065 Reviewed-by: David Benjamin <davidben@google.com> Auto-Submit: Bob Beck <bbe@google.com> Commit-Queue: David Benjamin <davidben@google.com>
diff --git a/pki/CMakeLists.txt b/pki/CMakeLists.txt index ebcdd8a..72bbe43 100644 --- a/pki/CMakeLists.txt +++ b/pki/CMakeLists.txt
@@ -97,8 +97,7 @@ target_compile_definitions( pki_test PRIVATE - _BORINGSSL_LIBPKI_ - "_BORINGSSL_PKI_SRCDIR_=${CMAKE_CURRENT_SOURCE_DIR}") + _BORINGSSL_LIBPKI_) target_link_libraries(pki_test test_support_lib boringssl_gtest_main pki ssl crypto) add_dependencies(all_tests pki_test)
diff --git a/pki/fillins/path_service.cc b/pki/fillins/path_service.cc index 3eda232..a915cb1 100644 --- a/pki/fillins/path_service.cc +++ b/pki/fillins/path_service.cc
@@ -28,15 +28,11 @@ // static void PathService::Get(PathKey key, FilePath *out) { -#if defined(_BORINGSSL_PKI_SRCDIR_) - // We stringify the compile parameter because cmake. sigh. -#define _boringssl_xstr(s) _boringssl_str(s) -#define _boringssl_str(s) #s - const char pki_srcdir[] = _boringssl_xstr(_BORINGSSL_PKI_SRCDIR_); -#else -#error "No _BORINGSSL_PKI_SRCDIR" -#endif // defined(BORINGSSL_PKI_SRCDIR - *out = FilePath(pki_srcdir); + // We expect our test data to live in "pki" underneath a + // test root directory, or in the current directry. + char *root_from_env = getenv("BORINGSSL_TEST_DATA_ROOT"); + std::string root = root_from_env ? root_from_env : "."; + *out = FilePath(root + "/pki"); } } // namespace fillins
diff --git a/util/run_android_tests.go b/util/run_android_tests.go index ce87819..84297a9 100644 --- a/util/run_android_tests.go +++ b/util/run_android_tests.go
@@ -310,6 +310,20 @@ "BUILDING.md", ) + err := filepath.Walk("pki/testdata/", func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + if info.Mode().IsRegular() { + files = append(files, path) + } + return nil + }) + if err != nil { + fmt.Printf("Can't walk pki/testdata: %s\n", err) + os.Exit(1); + } + tests, err := testconfig.ParseTestConfig("util/all_tests.json") if err != nil { fmt.Printf("Failed to parse input: %s\n", err) @@ -374,6 +388,7 @@ "crypto/libcrypto.so", "decrepit/libdecrepit.so", "ssl/libssl.so", + "pki/libpki.so", } } else if !os.IsNotExist(err) { fmt.Printf("Failed to stat crypto/libcrypto.so: %s\n", err)