From f939a7ca2988c883172a16627b18bb5e764f514b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20=C3=85dahl?= Date: Thu, 28 Oct 2021 15:17:35 +0200 Subject: [PATCH] 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: --- src/tests/meta-monitor-test-utils.c | 8 +- src/tests/monitor-configs/first-rotated.xml | 4 +- src/tests/monitor-configs/lid-switch.xml | 8 +- src/tests/monitor-configs/mirrored.xml | 4 +- src/tests/monitor-configs/primary.xml | 4 +- .../monitor-configs/second-rotated-tiled.xml | 4 +- src/tests/monitor-configs/second-rotated.xml | 4 +- src/tests/monitor-configs/vertical.xml | 4 +- src/tests/monitor-store-unit-tests.c | 20 ++-- src/tests/monitor-unit-tests.c | 111 ++++++++++++------ 10 files changed, 107 insertions(+), 64 deletions(-) diff --git a/src/tests/meta-monitor-test-utils.c b/src/tests/meta-monitor-test-utils.c index 2cb41cd13..1344f1ca4 100644 --- a/src/tests/meta-monitor-test-utils.c +++ b/src/tests/meta-monitor-test-utils.c @@ -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; diff --git a/src/tests/monitor-configs/first-rotated.xml b/src/tests/monitor-configs/first-rotated.xml index 59a42bef5..fb64e1d2d 100644 --- a/src/tests/monitor-configs/first-rotated.xml +++ b/src/tests/monitor-configs/first-rotated.xml @@ -13,7 +13,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -34,7 +34,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 1024 diff --git a/src/tests/monitor-configs/lid-switch.xml b/src/tests/monitor-configs/lid-switch.xml index 1d43c98bd..9e56ab6d8 100644 --- a/src/tests/monitor-configs/lid-switch.xml +++ b/src/tests/monitor-configs/lid-switch.xml @@ -9,7 +9,7 @@ eDP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -30,7 +30,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 1024 @@ -54,7 +54,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 1024 @@ -78,7 +78,7 @@ eDP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 diff --git a/src/tests/monitor-configs/mirrored.xml b/src/tests/monitor-configs/mirrored.xml index 7866b4aae..418a59c81 100644 --- a/src/tests/monitor-configs/mirrored.xml +++ b/src/tests/monitor-configs/mirrored.xml @@ -9,7 +9,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 800 @@ -22,7 +22,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 800 diff --git a/src/tests/monitor-configs/primary.xml b/src/tests/monitor-configs/primary.xml index ce78b1099..f51d11cae 100644 --- a/src/tests/monitor-configs/primary.xml +++ b/src/tests/monitor-configs/primary.xml @@ -9,7 +9,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -27,7 +27,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 800 diff --git a/src/tests/monitor-configs/second-rotated-tiled.xml b/src/tests/monitor-configs/second-rotated-tiled.xml index 14ba91b4e..8e6afff6b 100644 --- a/src/tests/monitor-configs/second-rotated-tiled.xml +++ b/src/tests/monitor-configs/second-rotated-tiled.xml @@ -9,7 +9,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -30,7 +30,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 800 diff --git a/src/tests/monitor-configs/second-rotated.xml b/src/tests/monitor-configs/second-rotated.xml index 885b2bf83..40eea1472 100644 --- a/src/tests/monitor-configs/second-rotated.xml +++ b/src/tests/monitor-configs/second-rotated.xml @@ -9,7 +9,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -30,7 +30,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 1024 diff --git a/src/tests/monitor-configs/vertical.xml b/src/tests/monitor-configs/vertical.xml index 0546b055c..588d20879 100644 --- a/src/tests/monitor-configs/vertical.xml +++ b/src/tests/monitor-configs/vertical.xml @@ -9,7 +9,7 @@ DP-1 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456a 1024 @@ -26,7 +26,7 @@ DP-2 MetaProduct's Inc. MetaMonitor - 0x123456 + 0x123456b 800 diff --git a/src/tests/monitor-store-unit-tests.c b/src/tests/monitor-store-unit-tests.c index f8fd2b262..18622f20c 100644 --- a/src/tests/monitor-store-unit-tests.c +++ b/src/tests/monitor-store-unit-tests.c @@ -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, diff --git a/src/tests/monitor-unit-tests.c b/src/tests/monitor-unit-tests.c index 8e34c8b22..b9454f28b 100644 --- a/src/tests/monitor-unit-tests.c +++ b/src/tests/monitor-unit-tests.c @@ -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,