[LTP] [PATCH v2 3/3] dio_sparse: Fix child exit code

Martin Doucha mdoucha@suse.cz
Wed Sep 14 15:43:33 CEST 2022


dio_sparse currently ignores all child failures because children never
exit with non-zero code. Fix child exit status.

Signed-off-by: Martin Doucha <mdoucha@suse.cz>
---

Changes since v1:
- Use tst_res(TFAIL)+exit(1) instead of tst_brk()

 testcases/kernel/io/ltp-aiodio/common.h | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/testcases/kernel/io/ltp-aiodio/common.h b/testcases/kernel/io/ltp-aiodio/common.h
index 68465dc54..3a604f8f7 100644
--- a/testcases/kernel/io/ltp-aiodio/common.h
+++ b/testcases/kernel/io/ltp-aiodio/common.h
@@ -78,9 +78,11 @@ static inline void io_read(const char *filename, int filesize, volatile int *run
 			if (r > 0) {
 				bufoff = check_zero(buff, r);
 				if (bufoff) {
-					tst_res(TINFO, "non-zero read at offset %zu",
+					tst_res(TFAIL,
+						"non-zero read at offset %zu",
 						offset + (bufoff - buff));
-					break;
+					SAFE_CLOSE(fd);
+					exit(1);
 				}
 				offset += r;
 			}
-- 
2.37.3



More information about the ltp mailing list