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 77BD1C61DA3 for ; Tue, 21 Feb 2023 19:40:52 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 906A285A85; Tue, 21 Feb 2023 20:40:45 +0100 (CET) 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="Hx17ngjS"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C673685A8C; Tue, 21 Feb 2023 20:40:40 +0100 (CET) Received: from mail-il1-x12a.google.com (mail-il1-x12a.google.com [IPv6:2607:f8b0:4864:20::12a]) (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 BBA8785AB0 for ; Tue, 21 Feb 2023 20:40:36 +0100 (CET) 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-il1-x12a.google.com with SMTP id b16so2261791iln.3 for ; Tue, 21 Feb 2023 11:40:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CGk1NJN4AAjl8jifsc0d1mWqR37HPWEMqOi/suIIrMU=; b=Hx17ngjSnBrYMvg2nO7njEZOor3WDJj9PChOFV0lPjd7YJ7zFWAytU5c5al/oypXak cycI5JxSeKDiUC6o/mT6QTVH30JHJ8ohFgniptMuOGHYkd+77JoUg+sj7rCdueJJRQeX uXwGJ9bOpLy91rJLiGij8QIOz2z+9BUENsJPs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CGk1NJN4AAjl8jifsc0d1mWqR37HPWEMqOi/suIIrMU=; b=bc7D/0h0YJh3/uwkfUfDkZla76lvmcc7JyNQtMJNSJv788E7mDwfXuUHZSUzVN7lZt ThcarlWAi2I7gEz8o2TrgZOK388QHt6I1pyE23QwiGlJGFC3h36LBY1e5LaznRcLzq9Y DnTu6sD02CEw8Zub6UkXBVBxNinBQcJGGFRECGDf7oKvmz7CdR53BruVRN4LSAIOJCBj RUHlsE/fFEd6oKhNHO14BCgPQK14kltsKF0HNglPq+Lt1GrTUvQGnsVvaF9gkIYCGgVM Ioy/iAd0+Lj/9TnExeq64+eVzBjrSG25oYKJp+CHZja+JEzAHnzEzBbCdghMBA0if6FD H0IQ== X-Gm-Message-State: AO0yUKVdO9V8uB1VckrRxJPfk3QgqFHyEmCixhiDbYOvmvYFS9d7f9/Y XT4NqeH1lmGqM62nihFSBsTL772zo9ocVRi2 X-Google-Smtp-Source: AK7set+UayMbCKM9a6kLd6Z8DvaNZXgvIVv24ofiNdF8XsC9mp60RMoO7VjBSRJjhLzdTtCyjgFx7Q== X-Received: by 2002:a92:760c:0:b0:315:40d1:62a3 with SMTP id r12-20020a92760c000000b0031540d162a3mr5453891ilc.24.1677008435398; Tue, 21 Feb 2023 11:40:35 -0800 (PST) Received: from kea.bld.corp.google.com ([2620:15c:183:200:1881:c364:3f89:6383]) by smtp.gmail.com with ESMTPSA id g22-20020a02cd16000000b003c86e420f9fsm2029678jaq.100.2023.02.21.11.40.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 21 Feb 2023 11:40:35 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Simon Glass Subject: [PATCH v2 2/4] buildman: Write out the build command used Date: Tue, 21 Feb 2023 12:40:27 -0700 Message-Id: <20230221194029.3547480-2-sjg@chromium.org> X-Mailer: git-send-email 2.39.2.637.g21b0678d19-goog In-Reply-To: <20230221194029.3547480-1-sjg@chromium.org> References: <20230221194029.3547480-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 It is sometimes useful to see the exact 'make' command used by buildman for a commit. Add an output file for this. Signed-off-by: Simon Glass --- (no changes since v1) tools/buildman/builderthread.py | 13 +++++++++++++ tools/buildman/buildman.rst | 8 ++++++++ tools/buildman/func_test.py | 13 +++++++++++++ 3 files changed, 34 insertions(+) diff --git a/tools/buildman/builderthread.py b/tools/buildman/builderthread.py index 680efae02d7..7ba9a856dd5 100644 --- a/tools/buildman/builderthread.py +++ b/tools/buildman/builderthread.py @@ -273,14 +273,19 @@ class BuilderThread(threading.Thread): # If we need to reconfigure, do that now cfg_file = os.path.join(out_dir, '.config') + cmd_list = [] if do_config or adjust_cfg: config_out = '' if self.mrproper: result = self.Make(commit, brd, 'mrproper', cwd, 'mrproper', *args, env=env) config_out += result.combined + cmd_list.append([self.builder.gnu_make, 'mrproper', + *args]) result = self.Make(commit, brd, 'config', cwd, *(args + config_args), env=env) + cmd_list.append([self.builder.gnu_make] + args + + config_args) config_out += result.combined do_config = False # No need to configure next time if adjust_cfg: @@ -290,6 +295,7 @@ class BuilderThread(threading.Thread): args.append('cfg') result = self.Make(commit, brd, 'build', cwd, *args, env=env) + cmd_list.append([self.builder.gnu_make] + args) if (result.return_code == 2 and ('Some images are invalid' in result.stderr)): # This is handled later by the check for output in @@ -303,6 +309,7 @@ class BuilderThread(threading.Thread): result.stderr = result.stderr.replace(src_dir + '/', '') if self.builder.verbose_build: result.stdout = config_out + result.stdout + result.cmd_list = cmd_list else: result.return_code = 1 result.stderr = 'No tool chain for %s\n' % brd.arch @@ -378,6 +385,12 @@ class BuilderThread(threading.Thread): with open(os.path.join(build_dir, 'out-env'), 'wb') as fd: for var in sorted(env.keys()): fd.write(b'%s="%s"' % (var, env[var])) + + with open(os.path.join(build_dir, 'out-cmd'), 'w', + encoding='utf-8') as fd: + for cmd in result.cmd_list: + print(' '.join(cmd), file=fd) + lines = [] for fname in BASE_ELF_FILENAMES: cmd = ['%snm' % self.toolchain.cross, '--size-sort', fname] diff --git a/tools/buildman/buildman.rst b/tools/buildman/buildman.rst index 9a2d913c785..11c72141791 100644 --- a/tools/buildman/buildman.rst +++ b/tools/buildman/buildman.rst @@ -1300,6 +1300,14 @@ You should use 'buildman -nv ' instead of greoing the boards.cfg file, since it may be dropped altogether in future. +Checking the command +-------------------- + +Buildman writes out the toolchain information to a `toolchain` file within the +output directory. It also writes the commands used to build U-Boot in an +`out-cmd` file. You can check these if you suspect something strange is +happening. + TODO ---- diff --git a/tools/buildman/func_test.py b/tools/buildman/func_test.py index 559e4edf74b..799c609446e 100644 --- a/tools/buildman/func_test.py +++ b/tools/buildman/func_test.py @@ -723,3 +723,16 @@ Some images are invalid''' control.get_allow_missing(False, False, 2, True)) self.assertEqual(False, control.get_allow_missing(False, True, 2, True)) + + def testCmdFile(self): + """Test that the -cmd-out file is produced""" + self._RunControl('-o', self._output_dir) + board0_dir = os.path.join(self._output_dir, 'current', 'board0') + self.assertTrue(os.path.exists(os.path.join(board0_dir, 'done'))) + cmd_fname = os.path.join(board0_dir, 'out-cmd') + self.assertTrue(os.path.exists(cmd_fname)) + data = tools.read_file(cmd_fname) + lines = data.splitlines() + self.assertEqual(2, len(lines)) + self.assertRegex(lines[0], b'make O=/.*board0_defconfig') + self.assertRegex(lines[0], b'make O=/.*-s.*') -- 2.39.2.637.g21b0678d19-goog