Execute benchmarks as current user - #308
Open
smarr wants to merge 7 commits into
Open
Conversation
Instead of running the benchmarks as root, switch to the user running rebench. Co-authored-by: Florian Huemer <florian.huemer@jku.at> Co-authored-by: Stefan Marr <git@stefan-marr.de> Signed-off-by: Stefan Marr <git@stefan-marr.de>
- test for the machine capabilities and end-to-end behavior - test that environment variables as passed through to the benchmark Signed-off-by: Stefan Marr <git@stefan-marr.de>
- this is only so after all variable replacement has been done - do not run benchmark command in a shell anymore, since it’s not supported with string lists Signed-off-by: Stefan Marr <git@stefan-marr.de>
- cmdline feels now a bit misleading Signed-off-by: Stefan Marr <git@stefan-marr.de>
- do not need to preserve env anymore, since we create it explicitly - remove PYTHONPATH from perserved env vars. It seesm to work without - and we do not need SETENV capability anymore Signed-off-by: Stefan Marr <git@stefan-marr.de>
This is expected to be more consistent since getuser() may use envvars, which seem problematic when the gitlab runner runs on macOS, where it sees a stale “root” user, even though the effective user is gitlab-runner. Signed-off-by: Stefan Marr <git@stefan-marr.de>
Signed-off-by: Stefan Marr <git@stefan-marr.de>
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The main goal of the PR is to ensure that benchmarks are run with the current user.
Before, when we use denoise, we'd end up running with root. Now, we return back to the initial user and execute the benchmarks as that one.
The core change is thus, to add a
sudo -u $currentUserto the command line that executes the benchmark.Though to make this work, we need a few more changes:
env -ito create an empty environment in $currentUser, and only set the vars we wantlist[str]. We keep it as astruntil all ReBench variables are replaced during preparing the cmdline when creating the runs.geteuid()andgetpwuid()to avoid picking up stale env vars with the users name. This was an issue on macOS.Added tests:
@flohuemer, since you proposed the initial change, could you give this a read/review? Thanks!