From 7532401fbb3602cc6831b5f9a809c0e88d1daa83 Mon Sep 17 00:00:00 2001 From: Andreas Gampe Date: Tue, 6 Oct 2015 18:59:08 -0700 Subject: [PATCH] ART: Change asm test logging Adapt the output a bit to log the exact shell command, and change how the output is logged and what is logged. Should get more info on failure. Change-Id: Iacf58d27d6e1cf01e2fcd5835c4e0f8b5a820501 --- compiler/utils/assembler_test_base.h | 29 ++++++++++++++++++++++------- 1 file changed, 22 insertions(+), 7 deletions(-) diff --git a/compiler/utils/assembler_test_base.h b/compiler/utils/assembler_test_base.h index 43c9d942e..8c7129246 100644 --- a/compiler/utils/assembler_test_base.h +++ b/compiler/utils/assembler_test_base.h @@ -520,18 +520,19 @@ class AssemblerTestInfrastructure { return line; } - // For debug purposes. - void FindToolDump(std::string tool_name) { - // Find the current tool. Wild-card pattern is "arch-string*tool-name". + // Helper for below. If name_predicate is empty, search for all files, otherwise use it for the + // "-name" option. + static void FindToolDumpPrintout(std::string name_predicate, std::string tmp_file) { std::string gcc_path = GetRootPath() + GetGCCRootPath(); std::vector args; args.push_back("find"); args.push_back(gcc_path); - args.push_back("-name"); - args.push_back(architecture_string_ + "*" + tool_name); + if (!name_predicate.empty()) { + args.push_back("-name"); + args.push_back(name_predicate); + } args.push_back("|"); args.push_back("sort"); - std::string tmp_file = GetTmpnam(); args.push_back(">"); args.push_back(tmp_file); std::string sh_args = Join(args, ' '); @@ -547,10 +548,24 @@ class AssemblerTestInfrastructure { UNREACHABLE(); } + LOG(ERROR) << "FindToolDump: gcc_path=" << gcc_path + << " cmd=" << sh_args; std::ifstream in(tmp_file.c_str()); if (in) { - LOG(ERROR) << in.rdbuf(); + std::string line; + while (std::getline(in, line)) { + LOG(ERROR) << line; + } } + in.close(); + std::remove(tmp_file.c_str()); + } + + // For debug purposes. + void FindToolDump(std::string tool_name) { + // Check with the tool name. + FindToolDumpPrintout(architecture_string_ + "*" + tool_name, GetTmpnam()); + FindToolDumpPrintout("", GetTmpnam()); } // Use a consistent tmpnam, so store it. -- 2.11.0