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