mirror of
https://github.com/google/flatbuffers.git
synced 2026-06-25 00:56:11 +00:00
Make flatbuffer C++ tests work when vendored with bazel (#5040)
Tests for third_party code are run out of the main workspace. This isn't an issue when the main workspace is the com_github_google_flatbuffers workspace, but is an issue when you are running the tests from another repository. To reproduce, use "git_repository" to add flatbuffers to a project and then run: bazel test @com_github_google_flatbuffers//:flatbuffers_test
This commit is contained in:
committed by
Wouter van Oortmerssen
parent
30bae01ea3
commit
f23009f04f
1
BUILD
1
BUILD
@@ -143,6 +143,7 @@ cc_test(
|
|||||||
],
|
],
|
||||||
copts = [
|
copts = [
|
||||||
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
|
"-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE",
|
||||||
|
"-DBAZEL_TEST_DATA_PATH",
|
||||||
],
|
],
|
||||||
data = [
|
data = [
|
||||||
":tests/include_test/include_test1.fbs",
|
":tests/include_test/include_test1.fbs",
|
||||||
|
|||||||
@@ -50,7 +50,12 @@ uint32_t lcg_rand() {
|
|||||||
}
|
}
|
||||||
void lcg_reset() { lcg_seed = 48271; }
|
void lcg_reset() { lcg_seed = 48271; }
|
||||||
|
|
||||||
std::string test_data_path = "tests/";
|
std::string test_data_path =
|
||||||
|
#ifdef BAZEL_TEST_DATA_PATH
|
||||||
|
"../com_github_google_flatbuffers/tests/";
|
||||||
|
#else
|
||||||
|
"tests/";
|
||||||
|
#endif
|
||||||
|
|
||||||
// example of how to build up a serialized buffer algorithmically:
|
// example of how to build up a serialized buffer algorithmically:
|
||||||
flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {
|
flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {
|
||||||
|
|||||||
Reference in New Issue
Block a user