STT-tensorflow/tensorflow/compiler/xla/debug_options_parsers_test.cc
Deven Desai 307fd6d28c [ROCm] Fix for compile error in //tensorflow/compiler/xla:debug_options_parsers_test
On the ROCm platform, we currently get the following compile failure for the test
`tensorflow/compiler/xla/debug_options_parsers_test`

```
...
external/com_google_googletest/googletest/include/gtest/internal/gtest-port.h:881:23: note:   'testing::internal::string'
 typedef ::std::string string;
                       ^
tensorflow/compiler/xla/debug_options_parsers_test.cc:29:33: error: 'test_map' was not declared in this scope
   unordered_map<string, string> test_map;
                                 ^
tensorflow/compiler/xla/debug_options_parsers_test.cc:30:10: error: expected ';' before 'test_string'
   string test_string = "aa=bb,cc,dd=,ee=ff=gg";
...

```

This fix resolves the compile error, and gets the test passing again on the ROCm platform

On the ROCm platform, this test is compiled via the following gcc compiler

```
root@ixt-rack-04:/root/tensorflow# gcc --version
gcc (Ubuntu 5.4.0-6ubuntu1~16.04.12) 5.4.0 20160609
```

The crosstool setup / compile invocation on the ROCm platform is done via
 * https://github.com/tensorflow/tensorflow/blob/master/third_party/gpus/rocm_configure.bzl
 * https://github.com/tensorflow/tensorflow/blob/master/third_party/gpus/crosstool/clang/bin/crosstool_wrapper_driver_rocm.tpl
2020-01-19 02:38:56 +00:00

45 lines
1.4 KiB
C++

/* Copyright 2017 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
// Test for parse_flags_from_env.cc
#include "tensorflow/compiler/xla/debug_options_parsers.h"
#include <unordered_map>
#include <vector>
#include "tensorflow/core/platform/test.h"
namespace xla {
// Test that the xla_backend_extra_options flag is parsed correctly.
TEST(DebugOptionsFlags, ParseXlaBackendExtraOptions) {
std::unordered_map<std::string, std::string> test_map;
std::string test_string = "aa=bb,cc,dd=,ee=ff=gg";
parse_xla_backend_extra_options(&test_map, test_string);
EXPECT_EQ(test_map.size(), 4);
EXPECT_EQ(test_map.at("aa"), "bb");
EXPECT_EQ(test_map.at("cc"), "");
EXPECT_EQ(test_map.at("dd"), "");
EXPECT_EQ(test_map.at("ee"), "ff=gg");
}
} // namespace xla
int main(int argc, char* argv[]) {
testing::InitGoogleTest(&argc, argv);
return RUN_ALL_TESTS();
}