Skip to content

Fix TF-Text C++ tests in OSS Bazel builds - #1578

Open
copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1009180430
Open

copybara-service[bot] wants to merge 1 commit into
masterfrom
test_1009180430

Conversation

@copybara-service

@copybara-service copybara-service Bot commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

Fix TF-Text C++ tests in OSS Bazel builds

  • Add tf_cc_test and tflite_cc_test wrapper macros (forwarding **kwargs) to tftext.bzl (which adds if_cuda and tf_opts_nortti_if_mobile() copts) and oss_scripts/tftext.bzl.oss so tf_cc_test links against the prebuilt @release_or_nightly//:tensorflow_libtensorflow_framework and @release_or_nightly//:tensorflow_tf_header_lib instead of recompiling @org_tensorflow//tensorflow/core/... from source, while tflite_cc_test links the prebuilt framework alongside TFLite test support built from @org_tensorflow.
  • Export shape_inference_testutil.cc in tensorflow.shim_sources.patch and add an includes argument on OSS tf_cc_library so tf_cc_test targets (including op and kernel shape inference tests) can compile shape_inference_testutil.cc against @release_or_nightly//:tensorflow_tf_header_lib via a package-local staged include directory without putting @org_tensorflow ahead of @release_or_nightly on the -iquote path. Also scope :shape_inference_testutil_oss to tests that depend on shape_inference_testutil.
  • Update copy.bara.sky to transform attr_value.proto.h <-> attr_value.pb.h, map //third_party/absl/status:status_matchers <-> @com_google_absl//absl/status:status_matchers, and fix test data file path replacements.
  • Replace testing::status::StatusIs with absl_testing::StatusIs (from absl/status/status_matchers.h), replace .ValueOrDie() with .value(), provide an ASSERT_OK_AND_ASSIGN fallback macro (extracted into core/kernels/test_status_macros.h) for OSS builds, switch SentencePiece tests from sentencepiece.proto.h to sentencepiece.pb.h and cwd-relative test-data paths read in binary mode via StdReadFileToString, and remove unused tensorflow/core/framework/tensor_testutil.h includes.

@copybara-service
copybara-service Bot force-pushed the test_1009180430 branch 4 times, most recently from 65ff225 to e248921 Compare October 30, 2026 18:52
- Add `tf_cc_test` and `tflite_cc_test` wrapper macros (forwarding `**kwargs`) to `tftext.bzl` (which adds `if_cuda` and `tf_opts_nortti_if_mobile()` `copts`) and `oss_scripts/tftext.bzl.oss` so `tf_cc_test` links against the prebuilt `@release_or_nightly//:tensorflow_libtensorflow_framework` and `@release_or_nightly//:tensorflow_tf_header_lib` instead of recompiling `@org_tensorflow//tensorflow/core/...` from source, while `tflite_cc_test` links the prebuilt framework alongside TFLite test support built from `@org_tensorflow`.
- Export `shape_inference_testutil.cc` in `tensorflow.shim_sources.patch` and add an `includes` argument on OSS `tf_cc_library` so `tf_cc_test` targets (including op and kernel shape inference tests) can compile `shape_inference_testutil.cc` against `@release_or_nightly//:tensorflow_tf_header_lib` via a package-local staged include directory without putting `@org_tensorflow` ahead of `@release_or_nightly` on the `-iquote` path. Also scope `:shape_inference_testutil_oss` to tests that depend on `shape_inference_testutil`.
- Update `copy.bara.sky` to transform `attr_value.proto.h` <-> `attr_value.pb.h`, map `//third_party/absl/status:status_matchers` <-> `@com_google_absl//absl/status:status_matchers`, and fix test data file path replacements.
- Replace `testing::status::StatusIs` with `absl_testing::StatusIs` (from `absl/status/status_matchers.h`), replace `.ValueOrDie()` with `.value()`, provide an `ASSERT_OK_AND_ASSIGN` fallback macro (extracted into `core/kernels/test_status_macros.h`) for OSS builds, switch SentencePiece tests from `sentencepiece.proto.h` to `sentencepiece.pb.h` and cwd-relative test-data paths read in binary mode via `StdReadFileToString`, and remove unused `tensorflow/core/framework/tensor_testutil.h` includes.

PiperOrigin-RevId: 1009180430

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

⌂ Proxy