Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp4740566ybb; Tue, 7 Apr 2020 13:32:34 -0700 (PDT) X-Google-Smtp-Source: APiQypIVlwLnUkRYqDuA/tcvu0JnudZgTjKUbFuLUsC7FY7QSAiNbRm+DxHJo/xwe2QOXP0GMjEG X-Received: by 2002:aca:7213:: with SMTP id p19mr21328oic.44.1586291554358; Tue, 07 Apr 2020 13:32:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586291554; cv=none; d=google.com; s=arc-20160816; b=cA/hGRw/PRCZLmfxYB319b08GNYgbfYqZnBHNqiPx7bVJ64MFRXmtfEZkrsgenxiM9 b2nGcbwWgVXyIbBFEyUb34LA7q6WEuONE4IFQUnKIIKxW/1uJMuXtNIU7CiXTpxB2D72 n+d/ZpKu+Rct1buvOx+Bch3B6lQwZDmw7TruG4sjjh5/802OelFMu0KXqEgEXPZcZmAE 5G3ggBdaBs+/ESjzg9Rfj9iEPiTjwkfRAyXIeQ2Gfc4QPn7P5VoArspwhdcsHavio6gm bhe4L6atHlQYessN/TsUdirKi+W0NrFn4zs4r9DQdfC8GFpUNXjfB0ratm7FH9hRYvD2 3RbA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=zKqZWyMQ8V8zQ20un6jU7HEK04ADqKGnxMMnNcQmdRY=; b=VqS/qS6qC7YxypwrrFfu7HfOJNEQp8tjt7G0PGifF+Re25LovhOu7EwKyDBSzeC3kU 6zTog9HLzEcvsEGmtr3+zvyEKPFW6NTLh5oKOUUZ4zWgq/f4MiU2kdcDvHKRgKNpQy9f FYNZ4suSrC93q9MbesnNq+gBJ5KEcFe141rRjIP6tzi+04yrICWKDF74vHyh6/1pG+n/ qqeXVLE88rzvAoJSsBEMsAuQ/9sFtfA+/StWlyYpst0TO9qjqr7z/415R4NoqoUGxffH ClIZKQHLd7ZqdVOpKB3oJbmJ2foe3XiOVa5XtIASdpFn/Yk/voXUwcpvjIJLWkFcO2d8 6JXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=a0fZT4bK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i14si1802762otk.123.2020.04.07.13.32.19; Tue, 07 Apr 2020 13:32:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=a0fZT4bK; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726420AbgDGUbV (ORCPT + 99 others); Tue, 7 Apr 2020 16:31:21 -0400 Received: from mail-pj1-f66.google.com ([209.85.216.66]:51116 "EHLO mail-pj1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726277AbgDGUbV (ORCPT ); Tue, 7 Apr 2020 16:31:21 -0400 Received: by mail-pj1-f66.google.com with SMTP id b7so106158pju.0 for ; Tue, 07 Apr 2020 13:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=zKqZWyMQ8V8zQ20un6jU7HEK04ADqKGnxMMnNcQmdRY=; b=a0fZT4bKGAAC/shPL7O9e0uWZrLTjV2ylyJY2sfBmRY6B5ZvfW0dghucSOrpamWJPY JUCYKHnWorr9tUamq/iR4giSU6tjk4oCiShBGmL782UKl0DWVLzfSxGttgdlmHeSMD8n USEybio2T7VuUT2fLczo63Ru53sMFCVzfTlT+mU1Fa/ap6GWDg2VcjCg86jjpviYRHXc Iz7So5F7Udpr9Lbhc79nVirD0nmXaF25Itbm1mm1GG9t2QNB6iWyFMa5OAL092sfbgH8 5AztG4ripU+6zZTSDZvgQZCVw8RocoC0t5NurWuTODsqnHquobk+085szhz7aVytbHti ZXwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=zKqZWyMQ8V8zQ20un6jU7HEK04ADqKGnxMMnNcQmdRY=; b=jcVdqWDd3j4SyT3hI5hAWZ8MvBQxmy2usxMBKGMJzR04Fi9X8YEvPX3pmtdABqofOO wF83Lc/YXUOCxGiIvbJ8Cj8FLQzaaN9zN5z/kbKuPAuNqU6pz1tmNnyM/lfj6vla3/05 u05W9ckHBPa/8DlIdgq5B9sSJj5WGNUgsM8Tp9d5zQEFi6z+fPxApdlBBicxVz76aac8 vBlfYMvrGhLEPYi3d65MJ1wUaX9B3+p7RQ4isWBKrp1TPcpsbzMjdFYEuAU+bD/J5csg F6msBX8URte7kDSOyD3c6IKtmCIgyrcVvBUh57wMQR7Qu08ZdSb0wQKk7TUmFGRrWxQC v6IQ== X-Gm-Message-State: AGi0PuazbK+wk1oGLDXmjTGPh/cKcJr+0pGVbOOC5a7d0fhNJmKY/U2j ymRFJQ/rsVPDNEyeHLHskVA80a768UpBT408AQ8rvQ== X-Received: by 2002:a17:90a:30c3:: with SMTP id h61mr1246223pjb.18.1586291478614; Tue, 07 Apr 2020 13:31:18 -0700 (PDT) MIME-Version: 1.0 References: <20200406221916.50008-1-vitor@massaru.org> In-Reply-To: <20200406221916.50008-1-vitor@massaru.org> From: Brendan Higgins Date: Tue, 7 Apr 2020 13:31:07 -0700 Message-ID: Subject: Re: [PATCH v3, RESEND] kunit: Fix kunit.py run --build_dir='' fails on "unclean" trees To: Vitor Massaru Iha Cc: KUnit Development , "open list:KERNEL SELFTEST FRAMEWORK" , Linux Kernel Mailing List , Shuah Khan , linux-kernel-mentees@lists.linuxfoundation.org Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 6, 2020 at 3:19 PM Vitor Massaru Iha wrote: > > Fix this bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219 I am still seeing the error described in the bug. Steps to reproduce: 1. tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig 2. make ARCH=um mrproper 3. tools/testing/kunit/kunit.py run --timeout=60 --jobs=8 --defconfig --build_dir=.kunit One other note: It should probably be done in another patch, but it would be nice if kunit.py would tell you that you need to run mrproper when the olddefconfig fails. > For some reason, the environment variable ARCH is used instead of ARCH > passed as an argument, this patch uses a copy of the env, but using > ARCH=um and CROSS_COMPILER='' to avoid this problem. > > This patch doesn't change the user's environment variables, avoiding > side effects. > > Signed-off-by: Vitor Massaru Iha > --- > v2: > - Use the correct next branch > > v3: > - Use torvalds/master branch > - Use base parameter on git send-email > --- > tools/testing/kunit/kunit_kernel.py | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py > index 63dbda2d029f..96216c699fde 100644 > --- a/tools/testing/kunit/kunit_kernel.py > +++ b/tools/testing/kunit/kunit_kernel.py > @@ -20,6 +20,7 @@ import kunit_parser > KCONFIG_PATH = '.config' > kunitconfig_path = '.kunitconfig' > BROKEN_ALLCONFIG_PATH = 'tools/testing/kunit/configs/broken_on_uml.config' > +env = dict(os.environ.copy(), ARCH='um', CROSS_COMPILE='') > > class ConfigError(Exception): > """Represents an error trying to configure the Linux kernel.""" > @@ -41,13 +42,15 @@ class LinuxSourceTreeOperations(object): > raise ConfigError(e.output) > > def make_olddefconfig(self, build_dir, make_options): > - command = ['make', 'ARCH=um', 'olddefconfig'] > + command = ['make', 'olddefconfig'] > if make_options: > command.extend(make_options) > if build_dir: > command += ['O=' + build_dir] > try: > - subprocess.check_output(command, stderr=subprocess.PIPE) > + subprocess.check_output(command, > + stderr=subprocess.PIPE, > + env=env) > except OSError as e: > raise ConfigError('Could not call make command: ' + e) > except subprocess.CalledProcessError as e: > @@ -57,9 +60,10 @@ class LinuxSourceTreeOperations(object): > kunit_parser.print_with_timestamp( > 'Enabling all CONFIGs for UML...') > process = subprocess.Popen( > - ['make', 'ARCH=um', 'allyesconfig'], > + ['make', 'allyesconfig'], > stdout=subprocess.DEVNULL, > - stderr=subprocess.STDOUT) > + stderr=subprocess.STDOUT, > + env=env) > process.wait() > kunit_parser.print_with_timestamp( > 'Disabling broken configs to run KUnit tests...') > @@ -71,13 +75,13 @@ class LinuxSourceTreeOperations(object): > 'Starting Kernel with all configs takes a few minutes...') > > def make(self, jobs, build_dir, make_options): > - command = ['make', 'ARCH=um', '--jobs=' + str(jobs)] > + command = ['make', '--jobs=' + str(jobs)] > if make_options: > command.extend(make_options) > if build_dir: > command += ['O=' + build_dir] > try: > - subprocess.check_output(command) > + subprocess.check_output(command, env=env) > except OSError as e: > raise BuildError('Could not call execute make: ' + e) > except subprocess.CalledProcessError as e: > @@ -91,7 +95,8 @@ class LinuxSourceTreeOperations(object): > with open(outfile, 'w') as output: > process = subprocess.Popen([linux_bin] + params, > stdout=output, > - stderr=subprocess.STDOUT) > + stderr=subprocess.STDOUT, > + env=env) > process.wait(timeout) > > > > base-commit: 7e63420847ae5f1036e4f7c42f0b3282e73efbc2 > -- > 2.25.1 >