Skip to content
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

Eliminate the need for run() wrapper in the test-suite #3447

Merged
merged 12 commits into from
Nov 18, 2024

Conversation

pmatilai
Copy link
Member

Details in commit messages, but short summary: move the test-suite rpm configuration from --define's to a permanent file, and setup_env calls from the wrapper functions to RPMTEST_CHECK*(). As a result, run() becomes entirely redundant can be removed - that is, for a large class of tests, you can just use commands directly without any extra fubar.

The buildhost gets centrally set to "testhost" nowadays, there's no
need to do anything in this test. And, turns out this hasn't actually
been honored, the built packages get "testhost" from the upper level
settings as it is. This confused us greatly.
@pmatilai pmatilai requested a review from a team as a code owner November 15, 2024 12:38
@pmatilai pmatilai requested review from dmnks and removed request for a team November 15, 2024 12:38
@pmatilai
Copy link
Member Author

pmatilai commented Nov 15, 2024

Oh pooh, ONE test fails and I can't reproduce that locally. Going to be fun chasing this down...
Guess I'll just push the later commits one by one to see where it fails.

@pmatilai pmatilai marked this pull request as draft November 15, 2024 14:01
@pmatilai pmatilai force-pushed the norun-pr branch 2 times, most recently from ab7ab9e to 9f6c97b Compare November 15, 2024 14:18
@pmatilai
Copy link
Member Author

Okay... So that "rpmdb --export and --import" test fails due to the --dbpath definition being removed. What's peculiar is that said test explicitly sets dbpath by itself: --dbpath ${RPMTEST}/data/misc/. But, due to the way the wrapper functions work, the dbpath set by the test doesn't get used, it gets overridden by the --dbpath in the run() wrapper. And when this PR removes the redundant path override, the one specified in the test gets used. So basically the bug is in the test (or the feature it tests), just masked by this other fun.

What makes it even more entertaining is that this PR passes "make check" and "make ci" for me locally, so it seems like one of those "only on Ubuntu" gotchas. I won't be able to finish this today, but I pushed the full PR back as originally submitted and converted to draft.

run() overrides --dbpath so this hasn't been actually used at all. Nor
is it needed - the underlying image is mounted read-only at this point
as per the comment.

Obviously --dbpath would affect the contents of the rpmdb found in that
place, but for the purposes of this test it doesn't matter: we only care
that it's on a read-only mounted media, which both /data and the system
rpmdb are. However for some mystery reason, trying to open the database
in /data/ fails on the GH Ubuntu runners, but succeeds when running on a
Fedora host. This doesn't seem worth chasing...
This is technically covered by the reproducability tests but
"testhost" is easier to reason about than an opaque checksum telling you
"its wrong and YOU broke it"
There may already be something important in there...
No functional changes as such, but one step closer to being able to
drop some of the wrapper functions entirely.
These were absolutely crucial in the fakechroot days but the
test-environment is a very different animal now...
The snapshot case always needs a wrapper function of some kind,
so it makes sense to optimize the setup for the non-snapshot case to
allow running commands without any wrappers in the way.

Set the test-suite %_tmppath as per non-snapshot case and move the
last remaining command line --define override to runroot() instead.
This makes run() entirely redundant.

The %_tmppath override in runroot() shouldn't really be necessary but
scriptlet related tests fail without that. I suspect it's related to
/tmp being tmpfs in the test-suite but dunno. It's a mystery for some
other day...
All tests are running in a container with the newly built rpm
as the system rpm, for many things runroot is simply no longer needed.
This isn't anywhere near them all, just a bunch of the more obvious
ones.

Running this without the extra nested root does have the downside of
exposing testsuite paths in the container, eg the second rpmspec --parse
test is left as runroot here because it'd otherwise produce output like
"/srv/rpmtests.dir/195/tree/build/SOURCES/hello-1.0-modernize.patch"
and we don't want to have to adjust numbers in unrelated tests if we
add something before that. This could probably be hidden with further
container magic.
Drop runroot from most macro-related tests. There are any number of
further test-cases where doing so would be possible but these are among
some of the more obvious ones.
See previous commits for rationale.
@pmatilai pmatilai marked this pull request as ready for review November 18, 2024 08:25
@pmatilai
Copy link
Member Author

There are about a thousand further cases were runroot() can be eliminated but lets leave something for another rainy day 😅

@pmatilai
Copy link
Member Author

As for the "Ubuntu mystery", see 06e4da1 - I still don't know why exactly its failing for that one path but not for something else that should be on the same image, but for the purpose of that test which of the two paths gets used is wholly irrelevant, so I'm not going to die on that hill today.

@dmnks
Copy link
Contributor

dmnks commented Nov 18, 2024

Looks good, well done 😄 The courage for diving into this bottomless pit is commendable (and very much appreciated) 😄

@dmnks dmnks merged commit 3006c84 into rpm-software-management:master Nov 18, 2024
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants