test-execute: add tests for OOMScoreAdjust

This commit is contained in:
Ronny Chevalier
2015-10-31 15:07:19 +01:00
parent 03bd70dd01
commit c388dfea5a
4 changed files with 22 additions and 0 deletions
+2
View File
@@ -1568,6 +1568,8 @@ EXTRA_DIST += \
test/exec-umask-default.service \
test/exec-privatenetwork-yes.service \
test/exec-environmentfile.service \
test/exec-oomscoreadjust-positive.service \
test/exec-oomscoreadjust-negative.service \
test/bus-policy/hello.conf \
test/bus-policy/methods.conf \
test/bus-policy/ownerships.conf \
+6
View File
@@ -211,6 +211,11 @@ static void test_exec_privatenetwork(Manager *m) {
test(m, "exec-privatenetwork-yes.service", 0, CLD_EXITED);
}
static void test_exec_oomscoreadjust(Manager *m) {
test(m, "exec-oomscoreadjust-positive.service", 0, CLD_EXITED);
test(m, "exec-oomscoreadjust-negative.service", 0, CLD_EXITED);
}
int main(int argc, char *argv[]) {
test_function_t tests[] = {
test_exec_workingdirectory,
@@ -228,6 +233,7 @@ int main(int argc, char *argv[]) {
test_exec_umask,
test_exec_runtimedirectory,
test_exec_capabilityboundingset,
test_exec_oomscoreadjust,
NULL,
};
test_function_t *test = NULL;
@@ -0,0 +1,7 @@
[Unit]
Description=Test for OOMScoreAdjust
[Service]
ExecStart=/bin/bash -c 'c=$(cat /proc/self/oom_score_adj); echo $c; exit $(test $c -eq -100)'
OOMScoreAdjust=-100
Type=oneshot
@@ -0,0 +1,7 @@
[Unit]
Description=Test for OOMScoreAdjust
[Service]
ExecStart=/bin/bash -c 'c=$(cat /proc/self/oom_score_adj); echo $c; exit $(test $c -eq 100)'
OOMScoreAdjust=100
Type=oneshot