Handle the cases where stdout may have CRLF suffix on windows in xla parse_flags_from_env_test

PiperOrigin-RevId: 300624885
Change-Id: I794990b523cc7417298e41d3ebd49f441fd5432f
This commit is contained in:
Gunhan Gulsoy 2020-03-12 14:29:45 -07:00 committed by TensorFlower Gardener
parent 1af62be037
commit fcdca5dc0a

View File

@ -143,6 +143,9 @@ TEST(ParseFlagsFromEnv, EnvAndFlag) {
string stdout_str;
int child_status = child.Communicate(nullptr, &stdout_str, nullptr);
CHECK_EQ(child_status, 0) << "test " << i;
// On windows, we get CR characters. Remove them.
stdout_str.erase(std::remove(stdout_str.begin(), stdout_str.end(), '\r'),
stdout_str.end());
CHECK_EQ(stdout_str, test[i].expected_value) << "test " << i;
}
}