• M
    tests: Set PATH in each test · 363b401f
    Michal Privoznik 提交于
    Currently we spawn couple of binaries in our test suite.
    Moreover, we provide some spoofed versions of system binaries
    hoping that those will be executed instead of the system ones.
    For instance, for testing SSH socket we have written our own ssh
    binary for producing predictable results. We certainly don't want
    to execute the system ssh binary.
    However, in order to prefer our binaries over system ones, we
    need to set PATH environment variable. But this is done only at
    the Makefile level. So if anybody runs a test by hand that
    expects our spoofed binary, the test ends up executing real
    system binaries. This is not good. In fact, it's terribly wrong.
    The fix lies in a small trick - putting our build directory at
    the beginning of the PATH environment variable in each test.
    Hopefully, since every test has this VIRT_TEST_MAIN* wrapper, we
    can fix this at a single place.
    Moreover, while this removes setting PATH for our tests written
    in bash, it's safe as we are not calling anything ours that would
    require PATH change there.
    Signed-off-by: NMichal Privoznik <mprivozn@redhat.com>
    363b401f
testutils.c 32.4 KB