virschematest: Don't bother checking symlinked XMLs

There's plenty symlinks in qemuxml2argvdata and qemuxml2xmlout
directories pointing to other files in the same directory. It makes no
sense to check those files twice, thus we can simply skip symlinks.

Signed-off-by: Peter Krempa <pkrempa@redhat.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
This commit is contained in:
Peter Krempa 2024-01-23 13:59:11 +01:00
parent 91f9a9fb4f
commit f997fcca71

View File

@ -118,11 +118,15 @@ testSchemaDir(const char *schema,
while ((rc = virDirRead(dir, &ent, dir_path)) > 0) { while ((rc = virDirRead(dir, &ent, dir_path)) > 0) {
g_autofree char *xml_path = NULL; g_autofree char *xml_path = NULL;
bool exception = false; bool exception = false;
GStatBuf sb;
if (!virStringHasSuffix(ent->d_name, ".xml")) if (!virStringHasSuffix(ent->d_name, ".xml"))
continue; continue;
if (ent->d_name[0] == '.') if (ent->d_name[0] == '.')
continue; continue;
if (g_lstat(ent->d_name, &sb) >= 0 &&
S_ISLNK(sb.st_mode))
continue;
if (filter && if (filter &&
!g_regex_match(filter, ent->d_name, 0, NULL)) !g_regex_match(filter, ent->d_name, 0, NULL))
continue; continue;