mirror of
https://github.com/izzy2lost/xemu.git
synced 2026-07-06 00:20:22 -07:00
Merge remote-tracking branch 'remotes/cschoenebeck/tags/pull-9p-20201102' into staging
9pfs: only test case changes this time * Fix occasional test failures with parallel tests. * Fix coverity error in test code. * Avoid error when auto removing test directory if it disappeared for some reason. * Refactor: Rename functions to make top-level test functions fs_*() easily distinguishable from utility test functions do_*(). * Refactor: Drop unnecessary function arguments in utility test functions. * More test cases using the 9pfs 'local' filesystem driver backend, namely for the following 9p requests: Tunlinkat, Tlcreate, Tsymlink and Tlink. # gpg: Signature made Mon 02 Nov 2020 09:31:35 GMT # gpg: using RSA key 96D8D110CF7AF8084F88590134C2B58765A47395 # gpg: issuer "qemu_oss@crudebyte.com" # gpg: Good signature from "Christian Schoenebeck <qemu_oss@crudebyte.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: ECAB 1A45 4014 1413 BA38 4926 30DB 47C3 A012 D5F4 # Subkey fingerprint: 96D8 D110 CF7A F808 4F88 5901 34C2 B587 65A4 7395 * remotes/cschoenebeck/tags/pull-9p-20201102: tests/9pfs: add local Tunlinkat hard link test tests/9pfs: add local Tlink test tests/9pfs: add local Tunlinkat symlink test tests/9pfs: add local Tsymlink test tests/9pfs: add local Tunlinkat file test tests/9pfs: add local Tlcreate test tests/9pfs: add local Tunlinkat directory test tests/9pfs: simplify do_mkdir() tests/9pfs: Turn fs_mkdir() into a helper tests/9pfs: Turn fs_readdir_split() into a helper tests/9pfs: Factor out do_attach() helper tests/9pfs: Set alloc in fs_create_dir() tests/9pfs: Factor out do_version() helper tests/9pfs: Force removing of local 9pfs test directory tests/9pfs: fix coverity error in create_local_test_dir() tests/9pfs: fix test dir for parallel tests tests/9pfs: make create/remove test dir public Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
@@ -35,17 +35,28 @@ static char *concat_path(const char* a, const char* b)
|
||||
static void init_local_test_path(void)
|
||||
{
|
||||
char *pwd = g_get_current_dir();
|
||||
local_test_path = concat_path(pwd, "qtest-9p-local");
|
||||
char *template = concat_path(pwd, "qtest-9p-local-XXXXXX");
|
||||
local_test_path = mkdtemp(template);
|
||||
if (!local_test_path) {
|
||||
g_test_message("mkdtemp('%s') failed: %s", template, strerror(errno));
|
||||
}
|
||||
g_assert(local_test_path);
|
||||
g_free(pwd);
|
||||
}
|
||||
|
||||
/* Creates the directory for the 9pfs 'local' filesystem driver to access. */
|
||||
static void create_local_test_dir(void)
|
||||
void virtio_9p_create_local_test_dir(void)
|
||||
{
|
||||
struct stat st;
|
||||
int res;
|
||||
|
||||
init_local_test_path();
|
||||
|
||||
g_assert(local_test_path != NULL);
|
||||
mkdir(local_test_path, 0777);
|
||||
res = mkdir(local_test_path, 0777);
|
||||
if (res < 0) {
|
||||
g_test_message("mkdir('%s') failed: %s", local_test_path,
|
||||
strerror(errno));
|
||||
}
|
||||
|
||||
/* ensure test directory exists now ... */
|
||||
g_assert(stat(local_test_path, &st) == 0);
|
||||
@@ -53,11 +64,10 @@ static void create_local_test_dir(void)
|
||||
g_assert((st.st_mode & S_IFMT) == S_IFDIR);
|
||||
}
|
||||
|
||||
/* Deletes directory previously created by create_local_test_dir(). */
|
||||
static void remove_local_test_dir(void)
|
||||
void virtio_9p_remove_local_test_dir(void)
|
||||
{
|
||||
g_assert(local_test_path != NULL);
|
||||
char *cmd = g_strdup_printf("rm -r '%s'\n", local_test_path);
|
||||
char *cmd = g_strdup_printf("rm -fr '%s'\n", local_test_path);
|
||||
int res = system(cmd);
|
||||
if (res < 0) {
|
||||
/* ignore error, dummy check to prevent compiler error */
|
||||
@@ -246,11 +256,6 @@ static void virtio_9p_register_nodes(void)
|
||||
const char *str_simple = "fsdev=fsdev0,mount_tag=" MOUNT_TAG;
|
||||
const char *str_addr = "fsdev=fsdev0,addr=04.0,mount_tag=" MOUNT_TAG;
|
||||
|
||||
/* make sure test dir for the 'local' tests exists and is clean */
|
||||
init_local_test_path();
|
||||
remove_local_test_dir();
|
||||
create_local_test_dir();
|
||||
|
||||
QPCIAddress addr = {
|
||||
.devfn = QPCI_DEVFN(4, 0),
|
||||
};
|
||||
|
||||
@@ -44,6 +44,16 @@ struct QVirtio9PDevice {
|
||||
QVirtio9P v9p;
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates the directory for the 9pfs 'local' filesystem driver to access.
|
||||
*/
|
||||
void virtio_9p_create_local_test_dir(void);
|
||||
|
||||
/**
|
||||
* Deletes directory previously created by virtio_9p_create_local_test_dir().
|
||||
*/
|
||||
void virtio_9p_remove_local_test_dir(void);
|
||||
|
||||
/**
|
||||
* Prepares QEMU command line for 9pfs tests using the 'local' fs driver.
|
||||
*/
|
||||
|
||||
+443
-36
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user