On 05/30/2017 03:43 PM, Eugeniu Rosca wrote: > On Tue, May 30, 2017 at 03:24:37PM -0600, Shuah Khan wrote: >> On 05/28/2017 01:53 PM, Eugeniu Rosca wrote: >>> Implement WDIOC_GETBOOTSTATUS in test code to be able to check if >>> watchdog drivers have proper support of WDIOF_CARDRESET. Include a >>> segmentation fault fix, as it might generate merge conflicts if >>> provided separately. >>> >>> v2: >>> - Fix segmentation fault caused by a previous commit. >>> - Don't break processing of other arguments when passing `-s`. >>> >>> Eugeniu Rosca (2): >>> selftests: watchdog: fix segmentation fault due to wrong argv parsing >> >> Please fix this using getopt. The argument processing is getting very >> complex. You can void these wrong index type that way. > > Many thanks for the feedback. I agree that there is room for this test > to grow (more ioctls can be added) and then it easily goes out of > control without proper parameter handling. Just to avoid breaking your > expectations in the next revision of the patch-set, since there are > multiple examples of using getopt in `tools/testing`, would you please > pick your favorite choice from [1], so that I can take it as reference. > Thanks in advance. take a look at the following. tools/testing/selftests/breakpoints/step_after_suspend_test.c tools/testing/selftests/media_tests/media_device_open.c tools/testing/selftests/timers/inconsistency-check.c This might be sufficient for the args in this test. > > [1] git grep -lw getopt -- ./tools/testing | cat > tools/testing/fault-injection/failcmd.sh > tools/testing/radix-tree/main.c > tools/testing/selftests/breakpoints/step_after_suspend_test.c > tools/testing/selftests/futex/functional/futex_requeue_pi.c > tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c > tools/testing/selftests/futex/functional/futex_requeue_pi_signal_restart.c > tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c > tools/testing/selftests/futex/functional/futex_wait_timeout.c > tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c > tools/testing/selftests/futex/functional/futex_wait_wouldblock.c > tools/testing/selftests/media_tests/media_device_open.c > tools/testing/selftests/media_tests/media_device_test.c > tools/testing/selftests/media_tests/video_device_test.c > tools/testing/selftests/networking/timestamping/txtimestamp.c > tools/testing/selftests/powerpc/benchmarks/context_switch.c > tools/testing/selftests/ptp/testptp.c > tools/testing/selftests/timers/inconsistency-check.c > tools/testing/selftests/timers/leap-a-day.c > tools/testing/selftests/timers/set-2038.c > tools/testing/selftests/timers/threadtest.c > >> >> >>> selftests: watchdog: get boot reason via WDIOC_GETBOOTSTAT >> >> Please add this new argument on top of the patch that converts to >> getopt. > > Will do. > >> thanks, -- Shuah -- To unsubscribe from this list: send the line "unsubscribe linux-kselftest" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html