This is a series of fixes for minor problems in the building of the GPIO selftests introduced by my rework of those tests.
The first patch is from Li Zhijian and fixes a compiler error when building the selftests in environments with stale system includes. I have reworded the commit comment to make it more to the point in describing the root cause of the problem and the fix, as suggested by Shuah in his initial review of that patch.
The second patch fixes a warning when the tests are compiled with -Wall, and the final patch restores the CFLAGS that should not have been removed in the rework, including the -Wall.
Kent Gibson (2): selftests: gpio: fix uninitialised variable warning selftests: gpio: restore CFLAGS options
Li Zhijian (1): selftests: gpio: fix gpio compiling error
tools/testing/selftests/gpio/Makefile | 1 + tools/testing/selftests/gpio/gpio-mockup-cdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
From: Li Zhijian lizhijian@cn.fujitsu.com
The gpio selftests build against the system includes rather than the headers from the linux tree. This results in the compile failing if the system includes are outdated.
Prefer the headers from the linux tree, as per other selftests.
Fixes: 8bc395a6a2e2 ("selftests: gpio: rework and simplify test implementation") Reported-by: kernel test robot lkp@intel.com Signed-off-by: Li Zhijian lizhijian@cn.fujitsu.com [Kent: reworded commit comment and added Fixes:] Signed-off-by: Kent Gibson warthog618@gmail.com --- tools/testing/selftests/gpio/Makefile | 1 + 1 file changed, 1 insertion(+)
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 39f2bbe8dd3d..42ea7d2aa844 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -3,5 +3,6 @@ TEST_PROGS := gpio-mockup.sh TEST_FILES := gpio-mockup-sysfs.sh TEST_GEN_PROGS_EXTENDED := gpio-mockup-cdev +CFLAGS += -I../../../../usr/include
include ../lib.mk
When compiled with -Wall gpio-mockup-cdev.c reports an uninitialised variable warning. This is a false positive, as the variable is ignored in the case it is uninitialised, but initialise the variable anyway to remove the warning.
Signed-off-by: Kent Gibson warthog618@gmail.com --- tools/testing/selftests/gpio/gpio-mockup-cdev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/gpio/gpio-mockup-cdev.c b/tools/testing/selftests/gpio/gpio-mockup-cdev.c index e83eac71621a..d1640f44f8ac 100644 --- a/tools/testing/selftests/gpio/gpio-mockup-cdev.c +++ b/tools/testing/selftests/gpio/gpio-mockup-cdev.c @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) { char *chip; int opt, ret, cfd, lfd; - unsigned int offset, val, abiv; + unsigned int offset, val = 0, abiv; uint32_t flags_v1; uint64_t flags_v2;
All the CFLAGS options were incorrectly removed in the recent rework of the GPIO selftests. While some of the flags were specific to the old implementation the remainder are still relevant. Restore those options.
Signed-off-by: Kent Gibson warthog618@gmail.com --- tools/testing/selftests/gpio/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/gpio/Makefile b/tools/testing/selftests/gpio/Makefile index 42ea7d2aa844..d7b312b44a62 100644 --- a/tools/testing/selftests/gpio/Makefile +++ b/tools/testing/selftests/gpio/Makefile @@ -3,6 +3,6 @@ TEST_PROGS := gpio-mockup.sh TEST_FILES := gpio-mockup-sysfs.sh TEST_GEN_PROGS_EXTENDED := gpio-mockup-cdev -CFLAGS += -I../../../../usr/include +CFLAGS += -O2 -g -Wall -I../../../../usr/include/
include ../lib.mk
On Mon, Nov 8, 2021 at 2:29 AM Kent Gibson warthog618@gmail.com wrote:
This is a series of fixes for minor problems in the building of the GPIO selftests introduced by my rework of those tests.
The first patch is from Li Zhijian and fixes a compiler error when building the selftests in environments with stale system includes. I have reworded the commit comment to make it more to the point in describing the root cause of the problem and the fix, as suggested by Shuah in his initial review of that patch.
The second patch fixes a warning when the tests are compiled with -Wall, and the final patch restores the CFLAGS that should not have been removed in the rework, including the -Wall.
Kent Gibson (2): selftests: gpio: fix uninitialised variable warning selftests: gpio: restore CFLAGS options
Li Zhijian (1): selftests: gpio: fix gpio compiling error
tools/testing/selftests/gpio/Makefile | 1 + tools/testing/selftests/gpio/gpio-mockup-cdev.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-)
-- 2.33.1
Queued for fixes, thanks!
Bart
linux-kselftest-mirror@lists.linaro.org