Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4251797pxu; Mon, 12 Oct 2020 13:46:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyk2KNd3u0W5fkSmM8SlBYW3Di78X/qClfTJCkRXh6I8N8LhiyiaPLaUCEZZS/n7QUqq6ks X-Received: by 2002:aa7:cad6:: with SMTP id l22mr16497696edt.229.1602535575023; Mon, 12 Oct 2020 13:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602535575; cv=none; d=google.com; s=arc-20160816; b=IgUt2KOhTPqHIz5SqlcbKkDCBYEHuVoUfWckSv3WzdRQENtPx33L/bzNb6iHdgTyYK DnWhzAhumY0lk6O1Gg0uZiHAvhPjwZv1fZ8tNjJ5DozxJ8r2hpxrgcP62nCWvfalWLKr NRkRgF4glPuabh6Pt8452IC3y45eFWThfWlKCTpqccDCILBrdNR6Pp4n5MvmU9Yj0TA/ wfVkSIm5AfeQeewM/dZ3dP0GMcGkHdAo1VgS14HMCPOwdLSsCg/GHuGsCALADS4YE9sA 8dfl9wUy15rQDouBDGX0cOGCYaEf3btWL95Rj4xdKe1AIiLcuiSF5F8Lo0k+62iQFd3q 4qgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from :dkim-signature; bh=kFB+hAuY3HYTUl9UemGcD/WxoJMOPU0+vmjpowmsqcc=; b=xsK6yXDmFtJygzWUxLPYIhtRpfwATeqFNoEDZobG3rWZ0jJwgPNRbEC1LxbF22PHs1 iAtzlEd/LM1ynYNRVm5srd1T6KmqNTnMYYcpb7bG1JdlIzTeP7Fd0NBIeFFnahtJKhU8 ztuoslfvx1nw10yrlQk6EHdeTQqTDstQCxdFBmuwMWhcIpF9LXfbYPfZjhL44hWVpMHW 2olfbCjPwNSV9riczrdClR4CKos/2mcOt0eXBrtdm4CVXfdt9Q1bn+XgstamEYT78XqD lFXFaWD+tL9DzfK6klqFHi+OrL5OCW/Hj/gGw9YM76hEy6lIHdWMd2gjYXp4wBpGtNsL 4v9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=DCDeCCol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i23si5774901ejj.284.2020.10.12.13.45.51; Mon, 12 Oct 2020 13:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@amazon.com header.s=amazon201209 header.b=DCDeCCol; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amazon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387530AbgJLKaD (ORCPT + 99 others); Mon, 12 Oct 2020 06:30:03 -0400 Received: from smtp-fw-6001.amazon.com ([52.95.48.154]:37041 "EHLO smtp-fw-6001.amazon.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387461AbgJLKaD (ORCPT ); Mon, 12 Oct 2020 06:30:03 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amazon.com; i=@amazon.com; q=dns/txt; s=amazon201209; t=1602498602; x=1634034602; h=from:to:cc:subject:date:message-id:mime-version; bh=kFB+hAuY3HYTUl9UemGcD/WxoJMOPU0+vmjpowmsqcc=; b=DCDeCColJJMzEnmc2sOU/Uy9qTZhaUGRhh/UMNaR3kwOF5tyHTa+rHR6 yF7V6aukwkaQzo8f6m+slLIWIlbnpEYKxCeuoIuhDUrMUkyZeUfy2tlIv iKxpB5tg2TELEia4V4pomxajPxPExUxZEj6x7s8ZSpk7NrEMOITHBn1HH 4=; X-IronPort-AV: E=Sophos;i="5.77,366,1596499200"; d="scan'208";a="60718120" Received: from iad12-co-svc-p1-lb1-vlan3.amazon.com (HELO email-inbound-relay-2a-e7be2041.us-west-2.amazon.com) ([10.43.8.6]) by smtp-border-fw-out-6001.iad6.amazon.com with ESMTP; 12 Oct 2020 10:29:55 +0000 Received: from EX13D31EUA001.ant.amazon.com (pdx4-ws-svc-p6-lb7-vlan2.pdx.amazon.com [10.170.41.162]) by email-inbound-relay-2a-e7be2041.us-west-2.amazon.com (Postfix) with ESMTPS id 7F357A0298; Mon, 12 Oct 2020 10:26:46 +0000 (UTC) Received: from u3f2cd687b01c55.ant.amazon.com (10.43.160.185) by EX13D31EUA001.ant.amazon.com (10.43.165.15) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Mon, 12 Oct 2020 10:26:42 +0000 From: SeongJae Park To: CC: SeongJae Park , , , , Subject: [PATCH 1/2] kunit: tool: Fix LinuxSourceTree's missed handling of 'build_dir' Date: Mon, 12 Oct 2020 12:26:20 +0200 Message-ID: <20201012102621.32226-1-sjpark@amazon.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.43.160.185] X-ClientProxiedBy: EX13D17UWC004.ant.amazon.com (10.43.162.195) To EX13D31EUA001.ant.amazon.com (10.43.165.15) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: SeongJae Park Because commit d43c7fb05765 ("kunit: tool: fix improper treatment of file location") removed 'kunit_kernel.kunitconfig_path' modification for the '--builddir' argument, running kunit with '--build_dir' now fails with below error message: Traceback (most recent call last): File "./tools/testing/kunit/kunit.py", line 325, in main(sys.argv[1:]) File "./tools/testing/kunit/kunit.py", line 245, in main linux = kunit_kernel.LinuxSourceTree() File "/home/sjpark/linux/tools/testing/kunit/kunit_kernel.py", line 109, in __init__ self._kconfig.read_from_file(kunitconfig_path) File "/home/sjpark/linux/tools/testing/kunit/kunit_config.py", line 88, in read_from_file with open(path, 'r') as f: FileNotFoundError: [Errno 2] No such file or directory: '.kunitconfig' As simply reverting the change now make the 'kunit_tool_test' fails again, this commit fixes the problem by passing the 'build_dir' argument to 'LinuxSourceTree' constructor. Fixes: d43c7fb05765 ("kunit: tool: fix improper treatment of file location") Signed-off-by: SeongJae Park --- tools/testing/kunit/kunit.py | 8 ++++---- tools/testing/kunit/kunit_kernel.py | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index 425ef40067e7..611c23e178f8 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -242,7 +242,7 @@ def main(argv, linux=None): os.mkdir(cli_args.build_dir) if not linux: - linux = kunit_kernel.LinuxSourceTree() + linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir) request = KunitRequest(cli_args.raw_output, cli_args.timeout, @@ -259,7 +259,7 @@ def main(argv, linux=None): os.mkdir(cli_args.build_dir) if not linux: - linux = kunit_kernel.LinuxSourceTree() + linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir) request = KunitConfigRequest(cli_args.build_dir, cli_args.make_options) @@ -275,7 +275,7 @@ def main(argv, linux=None): os.mkdir(cli_args.build_dir) if not linux: - linux = kunit_kernel.LinuxSourceTree() + linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir) request = KunitBuildRequest(cli_args.jobs, cli_args.build_dir, @@ -293,7 +293,7 @@ def main(argv, linux=None): os.mkdir(cli_args.build_dir) if not linux: - linux = kunit_kernel.LinuxSourceTree() + linux = kunit_kernel.LinuxSourceTree(cli_args.build_dir) exec_request = KunitExecRequest(cli_args.timeout, cli_args.build_dir, diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index e20e2056cb38..16a997504317 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -104,9 +104,9 @@ def get_kconfig_path(build_dir): class LinuxSourceTree(object): """Represents a Linux kernel source tree with KUnit tests.""" - def __init__(self): + def __init__(self, build_dir): self._kconfig = kunit_config.Kconfig() - self._kconfig.read_from_file(kunitconfig_path) + self._kconfig.read_from_file(os.path.join(build_dir, kunitconfig_path)) self._ops = LinuxSourceTreeOperations() signal.signal(signal.SIGINT, self.signal_handler) -- 2.17.1