Running tests as a different user

David A. Desrosiers desrod at gnu-designs.com
Sat Apr 12 08:50:14 EST 2008


I have a need to run the 5.0p1 'tests' target as another user; specifically
one who has a writable $HOME so the tests can complete by creating and
modifying ~/.ssh/.

I tried butchering the test suite in ./regress/ and taking out all of the
'whoami', 'id -un' and other relevant '$USER' references, replacing them
with the specific environment variables and/or usernames that I need, and
when I run the 'tests' target, all of those changes are instantly clobbered
back to non-workable defaults.

I can't seem to figure out exactly where this is happening, and the only
likely culprit seems to be hard-coded in the ssh-keygen binary. I'd rather
not go modifying the innards of the compiled binaries just to pass the test
suite.

The user who configures, builds and tests software in this context, has NO
writable home directory, so all of the tests immediately fail in ugly ways.

What am I missing here? Is there some way to pass a different $HOME (such as
/tmp/ or /var/empty) prior to running the tests? Or specify a different user
to run them as? ($SUDO_USER in our case).

I tried the obvious "HOME=/tmp/ make tests", but that fails, as does other
similar methods.

Short of tricking the tree with LD_PRELOAD or similar hacks, what is the
best way to solve this problem?

Thanks in advance.

David A. Desrosiers
e: desrod at gnu-designs.com
p: 860-367-8456


More information about the openssh-unix-dev mailing list