tests/monitor-unit-tests: Make serials more unique

We fairly consistently had multiple monitors with the whole
vendor,product,serial tuple identical. If we start relying on making
monitors a bit more unique, e.g. for colord integration, we need to make
two monitors connected distinguishable in order for tests to properly
reflect reality and excercise the correct colord integration paths.

Part-of: <https://gitlab.gnome.org/GNOME/mutter/-/merge_requests/2141>
This commit is contained in:
Jonas Ådahl 2021-10-28 15:17:35 +02:00 committed by Marge Bot
parent 972e393fc0
commit f939a7ca29
10 changed files with 107 additions and 64 deletions

View File

@ -686,7 +686,7 @@ meta_create_monitor_test_setup (MetaBackend *backend,
int n_possible_crtcs;
int scale;
gboolean is_laptop_panel;
const char *serial;
char *serial;
g_autoptr (MetaOutputInfo) output_info = NULL;
crtc_index = setup->outputs[i].crtc;
@ -729,9 +729,9 @@ meta_create_monitor_test_setup (MetaBackend *backend,
is_laptop_panel = setup->outputs[i].is_laptop_panel;
serial = setup->outputs[i].serial;
serial = g_strdup (setup->outputs[i].serial);
if (!serial)
serial = "0x123456";
serial = g_strdup_printf ("0x123456%d", i);
output_info = meta_output_info_new ();
@ -740,7 +740,7 @@ meta_create_monitor_test_setup (MetaBackend *backend,
: g_strdup_printf ("DP-%d", ++n_normal_panels));
output_info->vendor = g_strdup ("MetaProduct's Inc.");
output_info->product = g_strdup ("MetaMonitor");
output_info->serial = g_strdup (serial);
output_info->serial = serial;
if (setup->outputs[i].hotplug_mode)
{
output_info->hotplug_mode_update = TRUE;

View File

@ -13,7 +13,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -34,7 +34,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>1024</width>

View File

@ -9,7 +9,7 @@
<connector>eDP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -30,7 +30,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -54,7 +54,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -78,7 +78,7 @@
<connector>eDP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>

View File

@ -9,7 +9,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>800</width>
@ -22,7 +22,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>800</width>

View File

@ -9,7 +9,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -27,7 +27,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>800</width>

View File

@ -9,7 +9,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -30,7 +30,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>800</width>

View File

@ -9,7 +9,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -30,7 +30,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>1024</width>

View File

@ -9,7 +9,7 @@
<connector>DP-1</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456a</serial>
</monitorspec>
<mode>
<width>1024</width>
@ -26,7 +26,7 @@
<connector>DP-2</connector>
<vendor>MetaProduct&apos;s Inc.</vendor>
<product>MetaMonitor</product>
<serial>0x123456</serial>
<serial>0x123456b</serial>
</monitorspec>
<mode>
<width>800</width>

View File

@ -292,7 +292,7 @@ meta_test_monitor_store_vertical (void)
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456a",
.mode = {
.width = 1024,
.height = 768,
@ -317,7 +317,7 @@ meta_test_monitor_store_vertical (void)
.connector = "DP-2",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456b",
.mode = {
.width = 800,
.height = 600,
@ -361,7 +361,7 @@ meta_test_monitor_store_primary (void)
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456a",
.mode = {
.width = 1024,
.height = 768,
@ -386,7 +386,7 @@ meta_test_monitor_store_primary (void)
.connector = "DP-2",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456b",
.mode = {
.width = 800,
.height = 600,
@ -669,7 +669,7 @@ meta_test_monitor_store_mirrored (void)
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456a",
.mode = {
.width = 800,
.height = 600,
@ -680,7 +680,7 @@ meta_test_monitor_store_mirrored (void)
.connector = "DP-2",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456b",
.mode = {
.width = 800,
.height = 600,
@ -725,7 +725,7 @@ meta_test_monitor_store_first_rotated (void)
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456a",
.mode = {
.width = 1024,
.height = 768,
@ -751,7 +751,7 @@ meta_test_monitor_store_first_rotated (void)
.connector = "DP-2",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456b",
.mode = {
.width = 1024,
.height = 768,
@ -796,7 +796,7 @@ meta_test_monitor_store_second_rotated (void)
.connector = "DP-1",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456a",
.mode = {
.width = 1024,
.height = 768,
@ -822,7 +822,7 @@ meta_test_monitor_store_second_rotated (void)
.connector = "DP-2",
.vendor = "MetaProduct's Inc.",
.product = "MetaMonitor",
.serial = "0x123456",
.serial = "0x123456b",
.mode = {
.width = 1024,
.height = 768,

View File

@ -2333,7 +2333,8 @@ meta_test_monitor_lid_switch_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -2343,7 +2344,8 @@ meta_test_monitor_lid_switch_config (void)
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 220,
.height_mm = 124
.height_mm = 124,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -2517,7 +2519,8 @@ meta_test_monitor_lid_opened_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -2527,7 +2530,8 @@ meta_test_monitor_lid_opened_config (void)
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 220,
.height_mm = 124
.height_mm = 124,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -3025,7 +3029,8 @@ meta_test_monitor_lid_scaled_closed_opened (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -4447,7 +4452,8 @@ meta_test_monitor_orientation_initial_stored_rotated (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -4607,7 +4613,8 @@ meta_test_monitor_orientation_initial_stored_rotated_no_touch (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -5507,7 +5514,8 @@ meta_test_monitor_custom_vertical_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -5517,7 +5525,8 @@ meta_test_monitor_custom_vertical_config (void)
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 220,
.height_mm = 124
.height_mm = 124,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -5651,7 +5660,8 @@ meta_test_monitor_custom_primary_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -5661,7 +5671,8 @@ meta_test_monitor_custom_primary_config (void)
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 220,
.height_mm = 124
.height_mm = 124,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -5790,7 +5801,8 @@ meta_test_monitor_custom_underscanning_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -5886,7 +5898,8 @@ meta_test_monitor_custom_scale_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -5987,7 +6000,8 @@ meta_test_monitor_custom_fractional_scale_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -6088,7 +6102,8 @@ meta_test_monitor_custom_high_precision_fractional_scale_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -6199,7 +6214,8 @@ meta_test_monitor_custom_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456",
},
{
.crtc = -1,
@ -6218,7 +6234,8 @@ meta_test_monitor_custom_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456",
}
},
.n_outputs = 2,
@ -6345,7 +6362,8 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456",
},
{
.crtc = -1,
@ -6364,7 +6382,8 @@ meta_test_monitor_custom_tiled_custom_resolution_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456",
}
},
.n_outputs = 2,
@ -6516,7 +6535,8 @@ meta_test_monitor_custom_tiled_non_preferred_config (void)
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
},
.serial = "0x123456",
},
{
.crtc = -1,
@ -6535,7 +6555,8 @@ meta_test_monitor_custom_tiled_non_preferred_config (void)
.loc_v_tile = 0,
.tile_w = 512,
.tile_h = 768
}
},
.serial = "0x123456",
}
},
.n_outputs = 2,
@ -6671,7 +6692,8 @@ meta_test_monitor_custom_mirrored_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -6681,7 +6703,8 @@ meta_test_monitor_custom_mirrored_config (void)
.possible_crtcs = { 1 },
.n_possible_crtcs = 1,
.width_mm = 220,
.height_mm = 124
.height_mm = 124,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -6804,6 +6827,7 @@ meta_test_monitor_custom_first_rotated_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -6814,6 +6838,7 @@ meta_test_monitor_custom_first_rotated_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -6943,6 +6968,7 @@ meta_test_monitor_custom_second_rotated_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -6953,6 +6979,7 @@ meta_test_monitor_custom_second_rotated_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -7088,6 +7115,7 @@ meta_test_monitor_custom_second_rotated_tiled_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = -1,
@ -7106,7 +7134,8 @@ meta_test_monitor_custom_second_rotated_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456b",
},
{
.crtc = -1,
@ -7125,7 +7154,8 @@ meta_test_monitor_custom_second_rotated_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456b",
}
},
.n_outputs = 3,
@ -7284,6 +7314,7 @@ meta_test_monitor_custom_second_rotated_nonnative_tiled_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = -1,
@ -7302,7 +7333,8 @@ meta_test_monitor_custom_second_rotated_nonnative_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456b",
},
{
.crtc = -1,
@ -7321,7 +7353,8 @@ meta_test_monitor_custom_second_rotated_nonnative_tiled_config (void)
.loc_v_tile = 0,
.tile_w = 400,
.tile_h = 600
}
},
.serial = "0x123456b",
}
},
.n_outputs = 3,
@ -7475,6 +7508,7 @@ meta_test_monitor_custom_second_rotated_nonnative_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456a",
},
{
.crtc = 1,
@ -7485,6 +7519,7 @@ meta_test_monitor_custom_second_rotated_nonnative_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456b",
}
},
.n_outputs = 2,
@ -7634,7 +7669,8 @@ meta_test_monitor_custom_interlaced_config (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,
@ -7742,7 +7778,8 @@ meta_test_monitor_custom_oneoff (void)
.possible_crtcs = { 0, 1 },
.n_possible_crtcs = 2,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
{
.crtc = -1,
@ -7876,7 +7913,8 @@ meta_test_monitor_custom_lid_switch_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.is_laptop_panel = TRUE
.is_laptop_panel = TRUE,
.serial = "0x123456a",
},
{
.crtc = -1,
@ -7887,6 +7925,7 @@ meta_test_monitor_custom_lid_switch_config (void)
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125,
.serial = "0x123456b",
}
},
.n_outputs = 1, /* Second one hot plugged later */
@ -8089,7 +8128,8 @@ meta_test_monitor_migrated_rotated (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
}
},
.n_outputs = 1,
@ -8235,7 +8275,8 @@ meta_test_monitor_migrated_wiggle_discard (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
}
},
.n_outputs = 1,
@ -8513,7 +8554,8 @@ meta_test_monitor_migrated_wiggle (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
}
},
.n_outputs = 1,
@ -9268,7 +9310,8 @@ meta_test_monitor_policy_system_only (void)
.possible_crtcs = { 0 },
.n_possible_crtcs = 1,
.width_mm = 222,
.height_mm = 125
.height_mm = 125,
.serial = "0x123456",
},
},
.n_outputs = 1,