* [LTP] [PATCH v8 0/7] Run tests in CI
@ 2021-08-04 9:24 Petr Vorel
2021-08-04 9:24 ` [LTP] [PATCH v8 1/7] lib: Print everything to stderr Petr Vorel
2021-08-04 9:24 ` [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc Petr Vorel
0 siblings, 2 replies; 6+ messages in thread
From: Petr Vorel @ 2021-08-04 9:24 UTC (permalink / raw)
To: ltp
Hi,
* print more items in lib into stderr (Cyril, 1st commit)
* check for readonly fs instead TCONF on any error during writing to
/proc/sys/vm/nr_hugepages (Cyril, 2nd commit)
NOTE: sending just these 2 patches which are different
Tested:
https://github.com/pevik/ltp/actions/runs/1097004804
Diff to v7
diff --git lib/newlib_tests/test_zero_hugepage.sh lib/newlib_tests/test_zero_hugepage.sh
index 8a462478e..d270e686c 100755
--- lib/newlib_tests/test_zero_hugepage.sh
+++ lib/newlib_tests/test_zero_hugepage.sh
@@ -7,11 +7,13 @@ echo "Testing .request_hugepages = TST_NO_HUGEPAGES"
orig_value=`cat /proc/sys/vm/nr_hugepages`
-if ! echo "128" > /proc/sys/vm/nr_hugepages; then
- echo "TCONF: failed to open /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
echo $orig_value > /proc/sys/vm/nr_hugepages
diff --git lib/tst_test.c lib/tst_test.c
index d15c8c054..8a6a112ef 100644
--- lib/tst_test.c
+++ lib/tst_test.c
@@ -488,23 +488,23 @@ static void print_test_tags(void)
if (!tags)
return;
- printf("\nTags\n");
- printf("----\n");
+ fprintf(stderr, "\nTags\n");
+ fprintf(stderr, "----\n");
for (i = 0; tags[i].name; i++) {
if (!strcmp(tags[i].name, "CVE"))
- printf(CVE_DB_URL "%s\n", tags[i].value);
+ fprintf(stderr, CVE_DB_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "linux-git"))
- printf(LINUX_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, LINUX_GIT_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "linux-stable-git"))
- printf(LINUX_STABLE_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, LINUX_STABLE_GIT_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "glibc-git"))
- printf(GLIBC_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, GLIBC_GIT_URL "%s\n", tags[i].value);
else
- printf("%s: %s\n", tags[i].name, tags[i].value);
+ fprintf(stderr, "%s: %s\n", tags[i].name, tags[i].value);
}
- printf("\n");
+ fprintf(stderr, "\n");
}
static void check_option_collision(void)
@@ -674,9 +674,9 @@ int tst_parse_float(const char *str, float *val, float min, float max)
static void print_colored(const char *str)
{
if (tst_color_enabled(STDOUT_FILENO))
- printf("%s%s%s", ANSI_COLOR_YELLOW, str, ANSI_COLOR_RESET);
+ fprintf(stderr, "%s%s%s", ANSI_COLOR_YELLOW, str, ANSI_COLOR_RESET);
else
- printf("%s", str);
+ fprintf(stderr, "%s", str);
}
static void print_failure_hint(const char *tag, const char *hint,
@@ -694,12 +694,12 @@ static void print_failure_hint(const char *tag, const char *hint,
if (!strcmp(tags[i].name, tag)) {
if (!hint_printed) {
hint_printed = 1;
- printf("\n");
+ fprintf(stderr, "\n");
print_colored("HINT: ");
- printf("You _MAY_ be %s, see:\n\n", hint);
+ fprintf(stderr, "You _MAY_ be %s, see:\n\n", hint);
}
- printf("%s%s\n", url, tags[i].value);
+ fprintf(stderr, "%s%s\n", url, tags[i].value);
}
}
}
Petr Vorel (7):
lib: Print everything to stderr
test/test_zero_hugepage.sh: Skip test on read-only /proc
lib: Add script for running tests
make: Add make test{, -c, -shell} targets
build.sh: Add support for make test{,-c,-shell}
CI: Run also make test-c, test-shell
ci: Install iproute2
.github/workflows/ci.yml | 10 ++
Makefile | 23 +++
build.sh | 24 +++-
ci/debian.sh | 1 +
ci/fedora.sh | 1 +
ci/tumbleweed.sh | 1 +
lib/newlib_tests/runtest.sh | 190 +++++++++++++++++++++++++
lib/newlib_tests/test_zero_hugepage.sh | 6 +
lib/tst_test.c | 38 ++---
9 files changed, 274 insertions(+), 20 deletions(-)
create mode 100755 lib/newlib_tests/runtest.sh
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v8 1/7] lib: Print everything to stderr
2021-08-04 9:24 [LTP] [PATCH v8 0/7] Run tests in CI Petr Vorel
@ 2021-08-04 9:24 ` Petr Vorel
2021-08-04 14:10 ` Cyril Hrubis
2021-08-04 9:24 ` [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc Petr Vorel
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2021-08-04 9:24 UTC (permalink / raw)
To: ltp
ie.e hint, tags, summary to unify the behavior with tst_{brk,res}()
which printed into stderr from the beginning.
Initial motivation was issue in GitHub Actions, where stdout and stderr
are probably block buffered and flushed at different times. The result
was mangled summary into other test output.
Suggested-by: Cyril Hrubis <chrubis@suse.cz>
Signed-off-by: Petr Vorel <pvorel@suse.cz>
---
Changes v7->v8:
* print more items in lib into stderr (Cyril)
lib/tst_test.c | 38 +++++++++++++++++++-------------------
1 file changed, 19 insertions(+), 19 deletions(-)
diff --git a/lib/tst_test.c b/lib/tst_test.c
index c7c77596c..8a6a112ef 100644
--- a/lib/tst_test.c
+++ b/lib/tst_test.c
@@ -488,23 +488,23 @@ static void print_test_tags(void)
if (!tags)
return;
- printf("\nTags\n");
- printf("----\n");
+ fprintf(stderr, "\nTags\n");
+ fprintf(stderr, "----\n");
for (i = 0; tags[i].name; i++) {
if (!strcmp(tags[i].name, "CVE"))
- printf(CVE_DB_URL "%s\n", tags[i].value);
+ fprintf(stderr, CVE_DB_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "linux-git"))
- printf(LINUX_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, LINUX_GIT_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "linux-stable-git"))
- printf(LINUX_STABLE_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, LINUX_STABLE_GIT_URL "%s\n", tags[i].value);
else if (!strcmp(tags[i].name, "glibc-git"))
- printf(GLIBC_GIT_URL "%s\n", tags[i].value);
+ fprintf(stderr, GLIBC_GIT_URL "%s\n", tags[i].value);
else
- printf("%s: %s\n", tags[i].name, tags[i].value);
+ fprintf(stderr, "%s: %s\n", tags[i].name, tags[i].value);
}
- printf("\n");
+ fprintf(stderr, "\n");
}
static void check_option_collision(void)
@@ -674,9 +674,9 @@ int tst_parse_float(const char *str, float *val, float min, float max)
static void print_colored(const char *str)
{
if (tst_color_enabled(STDOUT_FILENO))
- printf("%s%s%s", ANSI_COLOR_YELLOW, str, ANSI_COLOR_RESET);
+ fprintf(stderr, "%s%s%s", ANSI_COLOR_YELLOW, str, ANSI_COLOR_RESET);
else
- printf("%s", str);
+ fprintf(stderr, "%s", str);
}
static void print_failure_hint(const char *tag, const char *hint,
@@ -694,12 +694,12 @@ static void print_failure_hint(const char *tag, const char *hint,
if (!strcmp(tags[i].name, tag)) {
if (!hint_printed) {
hint_printed = 1;
- printf("\n");
+ fprintf(stderr, "\n");
print_colored("HINT: ");
- printf("You _MAY_ be %s, see:\n\n", hint);
+ fprintf(stderr, "You _MAY_ be %s, see:\n\n", hint);
}
- printf("%s%s\n", url, tags[i].value);
+ fprintf(stderr, "%s%s\n", url, tags[i].value);
}
}
}
@@ -734,12 +734,12 @@ static void do_exit(int ret)
if (results->broken)
ret |= TBROK;
- printf("\nSummary:\n");
- printf("passed %d\n", results->passed);
- printf("failed %d\n", results->failed);
- printf("broken %d\n", results->broken);
- printf("skipped %d\n", results->skipped);
- printf("warnings %d\n", results->warnings);
+ fprintf(stderr, "\nSummary:\n");
+ fprintf(stderr, "passed %d\n", results->passed);
+ fprintf(stderr, "failed %d\n", results->failed);
+ fprintf(stderr, "broken %d\n", results->broken);
+ fprintf(stderr, "skipped %d\n", results->skipped);
+ fprintf(stderr, "warnings %d\n", results->warnings);
}
do_cleanup();
--
2.32.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc
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 9:24 ` Petr Vorel
2021-08-04 14:12 ` Cyril Hrubis
1 sibling, 1 reply; 6+ messages in thread
From: Petr Vorel @ 2021-08-04 9:24 UTC (permalink / raw)
To: ltp
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
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [LTP] [PATCH v8 1/7] lib: Print everything to stderr
2021-08-04 9:24 ` [LTP] [PATCH v8 1/7] lib: Print everything to stderr Petr Vorel
@ 2021-08-04 14:10 ` Cyril Hrubis
0 siblings, 0 replies; 6+ messages in thread
From: Cyril Hrubis @ 2021-08-04 14:10 UTC (permalink / raw)
To: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc
2021-08-04 9:24 ` [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc Petr Vorel
@ 2021-08-04 14:12 ` Cyril Hrubis
2021-08-04 15:36 ` Petr Vorel
0 siblings, 1 reply; 6+ messages in thread
From: Cyril Hrubis @ 2021-08-04 14:12 UTC (permalink / raw)
To: ltp
Hi!
Reviewed-by: Cyril Hrubis <chrubis@suse.cz>
--
Cyril Hrubis
chrubis@suse.cz
^ permalink raw reply [flat|nested] 6+ messages in thread
* [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc
2021-08-04 14:12 ` Cyril Hrubis
@ 2021-08-04 15:36 ` Petr Vorel
0 siblings, 0 replies; 6+ messages in thread
From: Petr Vorel @ 2021-08-04 15:36 UTC (permalink / raw)
To: ltp
Hi Cyril,
Thanks a lot, whole patchset merged!
Kind regards,
Petr
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-08-04 15:36 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [LTP] [PATCH v8 2/7] test/test_zero_hugepage.sh: Skip test on read-only /proc Petr Vorel
2021-08-04 14:12 ` Cyril Hrubis
2021-08-04 15:36 ` Petr Vorel
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.