Re: [TEST PATCH] KVM: selftests: Add a test case for debugfs directory

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 28/08/21 01:48, Krish Sadhukhan wrote:
+ /*
+	 * Check debugfs directory for every VM and VCPU
+	 */
+	struct stat buf;
+	int len;
+	char *vm_dir_path = NULL;
+	char *vcpu_dir_path = NULL;
+
+	len = strlen(KVM_DEBUGFS_PATH) + 2 * INT_MAX_LEN + 3;
+	vm_dir_path = malloc(len);
+	TEST_ASSERT(vm_dir_path, "Allocate memory for VM directory path");
+	vcpu_dir_path = malloc(len + INT_MAX_LEN + 6);
+	TEST_ASSERT(vm_dir_path, "Allocate memory for VCPU directory path");
+	for (i = 0; i < max_vm; ++i) {
+		sprintf(vm_dir_path, "%s/%d-%d", KVM_DEBUGFS_PATH, getpid(),
+			vm_get_fd(vms[i]));
+		stat(vm_dir_path, &buf);
+		TEST_ASSERT(S_ISDIR(buf.st_mode), "VM directory %s does not exist",
+			    vm_dir_path);
+		for (j = 0; j < max_vcpu; ++j) {
+			sprintf(vcpu_dir_path, "%s/vcpu%d", vm_dir_path, j);
+			stat(vcpu_dir_path, &buf);
+			TEST_ASSERT(S_ISDIR(buf.st_mode), "VCPU directory %s does not exist",
+				    vcpu_dir_path);
+		}
+	}
+

Hi,

please ensure that the tests don't fail if thy don't run as root.

Paolo




[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux