When running under root, the privdrop tests did not properly work. This
patch fixes the issue and skips test where necessary.
This also includes some modernization of the related tests.
closes https://github.com/rsyslog/rsyslog/issues/4619
changes some of the test commands to use bash functions
includes some small bug fixes to tests where bugs were
previously not seen due to different plumbing.
- Don't use $UID, use $EUID instead
- Allow user to specify testuser (through RSYSLOG_TESTUSER env variable)
or fall back to various default users
- Validate if user running tests can really impersonate another user
- Test if testuser really exists
Fixes: https://github.com/rsyslog/rsyslog/issues/927