New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sys-kernel/dracut: enable testing #34052
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
From 71055058c0bdb6fec0dbebf2ec8bbfc968820b88 Mon Sep 17 00:00:00 2001 | ||
From: Laszlo Gombos <laszlo.gombos@gmail.com> | ||
Date: Tue, 21 Feb 2023 00:20:29 +0000 | ||
Subject: [PATCH] fix(test): running tests no longer requires to be root | ||
|
||
Remove sudo from test containers. | ||
--- | ||
Makefile | 1 - | ||
test/Makefile | 1 - | ||
test/test-functions | 12 ------------ | ||
7 files changed, 6 insertions(+), 22 deletions(-) | ||
|
||
diff --git a/Makefile b/Makefile | ||
index 5fd9395648..15c0af245a 100644 | ||
--- a/Makefile | ||
+++ b/Makefile | ||
@@ -270,7 +270,6 @@ endif | ||
endif | ||
|
||
check: all syncheck | ||
- @[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } | ||
@$(MAKE) -C test check | ||
|
||
testimage: all | ||
diff --git a/test/Makefile b/test/Makefile | ||
index dfaa4509ea..518e7d616d 100644 | ||
--- a/test/Makefile | ||
+++ b/test/Makefile | ||
@@ -1,7 +1,6 @@ | ||
.PHONY: all check clean $(wildcard TEST-??-*) | ||
|
||
$(wildcard TEST-??-*): | ||
- @[ "$(shell id -u)" = 0 ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; } | ||
@{ \ | ||
[ -d $@ ] || exit 0; \ | ||
[ -f $@/Makefile ] || exit 0; \ | ||
diff --git a/test/test-functions b/test/test-functions | ||
index abd20ec628..8a3765af0d 100644 | ||
--- a/test/test-functions | ||
+++ b/test/test-functions | ||
@@ -49,15 +49,6 @@ COLOR_FAILURE='\033[0;31m' | ||
COLOR_WARNING='\033[0;33m' | ||
COLOR_NORMAL='\033[0;39m' | ||
|
||
-check_root() { | ||
- if ((EUID != 0)); then | ||
- SETCOLOR_FAILURE | ||
- echo "Tests must be run as root! Please use 'sudo'." | ||
- SETCOLOR_NORMAL | ||
- exit 1 | ||
- fi | ||
-} | ||
- | ||
# generate qemu arguments for named raw disks | ||
# | ||
# qemu_add_drive_args <index> <args> <filename> <id-name> [<bootindex>] | ||
@@ -119,13 +110,11 @@ test_marker_check() { | ||
while (($# > 0)); do | ||
case $1 in | ||
--run) | ||
- check_root | ||
echo "TEST RUN: $TEST_DESCRIPTION" | ||
test_check && test_run | ||
exit $? | ||
;; | ||
--setup) | ||
- check_root | ||
echo "TEST SETUP: $TEST_DESCRIPTION" | ||
test_check && test_setup | ||
exit $? | ||
@@ -138,7 +127,6 @@ while (($# > 0)); do | ||
exit $? | ||
;; | ||
--all) | ||
- check_root | ||
if ! test_check 2 &> test${TEST_RUN_ID:+-$TEST_RUN_ID}.log; then | ||
echo -e "TEST: $TEST_DESCRIPTION " "$COLOR_WARNING" "[SKIPPED]" "$COLOR_NORMAL" | ||
exit 0 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you think about running the full test suite if mount is readable? Something like this:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another potential challange is networked tests - e.g. nfs, iscsi, nbd. The test suite would create a server and client VM with qemu and boot both VMs. Would we want to/is it normally allowed to run this kind of test suites as part of packaging ?
Note that for example that just the NFS test (Test number 20) itself (if everything goes well), runs for about 45 min - see the upstream timeout on networking CI tests - https://github.com/dracutdevs/dracut/blob/master/.github/workflows/integration.yml#L58 . Most of the time this tests times out even with the 45 min timeout limit.
Also note that we do not run networked tests on Gentoo upstream - https://github.com/dracutdevs/dracut/blob/master/.github/workflows/integration.yml#L27
IMHO we want to run only a subset of the tests - at least initially.
There is an attempt to reorganize the test suite upstream so that it is easier to just pick a non-networked tests downstream - see dracutdevs/dracut#2263
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the test-github.sh script, it looks like it runs configure and make to compile the code (again). We don't want to do that in the src_test function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fair point. I think this also came up during Debian/Ubuntu discussion. Let me drop some pointers here for now, and I hope to find some time to upload a new revision later.
https://salsa.debian.org/debian/dracut/-/merge_requests/24/
https://bugs.launchpad.net/ubuntu/+source/dracut/+bug/2031417