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 X-Spam-Level: X-Spam-Status: No, score=-25.9 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT,USER_IN_DEF_DKIM_WL autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE473C2D0A8 for ; Mon, 28 Sep 2020 20:02:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9912E20773 for ; Mon, 28 Sep 2020 20:02:35 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="kgMsNRR4" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726565AbgI1UCe (ORCPT ); Mon, 28 Sep 2020 16:02:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35068 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726389AbgI1UCe (ORCPT ); Mon, 28 Sep 2020 16:02:34 -0400 Received: from mail-qt1-x84a.google.com (mail-qt1-x84a.google.com [IPv6:2607:f8b0:4864:20::84a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 32645C0613CE for ; Mon, 28 Sep 2020 13:02:34 -0700 (PDT) Received: by mail-qt1-x84a.google.com with SMTP id y53so1456862qth.2 for ; Mon, 28 Sep 2020 13:02:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=sender:date:message-id:mime-version:subject:from:to:cc; bh=qL5Syy8+3ttyyqiRvm5VTzTd/DUJS6pVMwN6er+/rg8=; b=kgMsNRR490LnADrp/cWDm0iw+yCuETRFvp/AyXuKQSSg/OVqUS+1S1+2pydIg3pAqZ v7ufhfqBqg1TC9YxQSh1Q7OVeyv5zVFTD3sox/lVUT5tAav9mqlM7uaUxkY8ySpKC6l2 VGqHVCLeC72E2IpgGJHpavVEg1yPzu0mKXLJoSADzEBEIYnFXsWa1guYrAGbMWps+xnx 2tEjBogTAp16uNh+rQazS/BA+NfQ3qyCsneXHFdeC9lMhy7eis2E13P/vypBK/2YJA4L Nvqfa/8elV0uvfG1+9Z1geOLOf+S7Yzh3DZn+BwX9MQJ01Vq15C6eehSKvjFVs3gtJjH JJ5Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:message-id:mime-version:subject:from :to:cc; bh=qL5Syy8+3ttyyqiRvm5VTzTd/DUJS6pVMwN6er+/rg8=; b=Cpjj0I856Hb8dnZDhcPLhzF9PWVvFMwHLUkFJkgqXUl3zN5yCmKayWVF5/pTKh8aIo b1vdpbZQRdjmWLhdfvFhBG4ZVkDB4oGhq9ZqvHU2eiTKj8/Yg+VjeCsTt/Uu0DZkSJUb L14/8qI2sjcPaF0FGGdcleMUMDJwncHhNYak/9rBZ2TMCMDBOExtKCAzemxdny8la3wL t8HjtoKvIk/fOLDv+JXea9sSGbK4YkNCCBanMTxUdvN4Aj9gG0tL3QJvww2ap+AUcR88 /fFUBZCuZr2Xq97IgcSDqFKf+mywIdP4T18O/UP3IikE81U54bjZr6fqZKu+XCQdncPD orcw== X-Gm-Message-State: AOAM530PPBOmuV/SZYzH+3PaOUsK3TLL1pzbhmcB/VfWbj1g+07GZ61w SykNPLkBBiwcxysuel0zvwxAC4xgjhzfhZbE/+PwkA== X-Google-Smtp-Source: ABdhPJwlpAgc49EHBQLGLvlfofCp56Etax44tKciebXkaioeGhdT0vhAr76RDGb4uh3NVGQltEf/a3Xpyxr4gf0hdYwV1w== Sender: "brendanhiggins via sendgmr" X-Received: from mactruck.svl.corp.google.com ([2620:15c:2cb:201:c634:6bff:fe71:d8d1]) (user=brendanhiggins job=sendgmr) by 2002:a0c:9d03:: with SMTP id m3mr1127139qvf.54.1601323353193; Mon, 28 Sep 2020 13:02:33 -0700 (PDT) Date: Mon, 28 Sep 2020 13:02:27 -0700 Message-Id: <20200928200227.835600-1-brendanhiggins@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.28.0.681.g6f77f65b4e-goog Subject: [PATCH v1] kunit: tool: handle when .kunit exists but .kunitconfig does not From: Brendan Higgins To: shuah@kernel.org, davidgow@google.com Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-kernel@vger.kernel.org, Brendan Higgins Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Right now .kunitconfig and the build dir are automatically created if the build dir does not exists; however, if the build dir is present and .kunitconfig is not, kunit_tool will crash. Fix this by checking for both the build dir as well as the .kunitconfig. NOTE: This depends on commit 5578d008d9e0 ("kunit: tool: fix running kunit_tool from outside kernel tree") Link: https://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest.git/commit/?id=5578d008d9e06bb531fb3e62dd17096d9fd9c853 Signed-off-by: Brendan Higgins --- tools/testing/kunit/kunit.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/tools/testing/kunit/kunit.py b/tools/testing/kunit/kunit.py index e2caf4e24ecb2..8ab17e21a3578 100755 --- a/tools/testing/kunit/kunit.py +++ b/tools/testing/kunit/kunit.py @@ -243,6 +243,8 @@ def main(argv, linux=None): if cli_args.subcommand == 'run': if not os.path.exists(cli_args.build_dir): os.mkdir(cli_args.build_dir) + + if not os.path.exists(kunit_kernel.kunitconfig_path): create_default_kunitconfig() if not linux: @@ -258,10 +260,12 @@ def main(argv, linux=None): if result.status != KunitStatus.SUCCESS: sys.exit(1) elif cli_args.subcommand == 'config': - if cli_args.build_dir: - if not os.path.exists(cli_args.build_dir): - os.mkdir(cli_args.build_dir) - create_default_kunitconfig() + if cli_args.build_dir and ( + not os.path.exists(cli_args.build_dir)): + os.mkdir(cli_args.build_dir) + + if not os.path.exists(kunit_kernel.kunitconfig_path): + create_default_kunitconfig() if not linux: linux = kunit_kernel.LinuxSourceTree() base-commit: d96fe1a5485fa978a6e3690adc4dbe4d20b5baa4 -- 2.28.0.681.g6f77f65b4e-goog