[LTP] [PATCH v7 2/7] test/test_zero_hugepage.sh: Skip test on read-only file system

Petr Vorel
2021-08-02T17:35:31Z

On GitHub Actions /proc/sys/vm/nr_hugepages is not allowed to be
changed:

./test_zero_hugepage.sh: line 9: can't create /proc/sys/vm/nr_hugepages: Read-only file system
tst_hugepage.c:57: TBROK: Failed to open FILE '/proc/sys/vm/nr_hugepages' for writing: EROFS (30)
tst_sys_conf.c:102: TWARN: Failed to open FILE '/proc/sys/vm/nr_hugepages'

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

lib/newlib_tests/test_zero_hugepage.sh | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/lib/newlib_tests/test_zero_hugepage.sh b/lib/newlib_tests/test_zero_hugepage.sh
index 10113006b..8a462478e 100755
--- a/lib/newlib_tests/test_zero_hugepage.sh
+++ b/lib/newlib_tests/test_zero_hugepage.sh
@@ -1,12 +1,16 @@
#!/bin/sh
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (c) 2021 Yang Xu <xuyang2018.jy@fujitsu.com>
+# Copyright (c) 2021 Petr Vorel <pvorel@suse.cz>

echo "Testing .request_hugepages = TST_NO_HUGEPAGES"

orig_value=`cat /proc/sys/vm/nr_hugepages`

-echo "128" > /proc/sys/vm/nr_hugepages
+if ! echo "128" > /proc/sys/vm/nr_hugepages; then
+ echo "TCONF: failed to open /proc/sys/vm/nr_hugepages"
+ exit 32
+fi

./test_zero_hugepage

--
2.32.0