diff --git a/BUILD b/BUILD index 631452c79dd..2ba146664b9 100644 --- a/BUILD +++ b/BUILD @@ -143,6 +143,7 @@ cc_test( ], copts = [ "-DFLATBUFFERS_TRACK_VERIFIER_BUFFER_SIZE", + "-DBAZEL_TEST_DATA_PATH", ], data = [ ":tests/include_test/include_test1.fbs", diff --git a/tests/test.cpp b/tests/test.cpp index 2730026bfc3..b14e56bd2fe 100644 --- a/tests/test.cpp +++ b/tests/test.cpp @@ -50,7 +50,12 @@ uint32_t lcg_rand() { } 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: flatbuffers::DetachedBuffer CreateFlatBufferTest(std::string &buffer) {