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 A39A1C433EF for ; Sat, 29 Jan 2022 21:15:54 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 21F0F837D2; Sat, 29 Jan 2022 22:15:03 +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="dylkY1RI"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 5AD39836A3; Sat, 29 Jan 2022 22:14:50 +0100 (CET) Received: from mail-io1-xd31.google.com (mail-io1-xd31.google.com [IPv6:2607:f8b0:4864:20::d31]) (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 763B4836AD for ; Sat, 29 Jan 2022 22:14:41 +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-io1-xd31.google.com with SMTP id d188so12026425iof.7 for ; Sat, 29 Jan 2022 13:14:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LcMgno9DgbhrRSG1jGSs1JhVQSlFnRaxn73nkU26qDw=; b=dylkY1RImDzYJKqabh+YrUjQHlw8PrfD/zs6Z1h5Bwm48YMThtGos2u4HPm82z5pKo viA5yw71r+FZBOLHaPflQgS254GI6qAUlmtLAZOTQYBCYUCJ0la0nuvl7FYRBbVuPkcT nMQ2vWyC7e5wGm+8YQqAFqnKJGNUEPGqMFxr4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LcMgno9DgbhrRSG1jGSs1JhVQSlFnRaxn73nkU26qDw=; b=TbZ6mvLu0EVjmgOqQ3Hf/hDOg6iByQa0cQEfeeZh/skyEls0/gqavEPtwqGRHDbXC/ Z3NTJyykcb9GGDfyCojMd7k3W3fEVTXYx55/wI2ylkh3DhMR3F6IafG34QiNKK4BBOaH 36SvRFQrF8dgLrI2g30dqAlgR/oAFFjG6fmqDvYNOWnQJwA8rfdnq0XAM+mH+YT+kwbO uShSeP+r3V20+M4xa+GZH5fV5ztx4uYLydbuGEIL/s/3fPs9eNtwfVUlcXTTC8eCvknR MyiWro//WPEt2G3sDOT+0/3fsFCWVuD8a1S/aDSyxTpemITjmOBlbNcLdI6Ug/6xRcDm unJA== X-Gm-Message-State: AOAM53112ZZROpi7aJ5UmoZMJwje/QJ9cWnaaKk6b3zVHmMd3taDNYrl YvhLVCfEDf0fst7O8kno9ul8SS7t4PYhPA== X-Google-Smtp-Source: ABdhPJxBQC/pQgfc6SgXY4IhGyOC02fDdOgk/ZDvX7jpKdmhK+9TfC5SM6WocnYS7l8qxBI5OdtQVQ== X-Received: by 2002:a05:6638:1ea:: with SMTP id t10mr7551776jaq.77.1643490880087; Sat, 29 Jan 2022 13:14:40 -0800 (PST) Received: from kiwi.bld.corp.google.com (c-67-190-101-114.hsd1.co.comcast.net. [67.190.101.114]) by smtp.gmail.com with ESMTPSA id c3sm17218110iow.28.2022.01.29.13.14.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Jan 2022 13:14:39 -0800 (PST) From: Simon Glass To: U-Boot Mailing List Cc: Heinrich Schuchardt , Tom Rini , Simon Glass Subject: [PATCH 10/17] patman: Convert camel case in test_checkpatch.py Date: Sat, 29 Jan 2022 14:14:13 -0700 Message-Id: <20220129211420.528117-11-sjg@chromium.org> X-Mailer: git-send-email 2.35.0.rc2.247.g8bbb082509-goog In-Reply-To: <20220129211420.528117-1-sjg@chromium.org> References: <20220129211420.528117-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.5 at phobos.denx.de X-Virus-Status: Clean Convert this file to snake case and update all files which use it. Signed-off-by: Simon Glass --- tools/patman/test_checkpatch.py | 68 ++++++++++++++++----------------- 1 file changed, 34 insertions(+), 34 deletions(-) diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py index cf6cb713b76..8960cd505f8 100644 --- a/tools/patman/test_checkpatch.py +++ b/tools/patman/test_checkpatch.py @@ -88,7 +88,7 @@ Signed-off-by: Simon Glass class TestPatch(unittest.TestCase): """Test the u_boot_line() function in checkpatch.pl""" - def testBasic(self): + def test_basic(self): """Test basic filter operation""" data=''' @@ -164,7 +164,7 @@ Signed-off-by: Simon Glass os.remove(inname) os.remove(expname) - def GetData(self, data_type): + def get_data(self, data_type): data='''From 4924887af52713cabea78420eff03badea8f0035 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Thu, 7 Apr 2011 10:14:41 -0700 @@ -284,17 +284,17 @@ index 0000000..2234c87 print('not implemented') return data % (signoff, license, tab, indent, tab) - def SetupData(self, data_type): + def setup_data(self, data_type): inhandle, inname = tempfile.mkstemp() infd = os.fdopen(inhandle, 'w') - data = self.GetData(data_type) + data = self.get_data(data_type) infd.write(data) infd.close() return inname - def testGood(self): + def test_good(self): """Test checkpatch operation""" - inf = self.SetupData('good') + inf = self.setup_data('good') result = checkpatch.check_patch(inf) self.assertEqual(result.ok, True) self.assertEqual(result.problems, []) @@ -304,8 +304,8 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) - def testNoSignoff(self): - inf = self.SetupData('no-signoff') + def test_no_signoff(self): + inf = self.setup_data('no-signoff') result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) @@ -315,8 +315,8 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) - def testNoLicense(self): - inf = self.SetupData('no-license') + def test_no_license(self): + inf = self.setup_data('no-license') result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) @@ -326,8 +326,8 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) - def testSpaces(self): - inf = self.SetupData('spaces') + def test_spaces(self): + inf = self.setup_data('spaces') result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 3) @@ -337,8 +337,8 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) - def testIndent(self): - inf = self.SetupData('indent') + def test_indent(self): + inf = self.setup_data('indent') result = checkpatch.check_patch(inf) self.assertEqual(result.ok, False) self.assertEqual(len(result.problems), 1) @@ -348,7 +348,7 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) - def checkSingleMessage(self, pm, msg, pmtype = 'warning'): + def check_single_message(self, pm, msg, pmtype = 'warning'): """Helper function to run checkpatch and check the result Args: @@ -366,50 +366,50 @@ index 0000000..2234c87 self.assertEqual(len(result.problems), 1) self.assertIn(msg, result.problems[0]['cptype']) - def testUclass(self): + def test_uclass(self): """Test for possible new uclass""" pm = PatchMaker() pm.add_line('include/dm/uclass-id.h', 'UCLASS_WIBBLE,') - self.checkSingleMessage(pm, 'NEW_UCLASS') + self.check_single_message(pm, 'NEW_UCLASS') - def testLivetree(self): + def test_livetree(self): """Test for using the livetree API""" pm = PatchMaker() pm.add_line('common/main.c', 'fdtdec_do_something()') - self.checkSingleMessage(pm, 'LIVETREE') + self.check_single_message(pm, 'LIVETREE') - def testNewCommand(self): + def test_new_command(self): """Test for adding a new command""" pm = PatchMaker() pm.add_line('common/main.c', 'do_wibble(struct cmd_tbl *cmd_tbl)') - self.checkSingleMessage(pm, 'CMD_TEST') + self.check_single_message(pm, 'CMD_TEST') - def testPreferIf(self): + def test_prefer_if(self): """Test for using #ifdef""" pm = PatchMaker() pm.add_line('common/main.c', '#ifdef CONFIG_YELLOW') pm.add_line('common/init.h', '#ifdef CONFIG_YELLOW') pm.add_line('fred.dtsi', '#ifdef CONFIG_YELLOW') - self.checkSingleMessage(pm, "PREFER_IF") + self.check_single_message(pm, "PREFER_IF") - def testCommandUseDefconfig(self): + def test_command_use_defconfig(self): """Test for enabling/disabling commands using preprocesor""" pm = PatchMaker() pm.add_line('common/main.c', '#undef CONFIG_CMD_WHICH') - self.checkSingleMessage(pm, 'DEFINE_CONFIG_CMD', 'error') + self.check_single_message(pm, 'DEFINE_CONFIG_CMD', 'error') - def testBarredIncludeInHdr(self): + def test_barred_include_in_hdr(self): """Test for using a barred include in a header file""" pm = PatchMaker() #pm.add_line('include/myfile.h', '#include ') pm.add_line('include/myfile.h', '#include ') - self.checkSingleMessage(pm, 'BARRED_INCLUDE_IN_HDR', 'error') + self.check_single_message(pm, 'BARRED_INCLUDE_IN_HDR', 'error') - def testConfigIsEnabledConfig(self): + def test_config_is_enabled_config(self): """Test for accidental CONFIG_IS_ENABLED(CONFIG_*) calls""" pm = PatchMaker() pm.add_line('common/main.c', 'if (CONFIG_IS_ENABLED(CONFIG_CLK))') - self.checkSingleMessage(pm, 'CONFIG_IS_ENABLED_CONFIG', 'error') + self.check_single_message(pm, 'CONFIG_IS_ENABLED_CONFIG', 'error') def check_struct(self, auto, suffix, warning): """Check one of the warnings for struct naming @@ -423,17 +423,17 @@ index 0000000..2234c87 pm.add_line('common/main.c', '.%s = sizeof(struct(fred)),' % auto) pm.add_line('common/main.c', '.%s = sizeof(struct(mary%s)),' % (auto, suffix)) - self.checkSingleMessage( + self.check_single_message( pm, warning, "struct 'fred' should have a %s suffix" % suffix) - def testDmDriverAuto(self): + def test_dm_driver_auto(self): """Check for the correct suffix on 'struct driver' auto members""" self.check_struct('priv_auto', '_priv', 'PRIV_AUTO') self.check_struct('plat_auto', '_plat', 'PLAT_AUTO') self.check_struct('per_child_auto', '_priv', 'CHILD_PRIV_AUTO') self.check_struct('per_child_plat_auto', '_plat', 'CHILD_PLAT_AUTO') - def testDmUclassAuto(self): + def test_dm_uclass_auto(self): """Check for the correct suffix on 'struct uclass' auto members""" # Some of these are omitted since they match those from struct driver self.check_struct('per_device_auto', '_priv', 'DEVICE_PRIV_AUTO') @@ -443,11 +443,11 @@ index 0000000..2234c87 """Check one of the checks for strn(cpy|cat)""" pm = PatchMaker() pm.add_line('common/main.c', "strn%s(foo, bar, sizeof(foo));" % func) - self.checkSingleMessage(pm, "STRL", + self.check_single_message(pm, "STRL", "strl%s is preferred over strn%s because it always produces a nul-terminated string\n" % (func, func)) - def testStrl(self): + def test_strl(self): """Check for uses of strn(cat|cpy)""" self.check_strl("cat"); self.check_strl("cpy"); -- 2.35.0.rc2.247.g8bbb082509-goog