aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <richard.henderson@linaro.org>2023-12-21 14:16:51 +1100
committerRichard Henderson <richard.henderson@linaro.org>2023-12-30 07:38:06 +1100
commit57c73988ac9f95e1f4623a0cc6e882c8fa3a5136 (patch)
treefe30492d080d3bf9a5b6a6d4fa0899acb0aeca92
parent59c2ddedcbe70a9ead3378b4946edc66b8757cb6 (diff)
downloadqemu-57c73988ac9f95e1f4623a0cc6e882c8fa3a5136.zip
qemu-57c73988ac9f95e1f4623a0cc6e882c8fa3a5136.tar.gz
qemu-57c73988ac9f95e1f4623a0cc6e882c8fa3a5136.tar.bz2
tests/unit/test-vmstate: Constify VMState
While const data in tests is not particularly important, this makes a grep test clear across the tree. Reviewed-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Richard Henderson <richard.henderson@linaro.org> Message-Id: <20231221031652.119827-71-richard.henderson@linaro.org>
-rw-r--r--tests/unit/test-vmstate.c36
1 files changed, 18 insertions, 18 deletions
diff --git a/tests/unit/test-vmstate.c b/tests/unit/test-vmstate.c
index 0b7d5ec..c4f9faa 100644
--- a/tests/unit/test-vmstate.c
+++ b/tests/unit/test-vmstate.c
@@ -197,7 +197,7 @@ static const VMStateDescription vmstate_simple_primitive = {
.name = "simple/primitive",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_BOOL(b_1, TestSimple),
VMSTATE_BOOL(b_2, TestSimple),
VMSTATE_UINT8(u8_1, TestSimple),
@@ -299,7 +299,7 @@ static const VMStateDescription vmstate_simple_arr = {
.name = "simple/array",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT16_ARRAY(u16_1, TestSimpleArray, 3),
VMSTATE_END_OF_LIST()
}
@@ -341,7 +341,7 @@ static const VMStateDescription vmstate_versioned = {
.name = "test/versioned",
.version_id = 2,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT32(a, TestStruct),
VMSTATE_UINT32_V(b, TestStruct, 2), /* Versioned field in the middle, so
* we catch bugs more easily.
@@ -412,7 +412,7 @@ static const VMStateDescription vmstate_skipping = {
.name = "test/skip",
.version_id = 2,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT32(a, TestStruct),
VMSTATE_UINT32(b, TestStruct),
VMSTATE_UINT32_TEST(c, TestStruct, test_skip),
@@ -524,7 +524,7 @@ const VMStateDescription vmsd_tst = {
.name = "test/tst",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_INT32(i, TestStructTriv),
VMSTATE_END_OF_LIST()
}
@@ -542,7 +542,7 @@ const VMStateDescription vmsd_arps = {
.name = "test/arps",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_ARRAY_OF_POINTER_TO_STRUCT(ar, TestArrayOfPtrToStuct,
AR_SIZE, 0, vmsd_tst, TestStructTriv),
VMSTATE_END_OF_LIST()
@@ -630,7 +630,7 @@ const VMStateDescription vmsd_arpp = {
.name = "test/arps",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_ARRAY_OF_POINTER(ar, TestArrayOfPtrToInt,
AR_SIZE, 0, vmstate_info_int32, int32_t*),
VMSTATE_END_OF_LIST()
@@ -685,7 +685,7 @@ static const VMStateDescription vmstate_q_element = {
.name = "test/queue-element",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_BOOL(b, TestQtailqElement),
VMSTATE_UINT8(u8, TestQtailqElement),
VMSTATE_END_OF_LIST()
@@ -696,7 +696,7 @@ static const VMStateDescription vmstate_q = {
.name = "test/queue",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_INT16(i16, TestQtailq),
VMSTATE_QTAILQ_V(q, TestQtailq, 1, vmstate_q_element, TestQtailqElement,
next),
@@ -821,7 +821,7 @@ typedef struct TestGTreeInterval {
.name = "interval", \
.version_id = 1, \
.minimum_version_id = 1, \
- .fields = (VMStateField[]) { \
+ .fields = (const VMStateField[]) { \
VMSTATE_UINT64(low, TestGTreeInterval), \
VMSTATE_UINT64(high, TestGTreeInterval), \
VMSTATE_END_OF_LIST() \
@@ -839,7 +839,7 @@ typedef struct TestGTreeMapping {
.name = "mapping", \
.version_id = 1, \
.minimum_version_id = 1, \
- .fields = (VMStateField[]) { \
+ .fields = (const VMStateField[]) { \
VMSTATE_UINT64(phys_addr, TestGTreeMapping), \
VMSTATE_UINT32(flags, TestGTreeMapping), \
VMSTATE_END_OF_LIST() \
@@ -915,7 +915,7 @@ static const VMStateDescription vmstate_domain = {
.version_id = 1,
.minimum_version_id = 1,
.pre_load = domain_preload,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_INT32(id, TestGTreeDomain),
VMSTATE_GTREE_V(mappings, TestGTreeDomain, 1,
vmstate_interval_mapping,
@@ -940,7 +940,7 @@ static const VMStateDescription vmstate_qlist_element = {
.name = "test/queue list",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT32(id, TestQListElement),
VMSTATE_END_OF_LIST()
}
@@ -951,7 +951,7 @@ static const VMStateDescription vmstate_iommu = {
.version_id = 1,
.minimum_version_id = 1,
.pre_load = iommu_preload,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_INT32(id, TestGTreeIOMMU),
VMSTATE_GTREE_DIRECT_KEY_V(domains, TestGTreeIOMMU, 1,
&vmstate_domain, TestGTreeDomain),
@@ -963,7 +963,7 @@ static const VMStateDescription vmstate_container = {
.name = "test/container/qlist",
.version_id = 1,
.minimum_version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT32(id, TestQListContainer),
VMSTATE_QLIST_V(list, TestQListContainer, 1, vmstate_qlist_element,
TestQListElement, next),
@@ -1414,7 +1414,7 @@ static int tmp_child_post_load(void *opaque, int version_id)
static const VMStateDescription vmstate_tmp_back_to_parent = {
.name = "test/tmp_child_parent",
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT64(f, TestStruct),
VMSTATE_END_OF_LIST()
}
@@ -1424,7 +1424,7 @@ static const VMStateDescription vmstate_tmp_child = {
.name = "test/tmp_child",
.pre_save = tmp_child_pre_save,
.post_load = tmp_child_post_load,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_INT64(diff, TmpTestStruct),
VMSTATE_STRUCT_POINTER(parent, TmpTestStruct,
vmstate_tmp_back_to_parent, TestStruct),
@@ -1435,7 +1435,7 @@ static const VMStateDescription vmstate_tmp_child = {
static const VMStateDescription vmstate_with_tmp = {
.name = "test/with_tmp",
.version_id = 1,
- .fields = (VMStateField[]) {
+ .fields = (const VMStateField[]) {
VMSTATE_UINT32(a, TestStruct),
VMSTATE_UINT64(d, TestStruct),
VMSTATE_WITH_TMP(TestStruct, TmpTestStruct, vmstate_tmp_child),