From 800d6a0eeb7262576cda7d9da0bb8c3bd096f826 Mon Sep 17 00:00:00 2001 From: Michal Mielewczyk Date: Thu, 9 Jun 2022 14:45:40 +0200 Subject: [PATCH] tests: fix trim test Since XFS is quite lazy with sending discards, create additional file to ensure that the requests are actually issued Signed-off-by: Michal Mielewczyk --- test/functional/tests/io/trim/test_trim.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/test/functional/tests/io/trim/test_trim.py b/test/functional/tests/io/trim/test_trim.py index 302df8e..4c7739b 100644 --- a/test/functional/tests/io/trim/test_trim.py +++ b/test/functional/tests/io/trim/test_trim.py @@ -1,5 +1,5 @@ # -# Copyright(c) 2020-2021 Intel Corporation +# Copyright(c) 2020-2022 Intel Corporation # SPDX-License-Identifier: BSD-3-Clause # import os @@ -225,7 +225,7 @@ def test_trim_device_discard_support( with TestRun.step("Create random file."): test_file = fs_utils.create_random_test_file(os.path.join(mount_point, "test_file"), - core_dev.size * 0.9) + core_dev.size * 0.2) occupancy_before = core.get_occupancy() TestRun.LOGGER.info(str(core.get_statistics())) @@ -237,6 +237,15 @@ def test_trim_device_discard_support( os_utils.drop_caches() test_file.remove() + if filesystem == Filesystem.xfs: + with TestRun.step( + "Since issuing discard reqs is a lazy operation on XFS " + "write a small amount of data to the partition" + ): + test_file = fs_utils.create_random_test_file( + os.path.join(mount_point, "test_file"), core_dev.size * 0.1 + ) + with TestRun.step( "Ensure that discards were detected by blktrace on proper devices."): discard_expected = {"core": trim_support_cache_core[1], "cache": False, "cas": True}