diff mbox series

[4/9] patman: fix test_indent test

Message ID 20221219015923.25966-4-maxim.cournoyer@savoirfairelinux.com
State Superseded
Delegated to: Simon Glass
Headers show
Series [1/9] patman: cosmetic: Fix PEP 8 warnings for the gitutil module. | expand

Commit Message

Maxim Cournoyer Dec. 19, 2022, 1:59 a.m. UTC
The checkpatch.pl script indentation check now checks that lines start
with tabs an complains otherwise, so to make the test fail, start a
line with spaces.  This is now also emitted as a warning rather than
as a check.

Signed-off-by: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
---

 tools/patman/test_checkpatch.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/tools/patman/test_checkpatch.py b/tools/patman/test_checkpatch.py
index 8960cd505f..bd53ae3ca5 100644
--- a/tools/patman/test_checkpatch.py
+++ b/tools/patman/test_checkpatch.py
@@ -4,6 +4,7 @@ 
 # Tests for U-Boot-specific checkpatch.pl features
 #
 # Copyright (c) 2011 The Chromium OS Authors.
+# Copyright (c) 2022 Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
 #
 
 import os
@@ -257,7 +258,7 @@  index 0000000..2234c87
 +		rec->name = name;
 +	}
 +	if (!rec->name &&
-+	%ssomething_else) {
++%ssomething_else) {
 +		rec->time_us = (u32)timer_get_us();
 +		rec->name = name;
 +	}
@@ -269,7 +270,7 @@  index 0000000..2234c87
         signoff = 'Signed-off-by: Simon Glass <sjg@chromium.org>\n'
         license = '// SPDX-License-Identifier: GPL-2.0+'
         tab = '	'
-        indent = '    '
+        indent = tab
         if data_type == 'good':
             pass
         elif data_type == 'no-signoff':
@@ -279,7 +280,7 @@  index 0000000..2234c87
         elif data_type == 'spaces':
             tab = '   '
         elif data_type == 'indent':
-            indent = tab
+            indent = '    '     # must use tabs, not spaces!
         else:
             print('not implemented')
         return data % (signoff, license, tab, indent, tab)
@@ -343,8 +344,8 @@  index 0000000..2234c87
         self.assertEqual(result.ok, False)
         self.assertEqual(len(result.problems), 1)
         self.assertEqual(result.errors, 0)
-        self.assertEqual(result.warnings, 0)
-        self.assertEqual(result.checks, 1)
+        self.assertEqual(result.warnings, 1)
+        self.assertEqual(result.checks, 0)
         self.assertEqual(result.lines, 62)
         os.remove(inf)