]> git.proxmox.com Git - mirror_qemu.git/commit
tests/9pfs: fix test dir for parallel tests
authorChristian Schoenebeck <qemu_oss@crudebyte.com>
Sun, 1 Nov 2020 14:37:12 +0000 (15:37 +0100)
committerChristian Schoenebeck <qemu_oss@crudebyte.com>
Sun, 1 Nov 2020 18:44:29 +0000 (19:44 +0100)
commit136b7af22774a6f0fb44c9c1b8c088b52e2e92ed
tree06c382a3573418b693bc98b0ab1dbfc0eeea3441
parent8db193c4108e09996923a4d716b51fc98efb7f3a
tests/9pfs: fix test dir for parallel tests

Use mkdtemp() to generate a unique directory for the 9p 'local' tests.

This fixes occasional 9p test failures when running 'make check -jN' if
QEMU was compiled for multiple target architectures, because the individual
architecture's test suites would run in parallel and interfere with each
other's data as the test directory was previously hard coded and hence the
same directory was used by all of them simultaniously.

This also requires a change how the test directory is created and deleted:
As the test path is now randomized and virtio_9p_register_nodes() being
called in a somewhat undeterministic way, that's no longer an appropriate
place to create and remove the test directory. Use a constructor and
destructor function for creating and removing the test directory instead.
Unfortunately libqos currently does not support setup/teardown callbacks
to handle this more cleanly.

The constructor functions needs to be in virtio-9p-test.c, not in
virtio-9p.c, because in the latter location it would cause all apps that
link to libqos (i.e. entirely unrelated test suites) to create a 9pfs
test directory as well, which would even break other test suites.

Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Tested-by: Greg Kurz <groug@kaod.org>
Message-Id: <7746f42d8f557593898d3d9d8e57c46e872dfb4f.1604243521.git.qemu_oss@crudebyte.com>
Signed-off-by: Christian Schoenebeck <qemu_oss@crudebyte.com>
tests/qtest/libqos/virtio-9p.c
tests/qtest/virtio-9p-test.c