As of previous commit, the CH driver checks for /dev/kvm and/or
/dev/mshv presence. In order to make chxml2xmltest work
regardless of host configuration, introduce a mock that pretends
both of these files are accessible.
Fixes: 51c14df9670ba2f5d193b700f39e6464e1bc18c6
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
Reviewed-by: Peter Krempa <pkrempa@redhat.com>
--- /dev/null
+/*
+ * Copyright (C) 2024 Red Hat, Inc.
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#include <config.h>
+#include <unistd.h>
+
+#include "internal.h"
+#include "virfile.h"
+
+bool
+virFileExists(const char *path)
+{
+ if (STREQ(path, "/dev/kvm"))
+ return true;
+ if (STREQ(path, "/dev/mshv"))
+ return true;
+ return access(path, F_OK) == 0;
+}
return ret == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
}
-VIR_TEST_MAIN(mymain)
+VIR_TEST_MAIN_PRELOAD(mymain, VIR_TEST_MOCK("chxml2xml"))
tests += [
{ 'name': 'chxml2xmltest', 'link_with': [ ch_driver_impl ] },
]
+ mock_libs += [
+ { 'name': 'chxml2xmlmock' },
+ ]
endif
if conf.has('WITH_ESX')