tests/kms_force_connector: fix assertion when VGA is already connected

Compare the number of modes available when the edid is reset with the
number before the edid was overridden.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=82230
Signed-off-by: Thomas Wood <thomas.wood@intel.com>
This commit is contained in:
Thomas Wood 2014-10-15 12:10:13 +01:00
parent 1a0ae51f51
commit 06de0e7f29

View File

@ -35,6 +35,7 @@ main (int argc, char **argv)
drmModeRes *res; drmModeRes *res;
drmModeConnector *vga_connector, *temp; drmModeConnector *vga_connector, *temp;
igt_display_t display; igt_display_t display;
int start_n_modes;
igt_simple_init(argc, argv); igt_simple_init(argc, argv);
@ -61,6 +62,7 @@ main (int argc, char **argv)
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id); temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
igt_assert(temp->connection == DRM_MODE_CONNECTED); igt_assert(temp->connection == DRM_MODE_CONNECTED);
igt_assert(temp->count_modes > 0); igt_assert(temp->count_modes > 0);
start_n_modes = temp->count_modes;
drmModeFreeConnector(temp); drmModeFreeConnector(temp);
/* attempt to use the display */ /* attempt to use the display */
@ -96,8 +98,9 @@ main (int argc, char **argv)
/* remove edid */ /* remove edid */
kmstest_force_edid(drm_fd, vga_connector, NULL, 0); kmstest_force_edid(drm_fd, vga_connector, NULL, 0);
temp = drmModeGetConnector(drm_fd, vga_connector->connector_id); temp = drmModeGetConnector(drm_fd, vga_connector->connector_id);
/* the connector should now have the 5 default modes */ /* the connector should now have the same number of modes that it
igt_assert(temp->count_modes == 5); * started with */
igt_assert(temp->count_modes == start_n_modes);
drmModeFreeConnector(temp); drmModeFreeConnector(temp);
/* force the connector off */ /* force the connector off */