@@ -165,31 +165,28 @@ try_checkpatch \
AT_CLEANUP
-AT_SETUP([checkpatch - parenthesized constructs])
-for ctr in 'if' 'while' 'switch'; do
-try_checkpatch \
- "Author: A
-
+
+m4_define([COMMON_PATCH_HEADER], [dnl
+ Author: A
+
Signed-off-by: A
---
diff --git a/A.c b/A.c
index 0000000..1111111 100644
--- a/A.c
+++ b/A.c
- @@ -1,1 +1,1 @@
+ @@ -1,1 +1,1 @@])
+
+
+AT_SETUP([checkpatch - parenthesized constructs])
+for ctr in 'if' 'while' 'switch'; do
+try_checkpatch \
+ "COMMON_PATCH_HEADER
+ $ctr (first_run) {
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr ( first_run) {
" \
"ERROR: Improper whitespace around control block
@@ -198,15 +195,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr (first_run ) {
" \
"ERROR: Inappropriate bracing around statement
@@ -215,15 +204,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr (first_run)
" \
"ERROR: Inappropriate bracing around statement
@@ -232,15 +213,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr(first_run)
" \
"ERROR: Improper whitespace around control block
@@ -249,59 +222,26 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr (first_run) { /* foo */
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ $ctr (first_run) { \\
"
done
AT_CLEANUP
-
AT_SETUP([checkpatch - parenthesized constructs - for])
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for (init; condition; increment) {
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for ( init; condition; increment) {
" \
"ERROR: Improper whitespace around control block
@@ -310,15 +250,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for (init; condition; increment ) {
" \
"ERROR: Inappropriate bracing around statement
@@ -327,15 +259,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for (init; condition; increment)
" \
"ERROR: Inappropriate bracing around statement
@@ -344,15 +268,7 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for(init; condition; increment)
" \
"ERROR: Improper whitespace around control block
@@ -361,28 +277,12 @@ try_checkpatch \
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for (init; condition; increment) { /* foo */
"
try_checkpatch \
- "Author: A
-
- Signed-off-by: A
- ---
- diff --git a/A.c b/A.c
- index 0000000..1111111 100644
- --- a/A.c
- +++ b/A.c
- @@ -1,1 +1,1 @@
+ "COMMON_PATCH_HEADER
+ for (init; condition; increment) { \\
"
Most of checkpatch tests uses equal patch headers that could be moved to a variable to reduce duplications and code size. Signed-off-by: Ilya Maximets <i.maximets@samsung.com> --- tests/checkpatch.at | 148 +++++++------------------------------------- 1 file changed, 24 insertions(+), 124 deletions(-)