All of lore.kernel.org
 help / color / mirror / Atom feed
From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc
Date: Wed,  4 Aug 2021 11:24:07 +0200	[thread overview]
Message-ID: <20210804092407.16015-3-pvorel@suse.cz> (raw)
In-Reply-To: <20210804092407.16015-1-pvorel@suse.cz>

or /proc/sys. 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'

There are several /proc subdirectories mounted as read only:
$ grep '^proc /proc.* proc ro' /proc/mounts
proc /proc/bus proc ro,nosuid,nodev,noexec,relatime 0 0
proc /proc/fs proc ro,nosuid,nodev,noexec,relatime 0 0
proc /proc/irq proc ro,nosuid,nodev,noexec,relatime 0 0
proc /proc/sys proc ro,nosuid,nodev,noexec,relatime 0 0
proc /proc/sysrq-trigger proc ro,nosuid,nodev,noexec,relatime 0 0

Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v7->v8:
* check for readonly fs instead TCONF on any error during writing to
/proc/sys/vm/nr_hugepages (Cyril)

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

diff --git a/lib/newlib_tests/test_zero_hugepage.sh b/lib/newlib_tests/test_zero_hugepage.sh
index 10113006b..d270e686c 100755
--- a/lib/newlib_tests/test_zero_hugepage.sh
+++ b/lib/newlib_tests/test_zero_hugepage.sh
@@ -1,11 +1,17 @@
 #!/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`
 
+if grep -q -E '^proc /proc(/sys)? proc ro' /proc/mounts; then
+	echo "TCONF: /proc or /proc/sys mounted as read-only"
+	exit 32
+fi
+
 echo "128" > /proc/sys/vm/nr_hugepages
 
 ./test_zero_hugepage
-- 
2.32.0


  parent reply	other threads:[~2021-08-04  9:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-04  9:24 [LTP] [PATCH v8 0/7] Run tests in CI Petr Vorel
2021-08-04  9:24 ` [LTP] [PATCH v8 1/7] lib: Print everything to stderr Petr Vorel
2021-08-04 14:10   ` Cyril Hrubis
2021-08-04  9:24 ` Petr Vorel [this message]
2021-08-04 14:12   ` [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc Cyril Hrubis
2021-08-04 15:36     ` Petr Vorel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210804092407.16015-3-pvorel@suse.cz \
    --to=pvorel@suse.cz \
    --cc=ltp@lists.linux.it \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.