[LTP] [PATCH v2 7/7] shell API: Add test for TST_DEVICE_SIZE

Petr Vorel pvorel@suse.cz
Tue Dec 10 23:57:53 CET 2024


Added recently in 8532eb2c61.
overlayfs workaround is used in GitHub Actions.

Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
New in v2.

 lib/newlib_tests/runtest.sh               |  1 +
 lib/newlib_tests/shell/tst_device_size.sh | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
 create mode 100755 lib/newlib_tests/shell/tst_device_size.sh

diff --git a/lib/newlib_tests/runtest.sh b/lib/newlib_tests/runtest.sh
index 68f8af7606..66aaa9361f 100755
--- a/lib/newlib_tests/runtest.sh
+++ b/lib/newlib_tests/runtest.sh
@@ -32,6 +32,7 @@ LTP_SHELL_API_TESTS="${LTP_SHELL_API_TESTS:-
 shell/timeout0[1-2].sh
 shell/tst_all_filesystems.sh
 shell/tst_all_filesystems_skip.sh
+shell/tst_device_size.sh
 shell/tst_errexit.sh
 shell/tst_format_device.sh
 shell/tst_check_driver.sh
diff --git a/lib/newlib_tests/shell/tst_device_size.sh b/lib/newlib_tests/shell/tst_device_size.sh
new file mode 100755
index 0000000000..7514379729
--- /dev/null
+++ b/lib/newlib_tests/shell/tst_device_size.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0-or-later
+# Copyright (c) 2024 Petr Vorel <pvorel@suse.cz>
+
+TST_NEEDS_DEVICE=1
+TST_DEVICE_SIZE=10
+TST_TESTFUNC=test
+
+test()
+{
+	tst_res TPASS "TST_DEVICE_SIZE=$TST_DEVICE_SIZE"
+	# overlayfs adds 1 MB
+	EXPECT_PASS "du -ms . | grep -qw -e $TST_DEVICE_SIZE -e $(($TST_DEVICE_SIZE + 1))"
+}
+
+. tst_test.sh
+tst_run
-- 
2.45.2



More information about the ltp mailing list