diff mbox series

[v2,blktests,3/5] tests/throtl: add a new test 003

Message ID 20240417022005.1410525-4-yukuai1@huaweicloud.com (mailing list archive)
State New, archived
Headers show
Series add new tests for blk-throttle | expand

Commit Message

Yu Kuai April 17, 2024, 2:20 a.m. UTC
From: Yu Kuai <yukuai3@huawei.com>

Test bps limit over IO split, regression tests for:

commit 111be8839817 ("block-throttle: avoid double charge")

Signed-off-by: Yu Kuai <yukuai3@huawei.com>
---
 tests/throtl/003     | 32 ++++++++++++++++++++++++++++++++
 tests/throtl/003.out |  4 ++++
 2 files changed, 36 insertions(+)
 create mode 100755 tests/throtl/003
 create mode 100644 tests/throtl/003.out
diff mbox series

Patch

diff --git a/tests/throtl/003 b/tests/throtl/003
new file mode 100755
index 0000000..806b602
--- /dev/null
+++ b/tests/throtl/003
@@ -0,0 +1,32 @@ 
+#!/bin/bash
+# SPDX-License-Identifier: GPL-3.0+
+# Copyright (C) 2024 Yu Kuai
+#
+# Test bps limit work correctly for big IO of blk-throttle, regression test for
+# commit 111be8839817 ("block-throttle: avoid double charge")
+
+. tests/throtl/rc
+
+DESCRIPTION="bps limit over IO split"
+QUICK=1
+
+test() {
+	echo "Running ${TEST_NAME}"
+
+	if ! _set_up_test max_sectors=8; then
+		return 1;
+	fi
+
+	limit=$((1024 * 1024))
+
+	_set_limits wbps=$limit
+	_test_io write 1M 1
+	_remove_limits
+
+	_set_limits rbps=$limit
+	_test_io read 1M 1
+	_remove_limits
+
+	_clean_up_test
+	echo "Test complete"
+}
diff --git a/tests/throtl/003.out b/tests/throtl/003.out
new file mode 100644
index 0000000..07a80b3
--- /dev/null
+++ b/tests/throtl/003.out
@@ -0,0 +1,4 @@ 
+Running throtl/003
+1
+1
+Test complete