diff options
author | Chris Packham <judge.packham@gmail.com> | 2018-06-07 20:45:07 +1200 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2018-06-23 08:03:43 -0600 |
commit | fe6ef1e9bacac98747e8b88d6a7f786db511a8d6 (patch) | |
tree | 8e7ed2cacce67e50709ff2d5a236e0293336fb10 /tools | |
parent | 4fb3502972db0faeb278f62effc0a4b07a355531 (diff) | |
download | u-boot-fe6ef1e9bacac98747e8b88d6a7f786db511a8d6.tar.gz |
patman: add test for SPDX license
Add a test to exercise the check for a valid SPDX license.
Signed-off-by: Chris Packham <judge.packham@gmail.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/patman/test.py | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/tools/patman/test.py b/tools/patman/test.py index c7ba4e6bb4..e1b94bd1a7 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 <sjg@chromium.org>\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) |