]> git.ipfire.org Git - thirdparty/systemd.git/commit
test: ensure cleanup functions return success
authorDavid Tardon <dtardon@redhat.com>
Wed, 13 Jul 2022 09:29:20 +0000 (11:29 +0200)
committerDavid Tardon <dtardon@redhat.com>
Wed, 13 Jul 2022 11:53:13 +0000 (13:53 +0200)
commitbd681a7eb04fd6d1fb9631e277bef93ceb06b321
treeb7475500053d6b018590fc94f01e6d3b1d70275b
parent8ce1a3033f0f19824296853c5392f799017a40ce
test: ensure cleanup functions return success

Otherwise the return value of the last command is propagated, which may
cause spurious test failures. E.g., pkill returns 1 if no process
matched, which may be a problem in cleanup session:

cleanup_session() {
...

    pkill -u "$(id -u logind-test-user)"
    sleep 1
    pkill -KILL -u "$(id -u logind-test-user)"
}

If there are no remaining processes when the final pkill runs, it will
return 1 and therefore cleanup_session will return 1 as well.
test/units/testsuite-35.sh