From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 127BBC433EF for ; Tue, 12 Jul 2022 01:05:08 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 0FA5D840D3; Tue, 12 Jul 2022 03:04:55 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Gh7JpxHU"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8A7E3840AF; Tue, 12 Jul 2022 03:04:42 +0200 (CEST) Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id EE589840A3 for ; Tue, 12 Jul 2022 03:04:35 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-wr1-x434.google.com with SMTP id v16so9063693wrd.13 for ; Mon, 11 Jul 2022 18:04:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Tgjf4txO85wE1rs2yfoghFU5YKFEU4pwx4TfqTa83s4=; b=Gh7JpxHU5LfMGRub3FuCrWgM+bfa7zHB/zRwVfznuJkxXeJ4H3m6EPN7mmUY6dVZf+ JGkzePcmhuRgmO6erY7dyHhCZCN9gGkkMt8wFRl7F1G7pYzA8tkGM4t+kkhlVe4+AH8Z J3T2fwkbI1BIVAud/AcIDwc6MMQsHz6b0AEf8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Tgjf4txO85wE1rs2yfoghFU5YKFEU4pwx4TfqTa83s4=; b=j2e98TAjTb/EEZf+iZ/e+4nb7Sl17x1myQ90dZiJ8G+tiuBtaEu99AEpHHEmIbnaz/ VFnJ+VSBXQH8Li7bdGPJIzN6VAOY3q5+pRVQdWeIYzw/r2vKBGIhecTrQKT5Cc19uKbk RGSMjW+YdoRAE9y56fRurT7HYMGWVvY3vNXDPlHtbPXsMo2BZEU2J3CE0OFEKljkj8jx MTEUNrp54ft/JyVjRX+EvBt0UwMdmZROzwkANsb5vczjox4nLwFeXP8bc/drmtMAMJZt aNhj3fZgeu9Gel34bJHFfgDY5pDCfehejXQeOmjtP0Cs37KT18MvTyK/VX9s02IV9rDl murA== X-Gm-Message-State: AJIora9LuHZY7nPH9VdrYwUVXQ6R1JQTp/hFFrPb+dLNivkKbhAlAwDn 5jxw/ZhrJuG8/xDXj7hpkL7s+1kg1EjtyhUq X-Google-Smtp-Source: AGRyM1t2su36my4ZgYLiG9FnQFuSqJwwtX4XhJUJRQ1ccaeKGLoUYh0jEQMpLh3/DNlcexIT/N+yvg== X-Received: by 2002:adf:a3c9:0:b0:21d:63f4:3b63 with SMTP id m9-20020adfa3c9000000b0021d63f43b63mr18490442wrb.509.1657587875110; Mon, 11 Jul 2022 18:04:35 -0700 (PDT) Received: from sjg1.roam.corp.google.com (host-92-0-109-232.as13285.net. [92.0.109.232]) by smtp.gmail.com with ESMTPSA id p12-20020a5d48cc000000b0021d9d13bf6csm5541152wrs.97.2022.07.11.18.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Jul 2022 18:04:34 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH 02/19] buildman: Support running from an IDE Date: Mon, 11 Jul 2022 19:03:56 -0600 Message-Id: <20220712010413.331984-3-sjg@chromium.org> X-Mailer: git-send-email 2.37.0.144.g8ac04bfd2-goog In-Reply-To: <20220712010413.331984-1-sjg@chromium.org> References: <20220712010413.331984-1-sjg@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean Add a flag to allow buildman to behave properly for use from an IDE. This shows error/warning output on stderr and drops all summary and progress information. This should normally only be used when building a single board. Fix up a confusing comment for GetResultSummary() while we are here, since we want to use the Outcome object to access the unprocessed error lines from the build. Signed-off-by: Simon Glass --- tools/buildman/README | 15 +++++++++ tools/buildman/builder.py | 68 ++++++++++++++++++++++++--------------- tools/buildman/cmdline.py | 2 ++ tools/buildman/control.py | 7 ++-- 4 files changed, 63 insertions(+), 29 deletions(-) diff --git a/tools/buildman/README b/tools/buildman/README index 49438cb909d..c67a074cb50 100644 --- a/tools/buildman/README +++ b/tools/buildman/README @@ -1092,6 +1092,21 @@ This will write the full build into /tmp/build including object files. You must specify the output directory with -o when using -w. +Support for IDEs (Integrated Development Environments) +====================================================== + +Normally buildman summarises the output and shows information indicating the +meaning of each line of output. For example a '+' symbol appears at the start of +each error line. Also, buildman prints information about what it is about to do, +along with a summary at the end. + +When using buildman from an IDE, it is helpful to drop this behaviour. Use the +-I/--ide option for that. You might find -W helpful also so that warnings do +not cause the build to fail: + + buildman -o /tmp/build --board sandbox -wWI + + Changing the configuration ========================== diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index aa2ffe16f6c..078ddf070d3 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -213,6 +213,8 @@ class Builder: threading is not being used _terminated: Thread was terminated due to an error _restarting_config: True if 'Restart config' is detected in output + _ide: Produce output suitable for an Integrated Development Environment, + i.e. dont emit progress information and put errors/warnings on stderr """ class Outcome: """Records a build outcome for a single make invocation @@ -325,6 +327,7 @@ class Builder: self.config_filenames = BASE_CONFIG_FILENAMES self.work_in_output = work_in_output self.adjust_cfg = adjust_cfg + self._ide = False if not self.squash_config_y: self.config_filenames += EXTRA_CONFIG_FILENAMES @@ -382,7 +385,7 @@ class Builder: show_detail=False, show_bloat=False, list_error_boards=False, show_config=False, show_environment=False, filter_dtb_warnings=False, - filter_migration_warnings=False): + filter_migration_warnings=False, ide=False): """Setup display options for the builder. Args: @@ -397,6 +400,8 @@ class Builder: compiler filter_migration_warnings: Filter out any warnings about migrating a board to driver model + ide: Create output that can be parsed by an IDE. There is no '+' prefix on + error lines and output on stderr stays on stderr. """ self._show_errors = show_errors self._show_sizes = show_sizes @@ -407,6 +412,7 @@ class Builder: self._show_environment = show_environment self._filter_dtb_warnings = filter_dtb_warnings self._filter_migration_warnings = filter_migration_warnings + self._ide = ide def _AddTimestamp(self): """Add a new timestamp to the list and record the build period. @@ -535,8 +541,9 @@ class Builder: line += '%s : ' % self._complete_delay line += target - terminal.print_clear() - tprint(line, newline=False, limit_to_line=True) + if not self._ide: + terminal.print_clear() + tprint(line, newline=False, limit_to_line=True) def _GetOutputDir(self, commit_upto): """Get the name of the output directory for a commit number @@ -834,8 +841,9 @@ class Builder: Returns: Tuple: - Dict containing boards which passed building this commit. - keyed by board.target + Dict containing boards which built this commit: + key: board.target + value: Builder.Outcome object List containing a summary of error lines Dict keyed by error line, containing a list of the Board objects with that error @@ -1369,8 +1377,14 @@ class Builder: better_warn, worse_warn = _CalcErrorDelta(self._base_warn_lines, self._base_warn_line_boards, warn_lines, warn_line_boards, 'w') + # For the IDE mode, print out all the output + if self._ide: + outcome = board_dict[target] + for line in outcome.err_lines: + sys.stderr.write(line) + # Display results by arch - if any((ok_boards, warn_boards, err_boards, unknown_boards, new_boards, + elif any((ok_boards, warn_boards, err_boards, unknown_boards, new_boards, worse_err, better_err, worse_warn, better_warn)): arch_list = {} self.AddOutcome(board_selected, arch_list, ok_boards, '', @@ -1746,7 +1760,8 @@ class Builder: self._PrepareWorkingSpace(min(self.num_threads, len(board_selected)), commits is not None) self._PrepareOutputSpace() - tprint('\rStarting build...', newline=False) + if not self._ide: + tprint('\rStarting build...', newline=False) self.SetupBuild(board_selected, commits) self.ProcessResult(None) self.thread_exceptions = [] @@ -1773,24 +1788,25 @@ class Builder: # Wait until we have processed all output self.out_queue.join() - tprint() - - msg = 'Completed: %d total built' % self.count - if self.already_done: - msg += ' (%d previously' % self.already_done - if self.already_done != self.count: - msg += ', %d newly' % (self.count - self.already_done) - msg += ')' - duration = datetime.now() - self._start_time - if duration > timedelta(microseconds=1000000): - if duration.microseconds >= 500000: - duration = duration + timedelta(seconds=1) - duration = duration - timedelta(microseconds=duration.microseconds) - rate = float(self.count) / duration.total_seconds() - msg += ', duration %s, rate %1.2f' % (duration, rate) - tprint(msg) - if self.thread_exceptions: - tprint('Failed: %d thread exceptions' % len(self.thread_exceptions), - colour=self.col.RED) + if not self._ide: + tprint() + + msg = 'Completed: %d total built' % self.count + if self.already_done: + msg += ' (%d previously' % self.already_done + if self.already_done != self.count: + msg += ', %d newly' % (self.count - self.already_done) + msg += ')' + duration = datetime.now() - self._start_time + if duration > timedelta(microseconds=1000000): + if duration.microseconds >= 500000: + duration = duration + timedelta(seconds=1) + duration = duration - timedelta(microseconds=duration.microseconds) + rate = float(self.count) / duration.total_seconds() + msg += ', duration %s, rate %1.2f' % (duration, rate) + tprint(msg) + if self.thread_exceptions: + tprint('Failed: %d thread exceptions' % len(self.thread_exceptions), + colour=self.col.RED) return (self.fail, self.warned, self.thread_exceptions) diff --git a/tools/buildman/cmdline.py b/tools/buildman/cmdline.py index ddcb1ec5fcd..cef2068c983 100644 --- a/tools/buildman/cmdline.py +++ b/tools/buildman/cmdline.py @@ -59,6 +59,8 @@ def ParseArgs(): parser.add_option('-i', '--in-tree', dest='in_tree', action='store_true', default=False, help='Build in the source tree instead of a separate directory') + parser.add_option('-I', '--ide', action='store_true', default=False, + help='Create build output that can be parsed by an IDE') parser.add_option('-j', '--jobs', dest='jobs', type='int', default=None, help='Number of jobs to run at once (passed to make)') parser.add_option('-k', '--keep-outputs', action='store_true', diff --git a/tools/buildman/control.py b/tools/buildman/control.py index beade62408b..68dca97413f 100644 --- a/tools/buildman/control.py +++ b/tools/buildman/control.py @@ -359,8 +359,9 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, else: commits = None - tprint(GetActionSummary(options.summary, commits, board_selected, - options)) + if not options.ide: + tprint(GetActionSummary(options.summary, commits, board_selected, + options)) # We can't show function sizes without board details at present if options.show_bloat: @@ -369,7 +370,7 @@ def DoBuildman(options, args, toolchains=None, make_func=None, boards=None, options.show_errors, options.show_sizes, options.show_detail, options.show_bloat, options.list_error_boards, options.show_config, options.show_environment, options.filter_dtb_warnings, - options.filter_migration_warnings) + options.filter_migration_warnings, options.ide) if options.summary: builder.ShowSummary(commits, board_selected) else: -- 2.37.0.144.g8ac04bfd2-goog