mirror of
https://github.com/AsahiLinux/u-boot
synced 2025-02-26 20:37:16 +00:00
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>
This commit is contained in:
parent
4fb3502972
commit
fe6ef1e9ba
1 changed files with 16 additions and 2 deletions
|
@ -148,7 +148,7 @@ index 0000000..2234c87
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/common/bootstage.c
|
+++ b/common/bootstage.c
|
||||||
@@ -0,0 +1,37 @@
|
@@ -0,0 +1,37 @@
|
||||||
+// SPDX-License-Identifier: GPL-2.0+
|
+%s
|
||||||
+/*
|
+/*
|
||||||
+ * Copyright (c) 2011, Google Inc. All rights reserved.
|
+ * Copyright (c) 2011, Google Inc. All rights reserved.
|
||||||
+ *
|
+ *
|
||||||
|
@ -189,19 +189,22 @@ index 0000000..2234c87
|
||||||
1.7.3.1
|
1.7.3.1
|
||||||
'''
|
'''
|
||||||
signoff = 'Signed-off-by: Simon Glass <sjg@chromium.org>\n'
|
signoff = 'Signed-off-by: Simon Glass <sjg@chromium.org>\n'
|
||||||
|
license = '// SPDX-License-Identifier: GPL-2.0+'
|
||||||
tab = ' '
|
tab = ' '
|
||||||
indent = ' '
|
indent = ' '
|
||||||
if data_type == 'good':
|
if data_type == 'good':
|
||||||
pass
|
pass
|
||||||
elif data_type == 'no-signoff':
|
elif data_type == 'no-signoff':
|
||||||
signoff = ''
|
signoff = ''
|
||||||
|
elif data_type == 'no-license':
|
||||||
|
license = ''
|
||||||
elif data_type == 'spaces':
|
elif data_type == 'spaces':
|
||||||
tab = ' '
|
tab = ' '
|
||||||
elif data_type == 'indent':
|
elif data_type == 'indent':
|
||||||
indent = tab
|
indent = tab
|
||||||
else:
|
else:
|
||||||
print('not implemented')
|
print('not implemented')
|
||||||
return data % (signoff, tab, indent, tab)
|
return data % (signoff, license, tab, indent, tab)
|
||||||
|
|
||||||
def SetupData(self, data_type):
|
def SetupData(self, data_type):
|
||||||
inhandle, inname = tempfile.mkstemp()
|
inhandle, inname = tempfile.mkstemp()
|
||||||
|
@ -234,6 +237,17 @@ index 0000000..2234c87
|
||||||
self.assertEqual(result.lines, 62)
|
self.assertEqual(result.lines, 62)
|
||||||
os.remove(inf)
|
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):
|
def testSpaces(self):
|
||||||
inf = self.SetupData('spaces')
|
inf = self.SetupData('spaces')
|
||||||
result = checkpatch.CheckPatch(inf)
|
result = checkpatch.CheckPatch(inf)
|
||||||
|
|
Loading…
Add table
Reference in a new issue