+static void hotplug_class_init(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ dc->realize = NULL;
+ dc->hotpluggable = true;
+}
+
+static const TypeInfo hotplug_type = {
+ .name = TYPE_UNUSED_HOTPLUG,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(MyType),
+ .instance_init = dynamic_instance_init,
+ .class_init = hotplug_class_init,
+};
+
+static void nohotplug_class_init(ObjectClass *oc, void *data)
+{
+ DeviceClass *dc = DEVICE_CLASS(oc);
+
+ dc->realize = NULL;
+ dc->hotpluggable = false;
+}
+
+static const TypeInfo nohotplug_type = {
+ .name = TYPE_UNUSED_NOHOTPLUG,
+ .parent = TYPE_DEVICE,
+ .instance_size = sizeof(MyType),
+ .instance_init = dynamic_instance_init,
+ .class_init = nohotplug_class_init,
+};
+
+#define TYPE_NONDEVICE "nondevice-type"
+
+static const TypeInfo nondevice_type = {
+ .name = TYPE_NONDEVICE,
+ .parent = TYPE_OBJECT,
+};
+
+/* Test setting of dynamic properties using global properties */
+static void test_dynamic_globalprop_subprocess(void)
+{
+ MyType *mt;
+ static GlobalProperty props[] = {
+ { TYPE_DYNAMIC_PROPS, "prop1", "101", true },
+ { TYPE_DYNAMIC_PROPS, "prop2", "102", true },
+ { TYPE_DYNAMIC_PROPS"-bad", "prop3", "103", true },
+ { TYPE_UNUSED_HOTPLUG, "prop4", "104", true },
+ { TYPE_UNUSED_NOHOTPLUG, "prop5", "105", true },
+ { TYPE_NONDEVICE, "prop6", "106", true },
+ {}
+ };
+ int all_used;
+
+ qdev_prop_register_global_list(props);
+
+ mt = DYNAMIC_TYPE(object_new(TYPE_DYNAMIC_PROPS));
+ qdev_init_nofail(DEVICE(mt));
+
+ g_assert_cmpuint(mt->prop1, ==, 101);
+ g_assert_cmpuint(mt->prop2, ==, 102);
+ all_used = qdev_prop_check_globals();
+ g_assert_cmpuint(all_used, ==, 1);
+ g_assert(props[0].used);
+ g_assert(props[1].used);
+ g_assert(!props[2].used);
+ g_assert(!props[3].used);
+ g_assert(!props[4].used);
+ g_assert(!props[5].used);
+}
+