diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:42 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-04 17:58:42 +0000 |
commit | d6a20015c95e2a15f0f8dc6fcd73d3f5695e32e7 (patch) | |
tree | 9932358072ca6e6beb6854aba698ecbb3b5532aa /tests/unit/oom-score-adj.tcl | |
parent | Releasing progress-linux version 5:7.2.4-1~progress7.99u1. (diff) | |
download | redis-d6a20015c95e2a15f0f8dc6fcd73d3f5695e32e7.tar.xz redis-d6a20015c95e2a15f0f8dc6fcd73d3f5695e32e7.zip |
Merging upstream version 5:7.2.5.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | tests/unit/oom-score-adj.tcl | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/tests/unit/oom-score-adj.tcl b/tests/unit/oom-score-adj.tcl index 6c7b713..77c4c38 100644 --- a/tests/unit/oom-score-adj.tcl +++ b/tests/unit/oom-score-adj.tcl @@ -1,5 +1,4 @@ set system_name [string tolower [exec uname -s]] -set user_id [exec id -u] if {$system_name eq {linux}} { start_server {tags {"oom-score-adj external:skip"}} { @@ -56,8 +55,15 @@ if {$system_name eq {linux}} { } } + # Determine whether the current user is unprivileged + set original_value [exec cat /proc/self/oom_score_adj] + catch { + set fd [open "/proc/self/oom_score_adj" "w"] + puts $fd -1000 + close $fd + } e # Failed oom-score-adj tests can only run unprivileged - if {$user_id != 0} { + if {[string match "*permission denied*" $e]} { test {CONFIG SET oom-score-adj handles configuration failures} { # Bad config r config set oom-score-adj no @@ -81,6 +87,11 @@ if {$system_name eq {linux}} { # Make sure previous values remain assert {[r config get oom-score-adj-values] == {oom-score-adj-values {0 100 100}}} } + } else { + # Restore the original oom_score_adj value + set fd [open "/proc/self/oom_score_adj" "w"] + puts $fd $original_value + close $fd } test {CONFIG SET oom-score-adj-values doesn't touch proc when disabled} { |