summaryrefslogtreecommitdiff
path: root/tests/test-qdev-global-props.c
AgeCommit message (Collapse)AuthorFilesLines
2014-09-18qdev: Move global validation to a single functionEduardo Habkost1-11/+55
Currently GlobalProperty.not_used=false has multiple meanings: * It may be a property for a hotpluggable device, which may or may not have been used by a device; * It may be a machine-type-provided property, which may or may not have been used by a device. * It may be a user-provided property that was actually not used by any device. Simplify the logic by having two separate fields: 'user_provided' and 'used'. This allows the entire global property validation logic to be contained in a single function, and allows more specific error messages. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-09-18qdev: Rename qdev_prop_check_global() to qdev_prop_check_globals()Eduardo Habkost1-1/+1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-09-18test-qdev-global-props: Test handling of hotpluggable and non-device typesEduardo Habkost1-0/+55
Ensure no warning will be printed for hotpluggable types, and warnings will be printed for non-device types. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-09-18test-qdev-global-props: Initialize not_used=true for all propsEduardo Habkost1-2/+5
This will ensure we are actually testing the code which sets not_used=false when the property is used. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-09-18test-qdev-global-props: Run tests on subprocessEduardo Habkost1-6/+43
There are multiple reasons for running the global property tests on a subprocess: * We need the global_props lists to be empty for each test case, so global properties from the previous test won't affect the next one; * We don't want the qdev_prop_check_global() warnings to pollute test output; * With a subprocess, we can ensure qdev_prop_check_global() is printing the warning messages it should. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-09-14test-qdev-global-props: Trivial comment fixEduardo Habkost1-1/+1
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Acked-by: Michael S. Tsirkin <mst@redhat.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2014-06-05qdev: Add test of qdev_prop_check_globalDon Slutz1-0/+4
This will generate a warning from "make check": ... GTESTER tests/test-qdev-global-props Warning: "-global dynamic-prop-type-bad.prop3=103" not used GTESTER tests/check-qom-interface ... If the warning is not generated, the test will fail. Signed-off-by: Don Slutz <dslutz@verizon.com> Acked-by: Michael S. Tsirkin <mst@redhat.com>
2013-08-16qdev: Set globals in instance_post_init functionEduardo Habkost1-0/+73
This way, properties registered in the instance_init function of child classes will be handled properly by qdev_prop_set_globals(), too. Includes a unit test for the new functionality. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>
2013-08-16tests: Unit tests for qdev global properties handlingEduardo Habkost1-0/+107
This tests the qdev global-properties handling code. Signed-off-by: Eduardo Habkost <ehabkost@redhat.com> Signed-off-by: Andreas Färber <afaerber@suse.de>