diff options
author | Andrea Bolognani <abologna@redhat.com> | 2023-03-01 11:06:14 +0100 |
---|---|---|
committer | Andrea Bolognani <abologna@redhat.com> | 2023-03-03 13:52:37 +0100 |
commit | 87b30e696565fc8ed5556c7171472d46fafc1478 (patch) | |
tree | 918875db2c8408e1a8ffd80810ab7543d80ad3f6 /tests/virhostdevtest.c | |
parent | 457a0183d6e0a543232c0cf5d35314449c863cf2 (diff) | |
download | libvirt-87b30e696565fc8ed5556c7171472d46fafc1478.tar.gz |
tests: Move fakerootdir handling to common logic
Instead of having each test manually initialize and cleanup
its own fakerootdir, do that as part of the common test
initialization logic in virTestMain().
In most cases we can simply drop the relevant code from the
test program, but scsihosttest uses the value of fakerootdir
as a starting point to build another path, so we need to do
things slightly differently. In order to keep things working,
we retrieve the value from the LIBVIRT_FAKE_ROOT_DIR
environment variable, same as all the mock libraries are
already doing.
Signed-off-by: Andrea Bolognani <abologna@redhat.com>
Reviewed-by: Laine Stump <laine@redhat.com>
Diffstat (limited to 'tests/virhostdevtest.c')
-rw-r--r-- | tests/virhostdevtest.c | 7 |
1 files changed, 0 insertions, 7 deletions
diff --git a/tests/virhostdevtest.c b/tests/virhostdevtest.c index c64940458f..ee0d1c1e6b 100644 --- a/tests/virhostdevtest.c +++ b/tests/virhostdevtest.c @@ -588,10 +588,6 @@ static int mymain(void) { int ret = 0; - g_autofree char *fakerootdir = NULL; - - if (!(fakerootdir = virTestFakeRootDirInit())) - return EXIT_FAILURE; # define DO_TEST(fnc) \ do { \ @@ -601,7 +597,6 @@ mymain(void) if (myInit() < 0) { fprintf(stderr, "Init data structures failed."); - virTestFakeRootDirCleanup(fakerootdir); return EXIT_FAILURE; } @@ -614,8 +609,6 @@ mymain(void) myCleanup(); - virTestFakeRootDirCleanup(fakerootdir); - return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE; } |