Tests: Preemptively fail infinite blocking tests when low on disk space
[lttng-tools.git] / tests / regression / ust / blocking / test_blocking
index 751b3453b50d7e264e6dd411b96407389931bf1c..0bbc02ddc3c61dec86768c5d14fd27b6353ecc6b 100755 (executable)
@@ -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
@@ -136,6 +149,10 @@ print_test_banner "$TEST_DESC"
 
 bail_out_if_no_babeltrace
 
+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"
This page took 0.023912 seconds and 4 git commands to generate.