xref: /aosp_15_r20/external/boringssl/src/crypto/test/test_data.h (revision 8fb009dc861624b67b6cdb62ea21f0f22d0c584b)
1 /* Copyright (c) 2024, Google Inc.
2  *
3  * Permission to use, copy, modify, and/or distribute this software for any
4  * purpose with or without fee is hereby granted, provided that the above
5  * copyright notice and this permission notice appear in all copies.
6  *
7  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
10  * SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
12  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
13  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */
14 
15 #ifndef OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
16 #define OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
17 
18 #include <string>
19 
20 // GetTestData returns the test data for |path|, or aborts on error. |path|
21 // must be a slash-separated path, relative to the BoringSSL source tree. By
22 // default, this is implemented by reading from the filesystem, relative to
23 // the BORINGSSL_TEST_DATA_ROOT environment variable, or the current working
24 // directory if unset.
25 //
26 // Callers with more complex needs can build with
27 // BORINGSSL_CUSTOM_GET_TEST_DATA and then link in an alternate implementation
28 // of this function.
29 //
30 // Callers running from Bazel can define BORINGSSL_USE_BAZEL_RUNFILES to use
31 // the Bazel runfiles library.
32 std::string GetTestData(const char *path);
33 
34 #endif  // OPENSSL_HEADER_CRYPTO_TEST_TEST_DATA_H
35