From: Andreas Gampe Date: Wed, 7 Oct 2015 01:59:08 +0000 (-0700) Subject: ART: Change asm test logging X-Git-Tag: android-x86-7.1-r1~889^2~198^2 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=7532401fbb3602cc6831b5f9a809c0e88d1daa83;p=android-x86%2Fart.git 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 --- 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.