tests/: Modify not to rely on system-installed libgtest

This allows building testsuite even without root access and even with
simply installing the libgtest-dev package on Debian-alike systems.