
On 04.12.2015 15:34, Andrea Bolognani wrote:
When mocking filesystem access in the test suite, we have always assumed it to be some subdirectory of /sys depending on the needs of the specific test case.
This limits our flexibility, and will be a problem once we need to start mocking eg. /dev as well, or simply two different parts of the /sys filesystem at the same time[1].
Solve the issue by always using the temporary directory as the root directory for the mocked filesystem.
The series is organized as follows:
1-2: Tiny cleanups 3-4: Change the mock libraries so that they build the proper directory structure 5: Change the name of the environment variable used to pass the temporary directory name to the mock libraries 6: Make it so we'll be able to mock different parts of the /sys filesystem at the same time 7: Update scsihosttest to use the same directory structure
Cheers.
[1] https://www.redhat.com/archives/libvir-list/2015-November/msg00532.html is an example of why we would need to do that
Andrea Bolognani (7): tests: scsihost: Don't set LIBVIRT_FAKE_SYSFS_DIR tests: pcimock: Remove check for fakesysfsdir tests: pcimock: Use the temporary directory as fake root tests: cgroupmock: Use the temporary directory as fake root tests: Rename LIBVIRT_FAKE_SYSFS_DIR to LIBVIRT_FAKE_ROOT_DIR tests: Use more specific names for variables tests: scsihost: Use fakerootdir instead of fakesysfsdir
tests/scsihosttest.c | 17 ++++++--- tests/vircgroupmock.c | 99 ++++++++++++++++++++++++++++---------------------- tests/vircgrouptest.c | 16 ++++---- tests/virhostdevtest.c | 16 ++++---- tests/virpcimock.c | 69 +++++++++++++++++++---------------- tests/virpcitest.c | 16 ++++---- 6 files changed, 129 insertions(+), 104 deletions(-)
ACK, although I'd rather wait until after release. If you (or somebody else) feels otherwise, do push it any time you want. Michal