]> xenbits.xensource.com Git - libvirt.git/commitdiff
test: qemuxml2argv: Mock virMemoryMaxValue to remove 32/64 bit difference
authorPeter Krempa <pkrempa@redhat.com>
Thu, 10 Dec 2015 13:36:51 +0000 (14:36 +0100)
committerPeter Krempa <pkrempa@redhat.com>
Fri, 11 Dec 2015 11:23:38 +0000 (12:23 +0100)
Always return LLONG_MAX even on 32 bit systems. The limitation
originates from our use of "unsigned long" in several APIs. The internal
data type is unsigned long long. Make the test suite deterministic by
removing the architecture difference.

Flaw was introduced in 645881139b3d2c86acf9d644c3a1471520bc9e57 where
I've added a test that uses too large numbers.

src/util/virutil.c
tests/qemuxml2argvmock.c

index 177f9d75fb1d79efcc183caa9d8b3fe07d93ad63..bb9604a0c1ffb9c99e454e84878a8c376f773046 100644 (file)
@@ -2658,6 +2658,8 @@ virMemoryLimitIsSet(unsigned long long value)
  * @capped: whether the value must fit into unsigned long
  *   (long long is assumed otherwise)
  *
+ * Note: This function is mocked in tests/qemuxml2argvmock.c for test stability
+ *
  * Returns the maximum possible memory value in bytes.
  */
 unsigned long long
index e58b8ce8b565825a4b9d767823ca3b04a2a49c42..8426108b29ed2dd59cb84743cd968ee2e6cac8d5 100644 (file)
@@ -74,3 +74,13 @@ virTPMCreateCancelPath(const char *devpath)
 
     return path;
 }
+
+/**
+ * Large values for memory would fail on 32 bit systems, despite having
+ * variables that support it.
+ */
+unsigned long long
+virMemoryMaxValue(bool capped ATTRIBUTE_UNUSED)
+{
+    return LLONG_MAX;
+}