[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CADKZ3FLsksV8-cCE6aOnZnLbYj3SSAkPnMs_VRQB3g0V3mUYcg@mail.gmail.com>
Date: Fri, 10 Aug 2018 17:20:09 +0300
From: Denis Efremov <efremov@...ux.com>
To: Julia Lawall <julia.lawall@...6.fr>
Cc: Masahiro Yamada <yamada.masahiro@...ionext.com>,
"Luis R . Rodriguez" <mcgrof@...nel.org>,
Nicolas Palix <nicolas.palix@...g.fr>,
Gilles Muller <Gilles.Muller@...6.fr>,
Michal Marek <michal.lkml@...kovi.net>,
linux-kernel@...r.kernel.org, ldv-project@...uxtesting.org
Subject: Re: [PATCH] coccicheck: return proper error code on check fail
> Do you mean that there is an error in the behavior of coccicheck or that coccicheck finds an error in the source code?
An error in the source code.
Here is an example of how the patch changes the behavior of 'make
coccicheck' (my comments after the ###):
Current behavior:
$ make M=mymodule coccicheck
mymodule/file1.c:97:4-14: ERROR: Assignment of bool to non-0/1 constant
mymodule/file2.c:104:4-19: ERROR: Assignment of bool to non-0/1 constant
mymodule/file2.c:577:1-15: code aligned with following code on line 583
mymodule/file3.c:439:5-10: Unneeded variable: "error". Return "0" on line 449
mymodule/file4.c:451:5-7: Unneeded variable: "rc". Return "0" on line 455
mymodule/file5.c:433:5-8: Unneeded variable: "ret". Return "0" on line 607
mymodule/file6.c:433:5-10: Unneeded variable: "error". Return "0" on line 440
mymodule/file7.c:774:2-3: Unneeded semicolon
coccicheck failed ### <-- Check failed
$ echo $?
0 ### <-- But error code signals that everthing is OK
After this patch:
$ make M=mymodule coccicheck
...
coccicheck failed
make: *** [Makefile:1636: coccicheck] Error 2
$ echo $?
2 ### <-- The patch changes error code
Why does this matter?
1) Because it's clear from the source code that the original intention
was to return an error code of checking command, not the "echo
'coccicheck failed'" command.
2) Automated testing systems (CI, for example) rely on the return code.
Powered by blists - more mailing lists