From 251cb8dfacb51b9ad7a0e3da305c0bc5bbc1cb9e Mon Sep 17 00:00:00 2001 From: Giuseppe Di Natale Date: Mon, 28 Nov 2016 16:24:47 -0800 Subject: [PATCH] Ensure that perf regression tests cleanup properly Each test in the performance regression test suite creates a pool and a dataset for use. Unfortunately, these tests do not cleanup the pool and dataset correctly once they complete. Each test now kills fio and iostat, destroys the dataset, and finally destroys the pool. Each test also now traps the SIGTERM signal to handle cases where test-runner kills a test. Reviewed-by: Brian Behlendorf Signed-off-by: Giuseppe Di Natale Requires-builders: all Closes #5407 --- tests/zfs-tests/tests/perf/regression/random_reads.ksh | 8 +++++++- .../zfs-tests/tests/perf/regression/random_readwrite.ksh | 8 +++++++- tests/zfs-tests/tests/perf/regression/random_writes.ksh | 8 +++++++- .../zfs-tests/tests/perf/regression/sequential_reads.ksh | 8 +++++++- .../tests/perf/regression/sequential_reads_cached.ksh | 8 +++++++- .../perf/regression/sequential_reads_cached_clone.ksh | 8 +++++++- .../zfs-tests/tests/perf/regression/sequential_writes.ksh | 8 +++++++- 7 files changed, 49 insertions(+), 7 deletions(-) diff --git a/tests/zfs-tests/tests/perf/regression/random_reads.ksh b/tests/zfs-tests/tests/perf/regression/random_reads.ksh index 0e9187f6d8..2203d649c1 100755 --- a/tests/zfs-tests/tests/perf/regression/random_reads.ksh +++ b/tests/zfs-tests/tests/perf/regression/random_reads.ksh @@ -31,9 +31,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during random read load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/random_readwrite.ksh b/tests/zfs-tests/tests/perf/regression/random_readwrite.ksh index c360cd5b7a..50bf2b08e0 100755 --- a/tests/zfs-tests/tests/perf/regression/random_readwrite.ksh +++ b/tests/zfs-tests/tests/perf/regression/random_readwrite.ksh @@ -31,9 +31,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during random read-write load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/random_writes.ksh b/tests/zfs-tests/tests/perf/regression/random_writes.ksh index 3e5d0f59eb..186232e198 100755 --- a/tests/zfs-tests/tests/perf/regression/random_writes.ksh +++ b/tests/zfs-tests/tests/perf/regression/random_writes.ksh @@ -30,9 +30,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during random write load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/sequential_reads.ksh b/tests/zfs-tests/tests/perf/regression/sequential_reads.ksh index 75680e0896..52c9631d18 100755 --- a/tests/zfs-tests/tests/perf/regression/sequential_reads.ksh +++ b/tests/zfs-tests/tests/perf/regression/sequential_reads.ksh @@ -31,9 +31,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during sequential read load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/sequential_reads_cached.ksh b/tests/zfs-tests/tests/perf/regression/sequential_reads_cached.ksh index 54a4d4ac85..9dfbe0663d 100755 --- a/tests/zfs-tests/tests/perf/regression/sequential_reads_cached.ksh +++ b/tests/zfs-tests/tests/perf/regression/sequential_reads_cached.ksh @@ -30,9 +30,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during sequential read load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/sequential_reads_cached_clone.ksh b/tests/zfs-tests/tests/perf/regression/sequential_reads_cached_clone.ksh index bbc053abca..6b147f0f24 100755 --- a/tests/zfs-tests/tests/perf/regression/sequential_reads_cached_clone.ksh +++ b/tests/zfs-tests/tests/perf/regression/sequential_reads_cached_clone.ksh @@ -36,9 +36,15 @@ function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + log_assert "Measure IO stats during sequential read load" log_onexit cleanup diff --git a/tests/zfs-tests/tests/perf/regression/sequential_writes.ksh b/tests/zfs-tests/tests/perf/regression/sequential_writes.ksh index 7865afa201..905723e5a1 100755 --- a/tests/zfs-tests/tests/perf/regression/sequential_writes.ksh +++ b/tests/zfs-tests/tests/perf/regression/sequential_writes.ksh @@ -33,9 +33,15 @@ log_onexit cleanup function cleanup { - log_must $ZFS destroy $TESTFS + # kill fio and iostat + $PKILL ${FIO##*/} + $PKILL ${IOSTAT##*/} + log_must_busy $ZFS destroy $TESTFS + log_must_busy $ZPOOL destroy $PERFPOOL } +trap "log_fail \"Measure IO stats during random read load\"" SIGTERM + export TESTFS=$PERFPOOL/testfs recreate_perfpool log_must $ZFS create $PERF_FS_OPTS $TESTFS