[intepreter] Make bytecode mismatch failures more verbose

Print all the mismatch failures in the bytecode rather than aborting at
the first mismatch.

R=rmcilroy

Change-Id: Id572ead5fdc4d126ac9a05942f940b0eaef7150f
Reviewed-on: https://chromium-review.googlesource.com/c/1400412
Commit-Queue: Dan Elphick <delphick@chromium.org>
Reviewed-by: Ross McIlroy <rmcilroy@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58628}
This commit is contained in:
Dan Elphick 2019-01-08 12:18:34 +00:00 committed by Commit Bot
parent 683dd5fe17
commit 3427ec9dfb

View File

@ -157,13 +157,14 @@ bool CompareTexts(const std::string& generated, const std::string& expected) {
std::string expected_line;
// Line number does not include golden file header.
int line_number = 0;
bool strings_match = true;
do {
std::getline(generated_stream, generated_line);
std::getline(expected_stream, expected_line);
if (!generated_stream.good() && !expected_stream.good()) {
return true;
return strings_match;
}
if (!generated_stream.good()) {
@ -182,7 +183,7 @@ bool CompareTexts(const std::string& generated, const std::string& expected) {
std::cerr << "Inputs differ at line " << line_number << "\n";
std::cerr << " Generated: '" << generated_line << "'\n";
std::cerr << " Expected: '" << expected_line << "'\n";
return false;
strings_match = false;
}
line_number++;
} while (true);