diff --git a/src/pki/CMakeLists.txt b/src/pki/CMakeLists.txt index ebcdd8a5d..72bbe438b 100644 --- a/src/pki/CMakeLists.txt +++ b/src/pki/CMakeLists.txt @@ -97,8 +97,7 @@ set_target_properties( 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/src/pki/fillins/path_service.cc b/src/pki/fillins/path_service.cc index 3eda2327a..a915cb193 100644 --- a/src/pki/fillins/path_service.cc +++ b/src/pki/fillins/path_service.cc @@ -28,15 +28,11 @@ FilePath FilePath::AppendASCII(const std::string &ascii_path_element) const { // 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/src/util/run_android_tests.go b/src/util/run_android_tests.go index ce878195f..84297a911 100644 --- a/src/util/run_android_tests.go +++ b/src/util/run_android_tests.go @@ -310,6 +310,20 @@ func main() { "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 @@ func main() { "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)