Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3762156ybb; Tue, 31 Mar 2020 11:28:31 -0700 (PDT) X-Google-Smtp-Source: APiQypIxnCCP8qZAU9dr8FrUWcrwaaoDWOC7sWETAiTP9o0Q9CeQl//bFC94b0S3hmzNEKu83pbT X-Received: by 2002:aca:534d:: with SMTP id h74mr116272oib.173.1585679311495; Tue, 31 Mar 2020 11:28:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1585679311; cv=none; d=google.com; s=arc-20160816; b=hqiwkQaxWiHUM9z4cNWxBfMBuYOm1fOO6EqufE1Kpu/dlVDxcjk5ikVIMn53N6CmfP 0KBMxFyavmCTLOJr96zp1nml538KUfWys180nSfhqSHLBPNxso5Ws10qcH5ym+VNRErx /1kox2V/ur6slFER2VRTsEeBjzOHkUuCAraNOheII8l+QgCmBa7eSo7QHqenRgbmh/8b v2M7RDDq3ce2ZdJgcnbkMin4rZ9w9JhW6OqPH0x56/8V3zmPtyiM7t0WvyOgrBEbvfic fdmnMKbfpisltzxgYWEY+S/RCCc8eOx5XdkXsXOr9Sz5TiYeMSqLnbVIK8sRVzHcmCw7 ByZA== 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=zLVDD+NzMHaNk3lT9nXy779lPxGGvFl1BeZrYwA43Fw=; b=QllV44nuiA5xig6vQuKQeJFUycg7lYHpGcrj68XnK/B+k5+0Arqn/wZvq0Y7aT+U3z XdHlSfvYP3KS7bb3Q0VrgNFIn9yACF0d+DwykNfU6KHi4jUf6kJxB6XYZP/T6pdBbHGW Gnjrte1i2yxW/pb+lNj/ai1t7z0dbJruQzoR5gakAHW1KUg+Uat47EIR70rdmOnK8mes rwC5epRysxyEfFnL5hMz7CjKt00gUezJTPIrBTr8BlzuLgTes3ZDpkWCAyCWA0UdpmMg RxlKsvxkmH0e8JSHPuCFzE3yNh6pCi2yDcn74xCvwjldoNQQ31c//4fR9q7jW1NOuQIe 0BjA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=eZaUbKqB; 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 c20si7171660otf.37.2020.03.31.11.28.17; Tue, 31 Mar 2020 11:28:31 -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=eZaUbKqB; 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 S1727549AbgCaS1b (ORCPT + 99 others); Tue, 31 Mar 2020 14:27:31 -0400 Received: from mail-pl1-f193.google.com ([209.85.214.193]:33812 "EHLO mail-pl1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726000AbgCaS1b (ORCPT ); Tue, 31 Mar 2020 14:27:31 -0400 Received: by mail-pl1-f193.google.com with SMTP id a23so8439714plm.1 for ; Tue, 31 Mar 2020 11:27:30 -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=zLVDD+NzMHaNk3lT9nXy779lPxGGvFl1BeZrYwA43Fw=; b=eZaUbKqBQsAGEDWohcgVWreqYFpuy1mtBi8+zOZFx4hKtYXVoodnXBRoqO5ffqHmyJ s+TE9G2H7Wez9Qr9x1vq0LGjzrhad/x5PKrJ1+UMhBbOBxRBDX7ry0dL3vIHj1k75YVv 7NqwAL+5p8OUn3W7fOUI219Glds7agiAj/hLMgByUGeC2b9+fW2EpYPyKoQw6c1z9g3U KtK6Ia2Gx7k5g6CjE4Kc2Bo18fYpsJSHTS25OlRYlqeE/r4+8wLTDR9rmVMqcQ6Y2JtF sUNYHN8gSJS9S2L1MfGM/RZnGtHHdFTIfnHnyhceOUiyeOifHVSMKIDrD/KANnLQ7Th5 O28w== 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=zLVDD+NzMHaNk3lT9nXy779lPxGGvFl1BeZrYwA43Fw=; b=QJhwthn2E/gk4ooZxbRQLvVdp+schYtc1VptJ/Is76+snDnzJ/uu+Eb5LSnbMOnnnB LPMTkSNkCvgcjSm6eBMxHC25J6hj/zm7IugEyfPZKF/j01EGwfz3Sk5ZqeSJ/DAmcVuq f13+VpYTr5DbiVDBtOzKP1SYdURTVE6Yj7tSFriE/uCI2HZLlAAmyMpIVNG2fnFN6DI+ zuB80QQSnYPQiBkSX3EAXwq1noQ99seM5shqmGNpTZAxRHP78KM2MB06qPQCa6ux7MS5 1wR8/WypdjIcjmKBjbp+KaVm7Xyc7/6gpALOuAHZtz1rCs9zdeBfTalN/QaAHbLSAHzi RMyg== X-Gm-Message-State: AGi0Pub4xB0V/0Fn0d8G0/dYoifEt8sacG7ybyBi+r6/fsmZrSIRWXQO xl+mORlNdNpmn40qYa8t5O468KhZJxOkb4ww6/ENjkUYedA= X-Received: by 2002:a17:90a:9f03:: with SMTP id n3mr209849pjp.29.1585679249825; Tue, 31 Mar 2020 11:27:29 -0700 (PDT) MIME-Version: 1.0 References: <20200330230256.28323-1-vitor@massaru.org> In-Reply-To: <20200330230256.28323-1-vitor@massaru.org> From: Brendan Higgins Date: Tue, 31 Mar 2020 11:27:18 -0700 Message-ID: Subject: Re: [PATCH] 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, Mar 30, 2020 at 4:03 PM Vitor Massaru Iha wrote: > > Fix this bug: https://bugzilla.kernel.org/show_bug.cgi?id=205219 > > 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. Seems reasonable to me. > Signed-off-by: Vitor Massaru Iha I cannot test this as your patch doesn't apply to our for-next branch (kselftest/kunit). You can find it here: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/log/?h=kunit > --- > tools/testing/kunit/kunit_kernel.py | 12 +++++++----- > 1 file changed, 7 insertions(+), 5 deletions(-) > > diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py > index d99ae75ef72f..0cb1f81ac8f2 100644 > --- a/tools/testing/kunit/kunit_kernel.py > +++ b/tools/testing/kunit/kunit_kernel.py > @@ -15,6 +15,7 @@ import kunit_config > > KCONFIG_PATH = '.config' > kunitconfig_path = '.kunitconfig' > +env = dict(os.environ.copy(), ARCH='um', CROSS_COMPILE='') > > class ConfigError(Exception): > """Represents an error trying to configure the Linux kernel.""" > @@ -36,22 +37,22 @@ class LinuxSourceTreeOperations(object): > raise ConfigError(e.output) > > def make_olddefconfig(self, build_dir): > - command = ['make', 'ARCH=um', 'olddefconfig'] > + command = ['make', 'olddefconfig'] > if build_dir: > command += ['O=' + build_dir] > try: > - subprocess.check_output(command) > + subprocess.check_output(command, env=env) > except OSError as e: > raise ConfigError('Could not call make command: ' + e) > except subprocess.CalledProcessError as e: > raise ConfigError(e.output) > > def make(self, jobs, build_dir): > - command = ['make', 'ARCH=um', '--jobs=' + str(jobs)] > + command = ['make', '--jobs=' + str(jobs)] > 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: > @@ -66,7 +67,8 @@ class LinuxSourceTreeOperations(object): > [linux_bin] + params, > stdin=subprocess.PIPE, > stdout=subprocess.PIPE, > - stderr=subprocess.PIPE) > + stderr=subprocess.PIPE, > + env=env) > process.wait(timeout=timeout) > return process > > -- > 2.21.1 >