From 7bc12babbde0510e051f68b201c30d78c11b3b56 Mon Sep 17 00:00:00 2001 From: Kienan Stewart Date: Wed, 21 Jun 2023 09:39:06 -0400 Subject: [PATCH] Tests: Preemptively fail infinite blocking tests when low on disk space MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit In the system tests run by LAVA, the infinite blocking tests were hanging when the system under test ran out of disk space. This is the expected behaviour of the failing test, but the condition can be detected and the tests preemptively failed with a clear error of what needs to be addressed in the system being tested. Change-Id: I9e6126408b57c2cd5aa64c2e360e0672f9eb2314 Signed-off-by: Kienan Stewart Signed-off-by: Jérémie Galarneau --- tests/regression/ust/blocking/test_blocking | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/regression/ust/blocking/test_blocking b/tests/regression/ust/blocking/test_blocking index f6c465d6e..10c07a7e7 100755 --- a/tests/regression/ust/blocking/test_blocking +++ b/tests/regression/ust/blocking/test_blocking @@ -30,6 +30,19 @@ function run_app() ok $? "Application done" } +function check_disk_space() +{ + local path + + path="${1:?}" + kb_free=$(df -k -P "${path}" | tail -n 1 | awk '{ print $4 }') + if [ "${kb_free}" -lt "1048576" ] ; then + return 1 + fi + + return 0 +} + function test_ust_implicit_no_blocking() { NUM_EVENT=5000000 @@ -134,6 +147,10 @@ plan_tests $NUM_TESTS print_test_banner "$TEST_DESC" +if ! check_disk_space "${TMPDIR:-/tmp}"; then + BAIL_OUT "Not enough free space to run blocking tests" +fi + TESTS=( "test_ust_implicit_no_blocking" "test_ust_implicit_no_blocking_with_channel_blocking" -- 2.34.1