From mboxrd@z Thu Jan 1 00:00:00 1970 From: Chris Packham Date: Thu, 7 Jun 2018 20:45:07 +1200 Subject: [U-Boot] [PATCH v3 2/2] patman: add test for SPDX license In-Reply-To: <20180607084507.9382-1-judge.packham@gmail.com> References: <20180607084507.9382-1-judge.packham@gmail.com> Message-ID: <20180607084507.9382-2-judge.packham@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Add a test to exercise the check for a valid SPDX license. Signed-off-by: Chris Packham --- This is dependent on http://patchwork.ozlabs.org/patch/914202/ I also seem to get a bunch of doctest failures due to unicode strings, e.g. File "tools/patman/settings.py", line 78, in settings._ProjectConfigParser Failed example: sorted(config.items("settings")) Expected: [('am_hero', 'True')] Got: [('am_hero', u'True') I haven't attempted to fix these as I suspect they might be python version (2.7.12 for me) and/or locale dependent. Changes in v3: - new Changes in v2: None tools/patman/test.py | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/tools/patman/test.py b/tools/patman/test.py index c7ba4e6bb47c..e1b94bd1a7db 100644 --- a/tools/patman/test.py +++ b/tools/patman/test.py @@ -148,7 +148,7 @@ index 0000000..2234c87 --- /dev/null +++ b/common/bootstage.c @@ -0,0 +1,37 @@ -+// SPDX-License-Identifier: GPL-2.0+ ++%s +/* + * Copyright (c) 2011, Google Inc. All rights reserved. + * @@ -189,19 +189,22 @@ index 0000000..2234c87 1.7.3.1 ''' signoff = 'Signed-off-by: Simon Glass \n' + license = '// SPDX-License-Identifier: GPL-2.0+' tab = ' ' indent = ' ' if data_type == 'good': pass elif data_type == 'no-signoff': signoff = '' + elif data_type == 'no-license': + license = '' elif data_type == 'spaces': tab = ' ' elif data_type == 'indent': indent = tab else: print('not implemented') - return data % (signoff, tab, indent, tab) + return data % (signoff, license, tab, indent, tab) def SetupData(self, data_type): inhandle, inname = tempfile.mkstemp() @@ -234,6 +237,17 @@ index 0000000..2234c87 self.assertEqual(result.lines, 62) os.remove(inf) + def testNoLicense(self): + inf = self.SetupData('no-license') + result = checkpatch.CheckPatch(inf) + self.assertEqual(result.ok, False) + self.assertEqual(len(result.problems), 1) + self.assertEqual(result.errors, 0) + self.assertEqual(result.warnings, 1) + self.assertEqual(result.checks, 0) + self.assertEqual(result.lines, 62) + os.remove(inf) + def testSpaces(self): inf = self.SetupData('spaces') result = checkpatch.CheckPatch(inf) -- 2.17.1