src/locktest.c: Fix return code if last test fails
authorIra Weiny <ira.weiny@intel.com>
Mon, 23 Sep 2019 17:53:26 +0000 (10:53 -0700)
committerEryu Guan <guaneryu@gmail.com>
Sun, 13 Oct 2019 11:02:36 +0000 (19:02 +0800)
commit8deddd16f4d3769304766cbdbdc3350063c1e541
treee2bce2432a83cf231a64f92dc549bfd3b6ff18fe
parent214cc10503cd2e5e6b9410add61362a6b0d74d40
src/locktest.c: Fix return code if last test fails

If anything but the first step of the last test fails, the exit code
(fail_count) was not properly set.  Fix this such that follow on patches
will be able to save error output and correctly inform the script that a
failure has occurred rather than just expecting random output to fail
the diff check.

The issue is last_test is not properly tracking which test the loop is
currently on.  Therefore fail_count would not be incremented correctly.

Remove the special case of checking for the end of the steps array and
track last_test properly.  Then adjust test_count to be correct for the
new code.

Reviewed-by: Jeff Layton <jlayton@kernel.org>
Signed-off-by: Ira Weiny <ira.weiny@intel.com>
Signed-off-by: Eryu Guan <guaneryu@gmail.com>
src/locktest.c