Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
829364cf45 | ||
|
|
3ebc864346 | ||
|
|
e5798ba80c | ||
|
|
f0a2a8d304 | ||
|
|
7cc5a4494a | ||
|
|
6b5f5c78a0 | ||
|
|
9437e06399 | ||
|
|
2d0620e33e | ||
|
|
6aebe0eb15 | ||
|
|
039c2e8bdc | ||
|
|
c4d5ffe903 | ||
|
|
73add864d3 | ||
|
|
49838e1df3 | ||
|
|
66530eadba | ||
|
|
49f9ac900c |
No files matched your search
@@ -0,0 +1,18 @@
|
||||
[
|
||||
{
|
||||
"id": "D31",
|
||||
"bug": "",
|
||||
"firefox": {
|
||||
"from": "159.0",
|
||||
"to": "159.*"
|
||||
},
|
||||
"signature": {
|
||||
"process": "backgroundtask",
|
||||
"phase": "exit",
|
||||
"thread": "FSBroker",
|
||||
"reason": "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"
|
||||
},
|
||||
"seen": "oss-invisible/firefox_antidetect_patch/actions/runs/46539190316/job/142310624770",
|
||||
"why": "at the exit of a -backgroundtask process the FSBroker thread unregisters from the profiler after the static destructors ran and locks a destroyed mutex"
|
||||
}
|
||||
]
|
||||
@@ -16,18 +16,18 @@
|
||||
{"id": "wrapper.e2e.stock_twin.select", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_a_select_dropdown_opens_at_its_element_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of the select dropdown (4 scales), measured from chrome scope against RETAIL Firefox 159 driven by Marionette alone, headed (the leg sets INVPW_RETAIL_FIREFOX to its firefox.exe), the reference first and ours second; the verdict is 'the same as the reference' (tests/_stock_twin.py, tests/_retail_reference.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
|
||||
{"id": "wrapper.e2e.stock_twin.tooltip", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_a_tooltip_opens_at_the_pointer_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of the tooltip (4 scales), measured from chrome scope against RETAIL Firefox 159 driven by Marionette alone, headed (the leg sets INVPW_RETAIL_FIREFOX to its firefox.exe), the reference first and ours second; the verdict is 'the same as the reference' (tests/_stock_twin.py, tests/_retail_reference.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
|
||||
{"id": "wrapper.e2e.stock_twin.intersection", "giro": "G2", "os": ["linux", "windows"], "min_tests": 8, "exact": true, "tests": ["tests/test_intersection_and_lazy_loading_in_a_frame_of_another_site_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Split from the row wrapper.e2e.stock_twin, which ran past the 25-minute limit of a leg: one file, one leg. The twin of what the IntersectionObserver of a scrolled frame of another site reads (8 steps, 4 scales) and of when a lazy frame is requested (4 distances, 4 scales): the same steps first on Playwright's own Firefox (stock_firefox), headed, driven by the stock Playwright client, and second on ours; the verdict is 'the same as the reference' (tests/_stock_twin.py). Each record keeps the page's and the chrome's devicePixelRatio and the real scale of the screen. The file is in no whole-suite row: the references are installed only for this row's legs.", "stock_firefox": true},
|
||||
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 2, "exact": true, "tests": ["tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the parent of the engine shows <GRE>/fonts to it (FcConfigAppFontAddDir) to rebuild a font from a path and a face index. On Windows DirectWrite opens the file from its path, with no folder to scan and no cache to read, so this test has no Windows counterpart.", "note": "2 = (1) the stand-in that runs the engine under strace stays in the engine's place, as the core launches it (the leader of a process group of its own): a fake engine with a child, no browser; the process the launcher holds lives as long as the fake engine, and the group killed holds strace and the child (the stand-in that exec'd setsid forked and exited 0 at once: candidate 44161687675); (2) the warm launch of the parent reads the bundle from fontconfig's cache and does not scan it again (from firefox-66, engine_at_least). Two launches under strace with the same XDG_CACHE_HOME of the test, the first cold and the second warm: the cold parent opens every font file of <GRE>/fonts (the folder as the disk lists it) before any page and fontconfig writes its cache; the warm parent does not open every one of them, and it opens a *.cache-* file of fontconfig (a few files are opened to be used, so the verdict asks about the whole folder, as a scan does). Scan and drawing are told apart by position: only what the parent opens before the first page counts (the opens that draw are written as after_startup). Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-cache: the interval and the number of opens of the bundle, the names of the files of the bundle each launch opened before the first page, the size of the cache file, the VmRSS of the parent after about:blank and after a page with every family, and a third launch with gfx.bundled-fonts.activate=0 (the behaviour before), which is evidence only. Needs strace on the runner: without it both are red, not skipped. No threshold."},
|
||||
{"id": "wrapper.e2e.fontconfig", "giro": "G2", "os": ["linux"], "min_tests": 9, "exact": true, "tests": ["tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py", "tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py"], "marker": "e2e", "needs_root": false, "linux_only": "Fontconfig exists only on Linux: the engine runs it on its own empty configuration, and the rules of a user and the files of the host are what these tests try to make reach it. On Windows DirectWrite draws the text from the path of the font, with no rule of a user and no configuration or cache of fonts to read, so these tests have no Windows counterpart.", "note": "7 = (1-3) the fontconfig rules of a user do not reach the pixels of the text a page reads: seven launches of one seed, each with its own user fonts.conf ($XDG_CONFIG_HOME/fontconfig/fonts.conf, as a real user's rules enter; not FONTCONFIG_FILE, which the core strips): nothing; rgba=none with lcdfilter=lcdnone; rgba=bgr; embeddedbitmap=false; autohint=true; hintstyle=hintfull with antialias=false; a strong prepend rule on system-ui. fc-match, in the same environment, must show each rule in force (a launch that measures nothing is red). Three tests: every rule in force and its XDG_CONFIG_HOME in the engine's environment; the hashes of the pixels of getImageData (an opaque canvas and the default one, Arial, SimSun, MS Gothic at 9-16 px) equal to those of the launch with nothing; the computed family and the widths of system-ui equal. (4-7) no fontconfig file of the host is opened and the screenshot draws the bundle: the stand-in that runs the engine under strace stays in the engine's place (a fake engine with a child, no browser); the caches $HOME/.fontconfig and $XDG_CACHE_HOME/fontconfig hold a valid cache of the bundle that lacks msgothic5_32.ttc (fc-list proves it); under strace no process opens a path under /etc/fonts, a fonts.conf or a *.cache-* file; the screenshot of Japanese text in MS PGothic equals the content's own drawing. Needs strace, fc-cache, fc-list and fc-match on the runner: without them the tests are red, not skipped. Evidence in RUNNER_TEMP/invpw-evidence/fontconfig-rules and fontconfig-host-files. Also in the row until the 72 is released: the old file of the warm-cache test (2 tests, same ids), rewritten to assert the 72's behaviour: the stand-in, and two launches with the same XDG_CACHE_HOME and HOME under strace write no fontconfig cache file (*.cache-*, .NEW, .TMP-*) and no process opens one. E1 and E2 replace it; its retirement entry goes to main after the release of the 72."},
|
||||
{"id": "wrapper.unit.compositing", "giro": "G1", "os": ["linux", "windows"], "min_tests": 30, "exact": true, "tests": ["tests/test_the_page_bytes_reference_compares_decoded_pixels.py"], "marker": "unit", "needs_root": false, "note": "The helpers of wrapper.e2e.compositing on known inputs, no browser: the PNG compared on decoded pixels (another deBG chunk and compression are the same, one pixel is not, every scanline filter), the comparison with a reference (changed, missing and extra keys named, the entry to record), the type of an engine process, an engine process known by its executable and not by the name it gives itself (Linux), and the CPU of a window, and the shape of the committed Windows reference, and the box cut out of a screenshot (its pixels, a box outside the picture refused, written as a PNG and read back, two boxes told apart by a pixel that is named, the pixels that are not grey)."},
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4375, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_marionette_session_is_asked_after_the_first_window.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_a_twin_asks_for_is_routed.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_refusal_is_declared.py", "tests/tLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4387, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_marionette_session_is_asked_after_the_first_window.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.py", "tests/test_every_page_a_twin_asks_for_is_routed.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_pytest_process_clears_the_gp_Line truncated
|
||||
{"id": "wrapper.unit.all.linux", "giro": "G1", "os": ["linux"], "min_tests": 4486, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_marionette_session_is_asked_after_the_first_window.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_popup_under_the_declared_viewport_is_not_pinned.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_an_expired_popupshown_wait_fails_the_e2e_test_that_launched_the_browser.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_event.pLine truncated
|
||||
{"id": "wrapper.unit.all.windows", "giro": "G1", "os": ["windows"], "min_tests": 4498, "exact": true, "tests": ["tests/test_a_162_message_is_read_like_a_161_one.py", "tests/test_a_click_makes_one_mousemove_at_its_point.py", "tests/test_a_closed_context_leaves_nothing_in_the_registry.py", "tests/test_a_closed_page_says_nothing.py", "tests/test_a_closed_pipe_is_a_closed_target.py", "tests/test_a_commit_at_any_point_of_the_hand_over_reaches_the_client_once.py", "tests/test_a_context_proxy_carries_its_measured_udp_exit.py", "tests/test_a_context_route_disables_the_cache.py", "tests/test_a_detached_frame_answers_detached.py", "tests/test_a_dialog_is_a_protocol_object.py", "tests/test_a_dialog_is_answered_after_a_pause.py", "tests/test_a_download_finished_before_it_was_announced_is_finished.py", "tests/test_a_failed_expect_carries_its_call_log.py", "tests/test_a_failed_generation_of_the_security_state_keeps_its_evidence.py", "tests/test_a_failed_launch_stops_the_display.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_file_chooser_is_never_dropped_in_silence.py", "tests/test_a_frame_tap_needs_a_context_with_touch.py", "tests/test_a_gil_free_thread_dump_kills_a_busy_process_and_the_stack_watchdog_does_not.py", "tests/test_a_handle_action_walks_like_a_selector_action.py", "tests/test_a_launch_asks_nobody_on_the_internet_where_it_leaves_from.py", "tests/test_a_launch_gives_the_core_its_engine_for_the_security_state.py", "tests/test_a_launch_has_one_deadline.py", "tests/test_a_launch_without_a_session_gets_one.py", "tests/test_a_live_event_does_not_overtake_the_replay_of_a_new_page.py", "tests/test_a_marionette_session_is_asked_after_the_first_window.py", "tests/test_a_module_that_leaves_a_browser_open_fails.py", "tests/test_a_new_page_waits_for_the_engine.py", "tests/test_a_non_finite_number_crosses_the_wire_as_a_tag.py", "tests/test_a_page_closed_before_its_announcement_is_not_announced.py", "tests/test_a_page_is_handed_over_only_when_the_engine_says_it_is_ready.py", "tests/test_a_path_leaves_as_one_stroke.py", "tests/test_a_popup_under_the_declared_viewport_is_not_pinned.py", "tests/test_a_port_number_is_held_until_it_is_used.py", "tests/test_a_read_whose_probe_ran_out_is_the_callers_timeout.py", "tests/test_a_request_and_a_response_are_light.py", "tests/test_a_request_says_what_it_is.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page.py", "tests/test_a_screenshot_sends_its_scale_to_the_engine.py", "tests/test_a_session_ends_before_the_next_test_starts.py", "tests/test_a_streamed_upload_is_staged_in_the_session.py", "tests/test_a_stroke_is_judged_by_its_shape_not_its_length.py", "tests/test_a_test_that_is_not_e2e_never_leaves_the_machine.py", "tests/test_a_unit_test_does_not_read_the_seal_of_the_job.py", "tests/test_ab_host.py", "tests/test_ab_host_aa_stable.py", "tests/test_ab_network.py", "tests/test_ab_network_turn_credential.py", "tests/test_ab_network_turn_deallocation.py", "tests/test_ab_network_webrtc_evidence.py", "tests/test_ab_oracle.py", "tests/test_ab_oracle_declared_differences.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client.py", "tests/test_an_expect_reads_its_value_once.py", "tests/test_an_expired_popupshown_wait_fails_the_e2e_test_that_launched_the_browser.py", "tests/test_async_api.py", "tests/test_browser_output_is_drained.py", "tests/test_ci_downloads_are_authenticated.py", "tests/test_ci_drive_gate_goes_through_the_core.py", "tests/test_ci_host_gate.py", "tests/test_ci_host_gate_ab.py", "tests/test_ci_lab_geoip.py", "tests/test_ci_lab_geoip_verify.py", "tests/test_ci_lab_intermediates.py", "tests/test_ci_lab_security_state.py", "tests/test_ci_linux_legs_read_no_mirror.py", "tests/test_ci_poison_host.py", "tests/test_ci_published_set.py", "tests/test_ci_real_geoip_check.py", "tests/test_ci_real_geoip_exit_code.py", "tests/test_ci_runs_once_per_commit.py", "tests/test_ci_suite_run.py", "tests/test_ci_verdict.py", "tests/test_ci_windows_temp_is_on_d.py", "tests/test_ci_workflows_build_the_geoip_database.py", "tests/test_ci_workflows_set_the_intermediates_list.py", "tests/test_ci_workflows_set_the_security_state.py", "tests/test_cli.py", "tests/test_click_rhythm.py", "tests/test_connect_does_not_start_threads_on_the_loop.py", "tests/test_context_locale_is_a_list.py", "tests/test_core_pin.py", "tests/test_cpu_by_type_window.py", "tests/test_cross_origin_iframe.py", "tests/test_cursor_dispatch.py", "tests/test_cursor_wiring.py", "tests/test_docs_name_the_mcp_repo_as_it_is.py", "tests/test_doh_session_prefs_unit.py", "tests/test_drag_motion.py", "tests/test_e2e_hermetic.py", "tests/test_element_handle_actions.py", "tests/test_every_action_is_pinned_by_commit_sha.py", "tests/test_every_argument_reaches_the_page_as_playwright_sends_it.py", "tests/test_every_held_request_of_the_journey_starts_after_the_load.py", "tests/test_every_order_of_the_events_of_a_popup_gives_one_page_eveLine truncated
|
||||
{"id": "wrapper.e2e.securitystate", "giro": "G2", "os": ["linux", "windows"], "min_tests": 4, "exact": true, "tests": ["tests/test_security_state_engine_e2e.py"], "marker": "e2e", "needs_root": false, "note": "The security state the core declares, against the engine: the engine launched directly in its generate mode makes what it is given (the contract's result, security_state/ with the bytes of the full filter and of the delta, the core's own validation of it); a normal launch declares no pref of the mode and re-imports nothing; a certificate that Mozilla's CRLite test data say is revoked in a delta is refused at the first navigation (SEC_ERROR_REVOKED_CERTIFICATE) while a valid one loads, and the revoked one loads when the ready directory has no data; a ready directory with no or an empty security_state/ starts. Certificates made on the run (a fresh root trusted in cert9.db by the engine's own xpcshell, Mozilla's default test key as the key of CN=int), servers on loopback, no network. Red on firefox-67 (no generate mode).", "core_dumps": "invpw-cores"},
|
||||
{"id": "wrapper.e2e.suite.linux.1", "giro": "G2", "os": ["linux"], "min_tests": 447, "exact": true, "tests": ["tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_declared_host_network_e2e.py", "tests/test_detectors_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_element_screenshot_e2e.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_display_linux.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_ignore_https_errors_e2e.py", "tests/test_injected_node_surface.py", "tests/test_juggler_connection.py", "tests/test_juggler_posix_pipe.py", "tests/test_juggler_transport.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_navigation_response.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_oop_frame_element.py", "tests/test_oop_frame_geometry.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_screencast.py", "tests/test_screencast_stop_e2e.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_offline_e2e.py", "tests/test_shadow_trusted_input.py", "tests/test_strict_and_force.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_a_launch_scans_no_process_of_the_machine", "tests/test_the_engine_is_born_in_the_job_e2e.py::test_after_close_no_process_of_the_session_is_left", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_ua_widget_not_selectable.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_throuLine truncated
|
||||
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 420, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 564 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row,Line truncated
|
||||
{"id": "wrapper.e2e.suite.linux.3", "giro": "G2", "os": ["linux"], "min_tests": 333, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_file_chooser_reaches_every_client_e2e.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_an_element_handle_serves_every_method_of_the_client_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_canvas_create_pattern_projection_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_every_argument_reaches_the_page_e2e.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_focus_survives_os_deactivation_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_geolocation_reads_nothing_of_the_host_windows_e2e.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_moz_element_paints_a_webgl_canvas_as_drawn_e2e.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_nested_frame_actions.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_host_gl_probe_runs_only_on_an_undeclared_engine_linux_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_e2e.py", "tests/test_the_shutdown_ping_leaves_by_the_background_task_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_canvas_readback_is_noised_e2e.py", "tests/test_webgpu_external_texture_e2e.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.3", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 565 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on linux (a skip is red in the verdict).", "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.linux.2", "giro": "G2", "os": ["linux"], "min_tests": 457, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_press_on_an_open_select_follows_windows_rollup_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_add_script_tag.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_drag_motion.py", "tests/test_expose_binding_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_keyboard_rhythm.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_new_page_defaults.py", "tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py", "tests/test_no_popup_is_left_when_a_page_closes_e2e.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_e2e.py", "tests/test_route_post_data_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screenshot_of_text_returns_linux_e2e.py", "tests/test_scroll_into_view.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_service_workers_blocked.py", "tests/test_set_input_files_payloads.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py", "tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a filLine truncated
|
||||
{"id": "wrapper.e2e.suite.linux.3", "giro": "G2", "os": ["linux"], "min_tests": 367, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_file_chooser_reaches_every_client_e2e.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_popup_reads_the_retail_sizes_of_a_maximized_main_window_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_an_element_handle_serves_every_method_of_the_client_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_canvas_create_pattern_projection_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_every_argument_reaches_the_page_e2e.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_focus_survives_os_deactivation_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_geolocation_reads_nothing_of_the_host_windows_e2e.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_moz_element_paints_a_webgl_canvas_as_drawn_e2e.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_nested_frame_actions.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_host_gl_probe_runs_only_on_an_undeclared_engine_linux_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_e2e.py", "tests/test_the_shutdown_ping_leaves_by_the_background_task_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_canvas_readback_is_noised_e2e.py", "tests/test_webgpu_external_texture_e2e.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "windows_twin": "wrapper.e2e.suite.windows.3", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 2 rows of linux are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 565 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on linux (a skip is red in the verdict).", "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.1", "giro": "G2", "os": ["windows"], "min_tests": 332, "exact": true, "tests": ["tests/test_a_click_waits_for_the_navigation_it_plans_e2e.py", "tests/test_a_closed_browser_leaves_the_others_alone_e2e.py", "tests/test_a_context_init_script_runs_once_e2e.py", "tests/test_a_goto_to_a_refused_port_ends_with_its_reason_e2e.py", "tests/test_a_granted_permission_is_the_one_the_page_asks_for_e2e.py", "tests/test_a_held_ice_port_blinds_the_loopback_checks_e2e.py", "tests/test_a_left_documents_body_is_evicted_e2e.py", "tests/test_a_page_cannot_probe_the_juggler_e2e.py", "tests/test_a_screenshot_honours_its_scale_e2e.py", "tests/test_a_screenshot_refuses_what_would_touch_the_page_e2e.py", "tests/test_a_tiny_download_on_a_served_browser_is_saved_e2e.py", "tests/test_a_worker_comes_back_with_its_page_from_the_cache_e2e.py", "tests/test_browser_output_is_drained.py", "tests/test_canvas_create_pattern_projection_e2e.py", "tests/test_click_rhythm.py", "tests/test_closing_one_of_four_browsers_does_not_hold_the_loop_e2e.py", "tests/test_context_locale_e2e.py", "tests/test_context_proxy_only_resolves_by_doh_e2e.py", "tests/test_detectors_e2e.py", "tests/test_download_is_intercepted_e2e.py", "tests/test_e2e.py", "tests/test_element_handle_actions.py", "tests/test_every_page_draws_its_own_acts.py", "tests/test_every_reader_of_a_webgl_canvas_agrees_e2e.py", "tests/test_fission_identity_parity_e2e.py", "tests/test_fission_iframe_crash_e2e.py", "tests/test_focus_survives_os_deactivation_e2e.py", "tests/test_geolocation_reads_nothing_of_the_host_windows_e2e.py", "tests/test_goto_to_the_same_url_e2e.py", "tests/test_ignore_https_errors_e2e.py", "tests/test_juggler_actions.py", "tests/test_juggler_transport.py", "tests/test_keyboard_rhythm.py", "tests/test_moz_element_paints_a_webgl_canvas_as_drawn_e2e.py", "tests/test_nested_frame_actions.py", "tests/test_popups_reach_the_client_e2e.py", "tests/test_preload_newtab_turns_the_privileged_about_process_off_e2e.py", "tests/test_route_superseded_e2e.py", "tests/test_scroll_only_if_needed_e2e.py", "tests/test_security_state_engine_e2e.py", "tests/test_service_worker.py", "tests/test_service_workers_blocked.py", "tests/test_strict_and_force.py", "tests/test_the_engine_is_born_in_the_job_e2e.py", "tests/test_the_hosts_file_of_the_host_is_never_read_e2e.py", "tests/test_the_shutdown_ping_leaves_by_the_background_task_e2e.py", "tests/test_trial_does_not_act.py", "tests/test_ua_widget_not_selectable.py", "tests/test_webgpu_canvas_readback_is_noised_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 1 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.2", "giro": "G2", "os": ["windows"], "min_tests": 291, "exact": true, "tests": ["tests/test_a_file_chooser_reaches_every_client_e2e.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client_e2e.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_declared_host_network_e2e.py", "tests/test_every_argument_reaches_the_page_e2e.py", "tests/test_expose_binding_e2e.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_desktop.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_oop_frame_geometry.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_e2e.py", "tests/test_screencast_stop_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_two_contexts_with_two_proxies_each_gets_the_srflx_of_its_own"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 277, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_drag_motion.py", "tests/test_element_screenshot_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_first_launch_from_a_new_path.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_post_data_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screencast.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_input_files_payloads.py", "tests/test_set_offline_e2e.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_external_texture_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 3 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 293, "exact": true, "tests": ["tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_injected_node_surface.py", "tests/test_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.py", "tests/test_juggler_connection.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_oop_frame_element.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_scroll_into_view.py", "tests/test_shadow_trusted_input.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_e2e.py", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 4 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.2", "giro": "G2", "os": ["windows"], "min_tests": 321, "exact": true, "tests": ["tests/test_a_file_chooser_reaches_every_client_e2e.py", "tests/test_a_goto_to_a_response_with_no_document_ends_e2e.py", "tests/test_a_latin_letter_on_a_cyrillic_persona_e2e.py", "tests/test_a_navigation_that_moved_is_told_by_the_engine_e2e.py", "tests/test_a_press_on_an_open_select_follows_windows_rollup_e2e.py", "tests/test_a_regional_indicator_pair_measures_the_same_first_and_after_other_families_e2e.py", "tests/test_a_select_dropdown_stays_open_after_the_release_e2e.py", "tests/test_a_turn_name_over_tcp_goes_through_the_proxy_of_the_context_e2e.py", "tests/test_add_script_tag.py", "tests/test_an_element_handle_serves_every_method_of_the_client_e2e.py", "tests/test_an_isolated_page_and_the_next_e2e.py", "tests/test_audio_context_values_are_declared_e2e.py", "tests/test_bundle_font_names_e2e.py", "tests/test_caller_world_handles_e2e.py", "tests/test_canvas_reads_as_drawn.py", "tests/test_canvas_render_stealth.py", "tests/test_css_media_reads_the_declared_screen_and_pointer_e2e.py", "tests/test_declared_host_network_e2e.py", "tests/test_every_argument_reaches_the_page_e2e.py", "tests/test_expose_binding_e2e.py", "tests/test_fission_frames_dialogs_downloads_popups_e2e.py", "tests/test_fullscreen_without_wm_e2e.py", "tests/test_goto_networkidle_after_spa_e2e.py", "tests/test_goto_script_redirect_e2e.py", "tests/test_hidden_desktop.py", "tests/test_ice_names_by_the_context_proxy_e2e.py::test_the_ice_name_of_a_context_goes_by_the_proxy_of_that_context", "tests/test_juggler_lifecycle_e2e.py", "tests/test_key_delay_reaches_the_keyboard.py", "tests/test_long_session_e2e.py", "tests/test_mouse.py", "tests/test_native_line_endings_are_windows_e2e.py", "tests/test_navigation_across_processes_e2e.py", "tests/test_networkidle_reaches_the_client_e2e.py", "tests/test_no_popup_is_left_when_a_page_closes_e2e.py", "tests/test_nothing_leaves_but_the_proxy_e2e.py", "tests/test_nothing_of_a_context_leaves_but_through_its_proxy_e2e.py", "tests/test_oop_frame_geometry.py", "tests/test_proxy_socks_auth_e2e.py", "tests/test_resolver_race_e2e.py", "tests/test_route_e2e.py", "tests/test_screencast_stop_e2e.py", "tests/test_the_branding_a_page_loads_is_the_declared_archive_e2e.py", "tests/test_the_device_enumeration_takes_the_declared_time_e2e.py", "tests/test_the_evaluated_code_has_no_debugger_name_e2e.py", "tests/test_the_favicon_stays_out_of_sight_e2e.py", "tests/test_the_font_list_is_the_bundle_e2e.py", "tests/test_the_scheme_is_the_personas_e2e.py", "tests/test_the_whole_udp_chain_by_name_e2e.py::test_a_turn_srflx_by_name_arrives_through_the_relay_when_the_exit_of_the_lab_is_loopback", "tests/test_turn_over_tcp_is_tried_for_real_e2e.py", "tests/test_voices_e2e.py", "tests/test_wait_for_function.py", "tests/test_wait_for_timeout.py", "tests/test_web_fonts_of_closed_contexts_e2e.py", "tests/test_webrtc_realness.py::test_a_gateway_that_is_far_away_still_gives_the_page_a_srflx_born_through_its_relay", "tests/test_webrtc_realness.py::test_a_gather_after_the_page_loaded_through_the_gateway_costs_only_the_road_to_the_server", "tests/test_webrtc_realness.py::test_a_host_with_ipv6_addresses_gathers_through_an_ipv4_relay", "tests/test_webrtc_realness.py::test_a_proxy_that_does_not_relay_udp_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_relay_never_answers_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_a_proxy_whose_udp_leaves_from_another_address_gives_no_srflx_at_all", "tests/test_webrtc_realness.py::test_not_blocked_behind_tcp_only_socks", "tests/test_webrtc_realness.py::test_the_first_candidate_of_a_gather_does_not_wait_for_a_gateway_that_is_far_away", "tests/test_webrtc_realness.py::test_the_turn_over_tcp_of_a_context_goes_through_the_proxy_of_that_context", "tests/test_webrtc_realness.py::test_two_contexts_with_two_proxies_each_gets_the_srflx_of_its_own"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 2 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the teLine truncated
|
||||
{"id": "wrapper.e2e.suite.windows.3", "giro": "G2", "os": ["windows"], "min_tests": 278, "exact": true, "tests": ["tests/test_a_click_in_an_iframe_lands_at_the_frames_own_screen_origin_e2e.py", "tests/test_a_context_that_ends_leaves_no_process_e2e.py", "tests/test_a_cors_preflight_is_not_a_request_of_the_page_e2e.py", "tests/test_a_launch_without_a_session_gets_one_e2e.py", "tests/test_a_mouse_click_makes_one_mousemove_on_its_point_e2e.py", "tests/test_a_page_over_ipv6_gathers_on_a_machine_declared_without_it_e2e.py", "tests/test_a_served_browser_answers_a_plain_client_e2e.py", "tests/test_actions_without_a_point.py", "tests/test_audio_noise_e2e.py", "tests/test_audio_sample_rate_is_declared_e2e.py", "tests/test_bypass_csp_e2e.py", "tests/test_control_a_selects_all_in_a_field_e2e.py", "tests/test_cross_origin_iframe.py", "tests/test_dom_iterables_from_evaluate_e2e.py", "tests/test_drag_motion.py", "tests/test_element_screenshot_e2e.py", "tests/test_fakeweb_p4_e2e.py", "tests/test_fingerprint_consistency.py", "tests/test_first_launch_from_a_new_path.py", "tests/test_fission_frames_history_and_processes_e2e.py", "tests/test_fission_frames_workers_storage_and_special_frames_e2e.py", "tests/test_fission_strategy1_bench.py", "tests/test_goto_and_every_way_it_is_stopped_e2e.py", "tests/test_http3_through_the_proxy_e2e.py", "tests/test_input_is_born_before_the_page_sees_it_e2e.py", "tests/test_ipv6_literal_connect_e2e.py", "tests/test_networkidle_through_a_served_browser_with_routes_e2e.py", "tests/test_page_number_follows_the_call.py", "tests/test_persistent_profile_keeps_state.py", "tests/test_pointer_position.py", "tests/test_popup_destinations_e2e.py", "tests/test_popup_pages.py", "tests/test_proxy_http_auth_e2e.py", "tests/test_requestless_navigation.py", "tests/test_route_abort_code.py", "tests/test_route_post_data_e2e.py", "tests/test_same_document_navigation.py", "tests/test_screencast.py", "tests/test_screenshot_looks_where_you_are.py", "tests/test_service_worker_controller_e2e.py", "tests/test_set_input_files_payloads.py", "tests/test_set_offline_e2e.py", "tests/test_the_callers_code_is_not_counted_e2e.py", "tests/test_the_callers_code_runs_once_e2e.py", "tests/test_the_close_returns_when_the_browser_has_exited_e2e.py", "tests/test_the_launch_counter_is_one_plain_get_before_any_page_e2e.py", "tests/test_webgl_declared_parameters_e2e.py", "tests/test_webgl_shader_language_e2e.py", "tests/test_webgpu_adapter_is_declared_e2e.py", "tests/test_webgpu_external_texture_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "Part 3 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 610 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.4", "giro": "G2", "os": ["windows"], "min_tests": 326, "exact": true, "tests": ["tests/test_a_context_language_is_the_accept_language_of_every_request_e2e.py", "tests/test_a_declared_webgl_extension_survives_its_use_e2e.py", "tests/test_a_drag_keeps_its_buttons_pressed_e2e.py", "tests/test_a_field_is_typed_after_a_pause.py", "tests/test_a_frame_reads_only_declared_origins_while_it_loads_e2e.py", "tests/test_a_handle_action_walks_like_a_selector_action_e2e.py", "tests/test_a_keepalive_request_reaches_the_client_e2e.py", "tests/test_a_launch_and_a_context_timezone_reach_the_page_e2e.py", "tests/test_a_page_that_moves_on_e2e.py", "tests/test_a_pointer_event_is_handled_before_the_call_returns_e2e.py", "tests/test_a_popup_is_reported_when_the_engine_says_it_is_ready_as_playwright_does_e2e.py", "tests/test_a_popup_moves_and_resizes_as_declared_e2e.py", "tests/test_a_popup_of_a_link_reaches_the_client_e2e.py", "tests/test_a_popup_reads_the_retail_sizes_of_a_maximized_main_window_e2e.py", "tests/test_a_request_says_what_it_is_e2e.py", "tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py", "tests/test_accept_language_on_the_wire_e2e.py", "tests/test_canvas_measure_text_metrics_e2e.py", "tests/test_doh_through_the_proxy_e2e.py", "tests/test_doh_under_stress_e2e.py", "tests/test_exslt_date_time_through_an_imported_stylesheet_is_in_the_declared_zone_e2e.py", "tests/test_fakeweb_p2_e2e.py", "tests/test_file_chooser.py", "tests/test_fingerprint_surface.py", "tests/test_fission_frames_route_and_bindings_e2e.py", "tests/test_fission_frames_tree_input_and_pixels_e2e.py", "tests/test_frames_outlive_the_back_forward_cache_e2e.py", "tests/test_hardware_values_are_declared_e2e.py", "tests/test_injected_node_surface.py", "tests/test_input_reaches_the_top_and_a_frame_of_another_site_at_every_scale_e2e.py", "tests/test_juggler_connection.py", "tests/test_juggler_event_listeners.py", "tests/test_juggler_injected.py::test_a_javascript_that_THROWS_arrives_as_an_error_not_as_None", "tests/test_juggler_injected.py::test_actionability_DISTINGUISHES_instead_of_always_saying_yes", "tests/test_juggler_injected.py::test_reads_that_make_no_sense_are_REJECTED", "tests/test_juggler_injected.py::test_states_DISCRIMINATE_instead_of_always_saying_true", "tests/test_juggler_injected.py::test_the_DOM_READING_group", "tests/test_juggler_injected.py::test_the_selector_engines_respond", "tests/test_juggler_injected.py::test_the_text_reads", "tests/test_mouse_events_keep_their_values_e2e.py", "tests/test_navigation_response.py", "tests/test_new_page_defaults.py", "tests/test_oop_frame_element.py", "tests/test_page_element_atoms_run_in_a_sandbox_e2e.py", "tests/test_popup_geometry_is_the_declared_frame_e2e.py", "tests/test_proxy_reaches_the_browser.py", "tests/test_realness_behind_a_declared_exit_e2e.py", "tests/test_route_header_order_e2e.py", "tests/test_route_sends_a_navigation_elsewhere_e2e.py", "tests/test_same_document_goto_e2e.py", "tests/test_script_cache_written_is_adopted_e2e.py", "tests/test_scroll_into_view.py", "tests/test_shadow_trusted_input.py", "tests/test_software_compositing_is_declared_e2e.py", "tests/test_the_association_is_ready_when_the_peerconnection_is_born_e2e.py", "tests/test_the_maximized_window_frames_and_popups_read_retail_e2e.py", "tests/test_the_parent_methods_of_the_window_origin_are_not_exposed_to_a_page_e2e.py", "tests/test_typing_a_character_without_a_key_e2e.py", "tests/test_webgl_noise_active.py", "tests/test_window_occlusion_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.2", "note": "Part 4 of the whole e2e suite of the wrapper (every test that opens the browser: what e2e.yml runs on the published engine), on the engine under test, as two passes through scripts/ci_suite_run.py (4 browsers at once, then the wall_clock tests alone; no rerun). The files of the 4 rows of windows are the files of tests/ that tests/test_the_e2e_suite_is_accounted_for.py holds one by one: a file whole when every test of it is here, else its tests by name. Partition from the junits of runs 44942540063 and 44985244053, test time balanced (about 609 s of estimated wall time, 4 browsers). A new file is added by hand to a row of each system and the minimum of the row goes up by hand. Left out of every row, with the reason in the accounting test: the files and tests of wrapper.e2e.udp.exit and wrapper.e2e.udp.sandbox (root and user namespaces, their own rows), the files of the round after the publication (tests/_post_publication.py), and the tests that skip on windows (a skip is red in the verdict).", "runner_image": {"windows": "windows-2022"}, "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.suite.windows.control_a", "giro": "G2", "os": ["windows"], "min_tests": 20, "exact": true, "tests": ["tests/test_control_a_selects_all_in_a_field_e2e.py"], "marker": "e2e", "needs_root": false, "linux_twin": "wrapper.e2e.suite.linux.1", "note": "The keyboard shortcut Control+A selects all in a field (5 ways to press it x an input and a textarea, in-process and served to the stock client), alone on its own Windows runner (windows-latest), as e2e.yml runs it on the published engine: the Windows keyboard of a real user is what it needs. The same file is in one of wrapper.e2e.suite.windows.1..4 and in wrapper.e2e.suite.linux.1.", "run": "suite_run"},
|
||||
{"id": "wrapper.e2e.ab_oracle", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_oracle_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Same seed, same bytes: the engine of the published set (the last published engine, with its own core and wrapper) against the candidate (with core_ref and wrapper_ref), on one machine, after the control: the published engine against ITSELF (the A/A; a difference is a broken control, exit 2, and the A/B is not run). On a pull request (no candidate: INVPW_BINARY_PATH is the published engine, no INVISIBLE_SEAL_FILE) the A/A is the whole test, on the first two seeds of the candidate set (all five when the pull request changes a file of this oracle: the step of e2e.yml that runs scripts/ci_ab_pr_seeds.py exports AB_ORACLE_PR_SEEDS), and saves both dumps and the diff under $AB_ORACLE_OUT or $RUNNER_TEMP/invpw-evidence/ab-oracle. scripts/ci_ab_oracle.py runs the host gate's dump (scripts/ci_host_gate.py dump: the persona seeds of ci/persona-seeds.json, each at its own DPR with nothing pinned, the whole page of scripts/host_gate; the `candidate` set of 5 seeds that reach every webgl renderer and every DPR, or with AB_ORACLE_SEED_SET=final and AB_ORACLE_SHARD=i/n the 20 seeds that reach every value of every dimension split over n jobs) twice, once with the published engine (fetched by the published set's own core under its own seal, which checks the archive's sha256, and dumped in that set's venv) and once with the candidate binary of the leg under its own seal, and compares every leaf of every visit: the only differences allowed are the `noise` entries of scripts/host_gate/exceptions.json and the diag. keys; anything else is red with the leaf, the two values and the seed; fewer leaves than the host gate's reference holds (16439 per visit; a DPR the reference does not record is held to the least of those it does) is red. The files (dump-<N>.json, dump-<N>-again.json for the tag of the published set, diff-a-a.json and, with a candidate, dump-candidate.json and diff.json) are the artifact ab-oracle-<os> of the leg. 1 = the one test; the comparator's own cases (51, the A/A's among them) are in tests/test_ab_oracle.py, the persona seeds' (15) in tests/test_persona_cover.py, in the rows of the whole unit suite. Needs the engine's binary (INVPW_BINARY_PATH) and, for the A/B, the candidate's seal (INVISIBLE_SEAL_FILE) and the network (the release assets of the published engine, and INVPW_PUBLISHED_PYTHON). Each engine runs with the core it was built for: a core that declares less than the published engine requires is no longer a red of this suite (it was: engine candidate 5, every A/B a broken control). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 50, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"], "artifact": "ab-oracle"},
|
||||
{"id": "wrapper.e2e.ab_network", "giro": "G2", "os": ["linux", "windows"], "min_tests": 1, "exact": true, "tests": ["tests/test_ab_network_e2e.py"], "marker": "e2e", "needs_root": false, "note": "Network A/B oracle: the P4 journey, HTTPS h1/h2 (ClientHello, h2 frames, header order), HTTP/3 (transport parameters, H3 SETTINGS), WebRTC through the coherent SOCKS5 lab gateway, DNS through the fake DoH, and an idle launch; transcripts compared leaf by leaf, direct connections red on either side. A/A first (the published engine twice: a difference is a broken control; ci/ab-network-volatile.json holds the leaves the A/A proved volatile, and may only shrink), then the published engine against the candidate. Without a candidate (a PR's e2e) the A/A alone, on the first seed (all five when the pull request changes a file of this oracle: AB_NETWORK_PR_SEEDS), in jobs of its own in e2e.yml on Linux and on Windows (the shared e2e jobs leave this file out). THE CONTROL IS THE PUBLISHED SET, as a user installs it: the last invisible-playwright on the index, the invisible-core it pins exactly and the engine that core's seal pins, in a venv of their own (ci/py-lock/published.txt, installed by hash from the run's wheelhouse; scripts/ci_published_set.py; INVPW_PUBLISHED_PYTHON is its python). The candidate's side is the candidate engine with core_ref and wrapper_ref. No tag is written in a harness file.", "timeout_minutes": 75, "core_dumps": "cores", "extra_steps": ["keep_oracle_files"]},
|
||||
|
||||
+34
-9
@@ -508,17 +508,37 @@ def own_cache_env(env: dict, folder: str, platform: str | None = None) -> dict:
|
||||
return out
|
||||
|
||||
|
||||
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path, python: str | None = None) -> tuple:
|
||||
def visits_complete(rc, target: Path, expected) -> tuple:
|
||||
"""`(True, [])` when the dump ended with 0 and every visit of `expected` ([(dpr, seed)]) has its result in `target` and none of them lost its tab; else `(False, [what is missing])`.
|
||||
This is where a run learns that its measurements are all there: the A/A's verdict on a known Mozilla defect depends on it (a crash that cost a measurement stays red)."""
|
||||
missing = [] if rc == 0 else ["the dump process ended with %s" % (rc,)]
|
||||
try:
|
||||
got = read_visits(target) if target.is_dir() else {}
|
||||
except (OSError, ValueError, KeyError, TypeError) as exc:
|
||||
got = {}
|
||||
missing.append("the dumps of %s cannot be read (%s: %s)" % (target.name, type(exc).__name__, exc))
|
||||
missing += ["no dump of %s" % visit_name(*key) for key in expected if key not in got]
|
||||
for key in expected:
|
||||
if key in got and tab_crashes(comparable(got[key])):
|
||||
missing.append("the tab of %s died: its leaves are not all there" % visit_name(*key))
|
||||
return not missing, missing
|
||||
|
||||
|
||||
def dump_with_exits(name: str, exe: str, seal_file, leg: str, visits, target: Path, out: Path, python: str | None = None, notes: list | None = None, control: bool = False) -> tuple:
|
||||
"""The dump of one engine run as `run_dump` makes it, with the folder where its probe writes how each browser ended (`<out>/crash/<name>`, named to the dump process by
|
||||
AB_CRASH_DIR): `(rc or "timeout", the red lines of the launches that did not end with 0, or that nobody saw)`. A dump process whose probe wrote nothing is red: an oracle
|
||||
that does not see how its browsers end does not see them."""
|
||||
that does not see how its browsers end does not see them.
|
||||
|
||||
`control` is the A/A's: a core a browser left while its parent ended with 0 is then judged against the known Mozilla defects (ci/mozilla-defects.json), with the run's measurements
|
||||
complete only when every visit has its result (`visits_complete`); a crash that matches is a line of `notes` and not a red line. Any other dump judges no core: every core is red."""
|
||||
crash_dir = out / "crash" / name
|
||||
try:
|
||||
with crash.environment(**{crash.CRASH_DIR_ENV: crash_dir}):
|
||||
rc = run_dump(exe, Path(seal_file) if seal_file else None, leg, target, visits, **({"python": python} if python else {}))
|
||||
except subprocess.TimeoutExpired:
|
||||
rc = "timeout"
|
||||
return rc, crash.exits_of_run(crash_dir, name, windows=leg.startswith("win"), needed=(rc == 0))
|
||||
complete, missing = visits_complete(rc, target, visits) if control else (None, [])
|
||||
return rc, crash.exits_of_run(crash_dir, name, windows=leg.startswith("win"), needed=(rc == 0), notes=notes, measurements_complete=complete, missing=missing, binary=exe)
|
||||
|
||||
|
||||
def run_dump(binary: str, seal: Path | None, leg: str, out: Path, visits: list | None = None, python: str | None = None) -> int:
|
||||
@@ -578,13 +598,14 @@ def again_name(engine_tag: str) -> str:
|
||||
return dump_name(engine_tag)[:-len(".json")] + "-again.json"
|
||||
|
||||
|
||||
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str, python: str | None = None) -> tuple:
|
||||
"""One engine's dump of `visits`: ({(dpr, seed): items}, problems); the packed dump is written to out/file_name."""
|
||||
def _dump_visits(name: str, exe: str, seal_file, leg: str, visits: list, work: Path, out: Path, file_name: str, python: str | None = None,
|
||||
notes: list | None = None, control: bool = False) -> tuple:
|
||||
"""One engine's dump of `visits`: ({(dpr, seed): items}, problems); the packed dump is written to out/file_name. `control` (the A/A's dumps) and `notes` are `dump_with_exits`'."""
|
||||
target = work / name
|
||||
print("=== dump with %s: %s (seal %s), seeds %s"
|
||||
% (name, exe, seal_file or "of the core", " ".join("%d@%s" % (seed, dpr) for dpr, seed in visits)))
|
||||
sys.stdout.flush()
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, python)
|
||||
rc, exits = dump_with_exits(name, exe, seal_file, leg, visits, target, out, python, notes, control)
|
||||
problems = ([] if rc == 0 else ["the dump with %s ended with %s" % (name, rc)]) + exits
|
||||
dumped = read_visits(target) if target.is_dir() else {}
|
||||
write_json(out / file_name, pack(name, dumped))
|
||||
@@ -605,20 +626,24 @@ def run_ab(leg: str, out: Path, engine_tag: str, published: tuple | None = None,
|
||||
started = time.time()
|
||||
noise = gate.load_exceptions().get("noise", [])
|
||||
asked = ["%d@%s" % (seed, dpr) for dpr, seed in visits]
|
||||
notes: list = [] # the cores of the A/A that the list of known Mozilla defects names: said, not red
|
||||
try:
|
||||
try:
|
||||
binary, seal, python = split_published(published or fetch_published(engine_tag, work))
|
||||
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag), **({"python": python} if python else {}))
|
||||
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag), **({"python": python} if python else {}))
|
||||
first, p1 = _dump_visits(engine_tag, binary, seal, leg, visits, work, out, dump_name(engine_tag), notes=notes, control=True, **({"python": python} if python else {}))
|
||||
again, p2 = _dump_visits(engine_tag + "-again", binary, seal, leg, visits, work, out, again_name(engine_tag), notes=notes, control=True,
|
||||
**({"python": python} if python else {}))
|
||||
problems = p1 + p2
|
||||
except SystemExit:
|
||||
raise
|
||||
except Exception as e: # noqa: BLE001 - a run that could not get its engine is red and says why
|
||||
first, again, problems = {}, {}, ["%s: %s" % (type(e).__name__, str(e)[:500])]
|
||||
control = judge(first, again, noise, problems, expected=expected)
|
||||
control.update(format=FORMAT, engine=engine_tag, leg=leg, control=True, seconds=round(time.time() - started), visits=asked)
|
||||
control.update(format=FORMAT, engine=engine_tag, leg=leg, control=True, seconds=round(time.time() - started), visits=asked, known_defects=notes)
|
||||
write_json(out / "diff-a-a.json", control)
|
||||
print_report(control, engine_tag, engine_tag + "-again", "AB ORACLE A/A")
|
||||
for note in notes:
|
||||
print("NOTE " + note)
|
||||
if control["verdict"] != "green":
|
||||
print("BROKEN CONTROL: the published engine differs from itself (or did not run twice), so what is compared is not stable: "
|
||||
"the A/B is not run, and the candidate is not judged")
|
||||
|
||||
@@ -117,9 +117,18 @@ def exit_problem(code, windows: bool | None = None, **who) -> str | None:
|
||||
return "the parent process exited with code %s: %s" % (describe_exit(code, windows), where or "launch not named")
|
||||
|
||||
|
||||
def exit_problems(launches, run: str, windows: bool | None = None, side: str | None = None) -> list:
|
||||
"""The red lines of the launches a probe recorded (`LaunchProbe.launches`, or the `launches` of an exits file) for the run `run`."""
|
||||
def exit_problems(launches, run: str, windows: bool | None = None, side: str | None = None, notes: list | None = None,
|
||||
measurements_complete: bool | None = None, missing=(), binary: str | None = None, judge=None) -> list:
|
||||
"""The red lines of the launches a probe recorded (`LaunchProbe.launches`, or the `launches` of an exits file) for the run `run`.
|
||||
|
||||
A launch whose parent ended with 0 and that left cores is judged against the known Mozilla defects when the caller says whether its measurements are complete
|
||||
(`measurements_complete` True or False; `missing` names what is not there): every core is a crash record (`crash_record`), and the list's matcher (`defects_judge`,
|
||||
the engine of `binary` for the version) rules on all of them at once. A launch whose crashes all match a defect and whose measurements are complete is not red: a
|
||||
line `known Mozilla defect D<n> (<bug or not filed>): <why>: <who>` goes into `notes`. Any other result is the red line below plus the lines of the verdict. A caller that
|
||||
does not know (`measurements_complete` None) judges nothing: its cores are red as ever. A launch whose parent did not end with 0, a minidump and a core with no record are
|
||||
never excused."""
|
||||
out = []
|
||||
judges: list = []
|
||||
for launch in launches or []:
|
||||
who = {"run": run, "side": side or side_of(run)}
|
||||
label = launch.get("label") or {}
|
||||
@@ -132,12 +141,25 @@ def exit_problems(launches, run: str, windows: bool | None = None, side: str | N
|
||||
out.append(line)
|
||||
elif launch.get("cores") or launch.get("dmp"):
|
||||
# the parent ended with 0 and a process of the browser left a core or a minidump: a content process died (the parent does not say so)
|
||||
where = ", ".join("%s %s" % kv for kv in who.items() if kv[1] not in (None, ""))
|
||||
line = "a process of the browser crashed while the parent ended with 0: %s left %s" % (
|
||||
", ".join("%s %s" % kv for kv in who.items() if kv[1] not in (None, "")),
|
||||
where,
|
||||
" and ".join(x for x in ("core " + ", ".join(launch["cores"]) if launch.get("cores") else "", "minidump " + ", ".join(launch["dmp"]) if launch.get("dmp") else "") if x))
|
||||
if launch.get("evidence"):
|
||||
line += " (evidence: %s)" % launch["evidence"]
|
||||
out.append(line)
|
||||
if measurements_complete is None or not launch.get("cores") or launch.get("dmp"):
|
||||
out.append(line)
|
||||
continue
|
||||
if not judges:
|
||||
judges.append(judge if judge is not None else defects_judge(binary))
|
||||
excused, lines = _judge_launch(judges[0], launch, measurements_complete, missing)
|
||||
if excused:
|
||||
for found in lines:
|
||||
if notes is not None:
|
||||
notes.append("known Mozilla defect %s: %s" % (found[len("MATCHED "):], where))
|
||||
else:
|
||||
out.append(line)
|
||||
out.extend(lines)
|
||||
return out
|
||||
|
||||
|
||||
@@ -154,6 +176,269 @@ def parent_exit_problems(lifecycle, root_code, **who) -> list:
|
||||
return out
|
||||
|
||||
|
||||
# -
|
||||
# Known Mozilla defects: a core of a crash that the list names is reported by its D<n>, never silently.
|
||||
#
|
||||
# The crash-record parser of this section (process_type, function_name, crashing_thread, reason_of, thread_name, phase_of, crash_record) moves to
|
||||
# the core in S1, next to the matcher, and is fetched by sha like it; the series' gtest_run then uses the same one. Until then this is the wrapper's copy.
|
||||
|
||||
#: The matcher is the core's main `scripts/ci_mozilla_defects.py`: the judge is never the branch being judged. A caller that has it on disk names its path here; otherwise it is fetched once
|
||||
#: per process from the core's main (the sha is resolved with `git ls-remote` and printed).
|
||||
MATCHER_ENV = "MOZILLA_DEFECTS_CHECKER"
|
||||
CORE_REPO = "oss-invisible/core"
|
||||
MATCHER_PATH_IN_CORE = "scripts/ci_mozilla_defects.py"
|
||||
MATCHER_API = ("load", "problems", "verdict")
|
||||
#: The wrapper's own list of known Mozilla defects, next to the scripts that run: the list of the wrapper under test. It is read from the wrapper's
|
||||
#: main once main holds it (after the engine release that carries the first row), so that a branch cannot excuse its own crash.
|
||||
DEFECTS_LIST = Path(__file__).resolve().parent.parent / "ci" / "mozilla-defects.json"
|
||||
FETCH_TIMEOUT_S = 60
|
||||
#: The process types a Firefox child is started as (`-contentproc ... <type>`).
|
||||
CHILD_TYPES = ("tab", "gpu", "rdd", "socket", "utility", "forkserver", "vr", "inference", "gmplugin")
|
||||
#: The kernel keeps 80 bytes of a process's arguments with the NUL: a `Core was generated by` line of 79 visible characters or more is cut.
|
||||
CUT_LINE = 79
|
||||
#: The shortest prefix of a flag that names it: `back` is the start of `backgroundtask`, the one Firefox flag that begins with it.
|
||||
FLAG_PREFIX_MIN = 4
|
||||
_HEADER = re.compile(r"Core was generated by `([^']*)'")
|
||||
_THREAD_HEADER = re.compile(r"^Thread (\d+) \((.*)\):\s*$")
|
||||
_CURRENT_THREAD = re.compile(r"\[Current thread is (\d+) ")
|
||||
_FRAME = re.compile(r"^#\d+\s+(.*)$")
|
||||
_REASON_LINE = re.compile(r'^0x[0-9a-fA-F]+(?: <[^>]*>)?:\s+"(.*)"\s*$')
|
||||
_CORE_NAME = re.compile(r"^core\.(.+)\.(\d+)\.(\d+)$")
|
||||
_SHA = re.compile(r"^[0-9a-f]{40}$")
|
||||
_FETCHED: dict = {}
|
||||
|
||||
|
||||
def process_type(text: str) -> str | None:
|
||||
"""The process type of the crashed process, from gdb's `Core was generated by` line; None when the line cannot say.
|
||||
|
||||
`-backgroundtask` (one or two dashes) gives `backgroundtask`. `-contentproc` gives its last token when that is a whole child type (`tab`, `gpu`, ...) and the line is not cut.
|
||||
A line with neither flag and not cut is the `parent`. A cut line (the kernel keeps 80 bytes of the arguments with the NUL, so 79 visible characters or more) whose last token,
|
||||
without its leading dashes, is a prefix of `backgroundtask` of at least 4 characters gives `backgroundtask` (no other Firefox flag begins with `back`); anything else cut gives None."""
|
||||
found = _HEADER.search(text or "")
|
||||
if not found:
|
||||
return None
|
||||
line = found.group(1)
|
||||
tokens = line.split()[1:]
|
||||
cut = len(line) >= CUT_LINE
|
||||
if any(t in ("-backgroundtask", "--backgroundtask") for t in tokens):
|
||||
return "backgroundtask"
|
||||
if any(t in ("-contentproc", "--contentproc") for t in tokens):
|
||||
return tokens[-1] if not cut and tokens[-1] in CHILD_TYPES else None
|
||||
if not cut:
|
||||
return "parent"
|
||||
last = tokens[-1].lstrip("-") if tokens else ""
|
||||
return "backgroundtask" if len(last) >= FLAG_PREFIX_MIN and "backgroundtask".startswith(last) else None
|
||||
|
||||
|
||||
def function_name(frame: str) -> str:
|
||||
"""The function of a gdb frame line (after `#N `): `0x.. in ns::f<T> (args) at file:7` is `ns::f<T>`; `?? () from lib` is `??`; `<signal handler called>` is itself."""
|
||||
text = re.sub(r"^0x[0-9a-fA-F]+ in ", "", frame.strip())
|
||||
depth = 0
|
||||
for i, ch in enumerate(text):
|
||||
depth += ch == "<"
|
||||
depth -= ch == ">" and depth > 0
|
||||
if ch == " " and depth == 0 and text[i + 1:i + 2] == "(":
|
||||
return text[:i]
|
||||
cut = text.find(" (")
|
||||
text = text[:cut] if cut > 0 else text
|
||||
return text.split(" from ")[0].split(" at ")[0].strip()
|
||||
|
||||
|
||||
def crashing_thread(text: str) -> tuple:
|
||||
"""(the name gdb quotes in the header of the crashing thread or None, the function names of its frames top first or None): the thread `[Current thread is N` names, found in the
|
||||
`thread apply all bt` blocks."""
|
||||
current = _CURRENT_THREAD.search(text or "")
|
||||
if not current:
|
||||
return None, None
|
||||
name, frames, inside = None, [], False
|
||||
for line in text.splitlines():
|
||||
head = _THREAD_HEADER.match(line)
|
||||
if head:
|
||||
inside = head.group(1) == current.group(1)
|
||||
if inside:
|
||||
quoted = re.search(r'"([^"]+)"\s*$', head.group(2))
|
||||
name, frames = (quoted.group(1) if quoted else None), []
|
||||
continue
|
||||
frame = _FRAME.match(line) if inside else None
|
||||
if frame:
|
||||
frames.append(function_name(frame.group(1)))
|
||||
return name, frames or None
|
||||
|
||||
|
||||
def reason_of(text: str) -> str | None:
|
||||
"""The MOZ_CRASH text: the quoted string of the line `x/s *(char**)&gMozCrashReason` prints (`0x...:<tab>"MOZ_CRASH(...)"`), else None."""
|
||||
for line in (text or "").splitlines():
|
||||
found = _REASON_LINE.match(line)
|
||||
if found and found.group(1):
|
||||
return found.group(1)
|
||||
return None
|
||||
|
||||
|
||||
def core_name_parts(name: str) -> tuple:
|
||||
"""(%e, %p, %t) of a core named by the job's `core.%e.%p.%t`: the crashing thread's name, the pid and the time as text; (None, None, None) for any other name."""
|
||||
found = _CORE_NAME.match(name or "")
|
||||
return found.groups() if found else (None, None, None)
|
||||
|
||||
|
||||
def thread_name(text: str, core_name: str) -> str | None:
|
||||
"""The name of the crashing thread without Mozilla's instance number: the name gdb quotes in the thread's header when it does, else %e of the core's name; then a trailing run of
|
||||
decimal digits is dropped. Mozilla names a thread of a process with its instance number appended (the broker thread `FSBroker` is `FSBroker14298`), so the name a row holds is
|
||||
the name without it. None when no name is known or nothing is left."""
|
||||
name = crashing_thread(text)[0] or core_name_parts(core_name)[0]
|
||||
name = re.sub(r"\d+$", "", name or "")
|
||||
return name or None
|
||||
|
||||
|
||||
def phase_of(core_name: str, mtime: float | None, closing_at: float | None) -> str | None:
|
||||
"""`exit` when the core was written at or after the moment the launch began to close the browser, `run` when before; None when either moment cannot be known.
|
||||
The core's time is %t of its name (whole seconds: a core of the second the close began is an exit), else the file's mtime."""
|
||||
if closing_at is None:
|
||||
return None
|
||||
stamp = core_name_parts(core_name)[2]
|
||||
if stamp is not None:
|
||||
return "exit" if int(stamp) + 1 > closing_at else "run"
|
||||
if mtime is None:
|
||||
return None
|
||||
return "exit" if mtime >= closing_at else "run"
|
||||
|
||||
|
||||
def crash_record(text: str, core_name: str, mtime: float | None = None, closing_at: float | None = None) -> dict:
|
||||
"""The record the matcher takes for one core: {process, phase, thread, frames, reason}; a field the evidence cannot give is left out, so a row that names it cannot match.
|
||||
`text` is gdb's text of the core (`gdb_report`), `core_name` the core's file name, `mtime` its modification time, `closing_at` the moment the launch began to close."""
|
||||
frames = crashing_thread(text)[1]
|
||||
out = {"process": process_type(text), "phase": phase_of(core_name, mtime, closing_at), "thread": thread_name(text, core_name), "frames": frames, "reason": reason_of(text)}
|
||||
return {key: value for key, value in out.items() if value is not None}
|
||||
|
||||
|
||||
class DefectsUnavailable(Exception):
|
||||
"""The matcher of known Mozilla defects cannot be had: every crash stays red and the message says why."""
|
||||
|
||||
|
||||
def _download_matcher(run, urlopen, say) -> Path:
|
||||
"""The matcher of the core's main, written to a temporary file: main's sha is resolved with `git ls-remote`, then that exact file is downloaded."""
|
||||
try:
|
||||
done = run(["git", "ls-remote", "https://github.com/%s" % CORE_REPO, "refs/heads/main"], capture_output=True, text=True, timeout=FETCH_TIMEOUT_S, check=False)
|
||||
except (OSError, subprocess.SubprocessError) as exc:
|
||||
raise DefectsUnavailable("main of %s cannot be resolved (%s: %s)" % (CORE_REPO, type(exc).__name__, exc)) from exc
|
||||
words = (done.stdout or "").split()
|
||||
if done.returncode != 0 or not words or not _SHA.match(words[0]):
|
||||
raise DefectsUnavailable("main of %s cannot be resolved (git ls-remote exited %s: %s)" % (CORE_REPO, done.returncode, ((done.stdout or "") + (done.stderr or "")).strip()[:200]))
|
||||
sha = words[0]
|
||||
url = "https://raw.githubusercontent.com/%s/%s/%s" % (CORE_REPO, sha, MATCHER_PATH_IN_CORE)
|
||||
if urlopen is None:
|
||||
import urllib.request
|
||||
|
||||
urlopen = urllib.request.urlopen
|
||||
try:
|
||||
with urlopen(url, timeout=FETCH_TIMEOUT_S) as response:
|
||||
data = response.read()
|
||||
path = Path(tempfile.mkdtemp(prefix="mozilla-defects-checker-")) / Path(MATCHER_PATH_IN_CORE).name
|
||||
path.write_bytes(data)
|
||||
except Exception as exc: # noqa: BLE001 - whatever the download does, the judge is not available
|
||||
raise DefectsUnavailable("%s cannot be downloaded (%s: %s)" % (url, type(exc).__name__, exc)) from exc
|
||||
say("known Mozilla defects: the matcher is %s of %s main, sha %s" % (MATCHER_PATH_IN_CORE, CORE_REPO, sha))
|
||||
return path
|
||||
|
||||
|
||||
def matcher_path(environ=None, run=subprocess.run, urlopen=None, say=print) -> Path:
|
||||
"""Where the matcher is: `$MOZILLA_DEFECTS_CHECKER` when set, else the core's main fetched once per process. DefectsUnavailable when it cannot be had."""
|
||||
env = os.environ if environ is None else environ
|
||||
if env.get(MATCHER_ENV):
|
||||
return Path(env[MATCHER_ENV])
|
||||
if "result" not in _FETCHED:
|
||||
try:
|
||||
_FETCHED["result"] = _download_matcher(run, urlopen, say)
|
||||
except DefectsUnavailable as exc:
|
||||
_FETCHED["result"] = exc
|
||||
if isinstance(_FETCHED["result"], Exception):
|
||||
raise _FETCHED["result"]
|
||||
return _FETCHED["result"]
|
||||
|
||||
|
||||
def load_matcher(path):
|
||||
"""The matcher module imported by path; DefectsUnavailable when it is not a file, does not import or lacks `load`, `problems` or `verdict`."""
|
||||
import importlib.util
|
||||
|
||||
if not Path(path).is_file():
|
||||
raise DefectsUnavailable("the matcher %s does not exist" % path)
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("ci_mozilla_defects_of_the_core", str(path))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
except Exception as exc: # noqa: BLE001 - whatever the file does, the judge is not available
|
||||
raise DefectsUnavailable("the matcher %s cannot be imported (%s: %s)" % (path, type(exc).__name__, exc)) from exc
|
||||
lacking = [name for name in MATCHER_API if not callable(getattr(module, name, None))]
|
||||
if lacking:
|
||||
raise DefectsUnavailable("the matcher %s has no %s: it is not the matcher of known Mozilla defects" % (path, ", ".join(lacking)))
|
||||
return module
|
||||
|
||||
|
||||
def engine_version(binary) -> str:
|
||||
"""The `Version=` of the `application.ini` beside the browser binary (159.0); DefectsUnavailable when there is none."""
|
||||
if not binary:
|
||||
raise DefectsUnavailable("the browser binary is not known, so the engine version is not known")
|
||||
ini = Path(binary).parent / "application.ini"
|
||||
try:
|
||||
text = ini.read_text(encoding="utf-8", errors="replace")
|
||||
except OSError as exc:
|
||||
raise DefectsUnavailable("%s cannot be read (%s): the engine version is not known" % (ini, exc)) from exc
|
||||
found = re.search(r"^Version=(\S+)\s*$", text, re.M)
|
||||
if not found:
|
||||
raise DefectsUnavailable("%s has no Version= line: the engine version is not known" % ini)
|
||||
return found.group(1)
|
||||
|
||||
|
||||
class DefectsJudge:
|
||||
"""The matcher, the wrapper's list of known defects and the engine's version, ready to rule on the crashes of one launch; or, with `why`, the reason it is not available (then
|
||||
every crash is red)."""
|
||||
|
||||
def __init__(self, module=None, rows=None, version: str = "", why: str = "") -> None:
|
||||
self.module, self.rows, self.version, self.why = module, rows, version, why
|
||||
|
||||
def verdict(self, records: list, measurements_complete: bool) -> tuple:
|
||||
"""(red, lines) as the matcher's `verdict` gives them; without a matcher, red and the reason."""
|
||||
if self.module is None:
|
||||
return True, ["known Mozilla defects: not judged, every crash stays red: %s" % self.why]
|
||||
try:
|
||||
red, lines = self.module.verdict(self.rows, self.version, records, measurements_complete)
|
||||
except Exception as exc: # noqa: BLE001 - a crash that cannot be judged stays red
|
||||
return True, ["known Mozilla defects: the matcher cannot rule (%s: %s): the crash stays red" % (type(exc).__name__, exc)]
|
||||
return bool(red), [str(line) for line in lines]
|
||||
|
||||
|
||||
def defects_judge(binary, environ=None, list_path=None, run=subprocess.run, urlopen=None, say=print) -> DefectsJudge:
|
||||
"""The judge for the engine whose browser binary is `binary`. Closed: no matcher, a matcher without the API, a list that cannot be read or no engine version is a judge
|
||||
that keeps every crash red and says why."""
|
||||
try:
|
||||
module = load_matcher(matcher_path(environ, run, urlopen, say))
|
||||
path = Path(list_path) if list_path else DEFECTS_LIST
|
||||
try:
|
||||
rows = module.load(path)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
raise DefectsUnavailable("the list of known defects %s cannot be read (%s)" % (path, exc)) from exc
|
||||
version = engine_version(binary)
|
||||
try:
|
||||
module.problems([], version)
|
||||
except Exception as exc: # noqa: BLE001
|
||||
raise DefectsUnavailable("the matcher cannot use the engine version %s (%s)" % (version, exc)) from exc
|
||||
except DefectsUnavailable as exc:
|
||||
return DefectsJudge(why=str(exc))
|
||||
return DefectsJudge(module, rows, version)
|
||||
|
||||
|
||||
def _judge_launch(judge, launch: dict, measurements_complete: bool, missing=()) -> tuple:
|
||||
"""(excused, lines) of one launch that left cores. The records are the probe's (`launch["crash_records"]`, one per core name); a core with no record is not judged and stays red."""
|
||||
names = list(dict.fromkeys(launch.get("cores") or []))
|
||||
by_core = {c.get("core"): c.get("record") for c in launch.get("crash_records") or [] if isinstance(c, dict)}
|
||||
absent = [n for n in names if not isinstance(by_core.get(n), dict)]
|
||||
if absent:
|
||||
return False, ["known Mozilla defects: no crash record for core %s: the crash stays red" % ", ".join(absent)]
|
||||
red, lines = judge.verdict([by_core[n] for n in names], bool(measurements_complete))
|
||||
if not measurements_complete and missing:
|
||||
lines = list(lines) + ["measurement missing: %s" % "; ".join(str(m) for m in missing)]
|
||||
return (not red), lines
|
||||
|
||||
|
||||
# -
|
||||
# What a crash leaves: the folders, the files, the cores (the collectors that scripts/ci_ab_host.py and the probe's launches share live here).
|
||||
|
||||
@@ -570,6 +855,7 @@ class LaunchProbe:
|
||||
probe._began(conn)
|
||||
|
||||
def close(conn, *args, **kwargs):
|
||||
probe._closing(conn)
|
||||
try:
|
||||
return original_close(conn, *args, **kwargs)
|
||||
finally:
|
||||
@@ -620,6 +906,16 @@ class LaunchProbe:
|
||||
except Exception: # noqa: BLE001 - a probe never breaks a launch
|
||||
pass
|
||||
|
||||
def _closing(self, conn) -> None:
|
||||
"""The launch begins to close the browser (before the close it already makes runs): the moment is the line between a core of the run and a core of the exit."""
|
||||
try:
|
||||
with self._lock:
|
||||
state = self._open.get(id(conn))
|
||||
if state is not None:
|
||||
state.setdefault("closing", self.clock())
|
||||
except Exception: # noqa: BLE001 - a probe never breaks a launch
|
||||
pass
|
||||
|
||||
def _core_folders(self) -> list:
|
||||
if self.core_folders is not None:
|
||||
return list(self.core_folders() if callable(self.core_folders) else self.core_folders)
|
||||
@@ -644,6 +940,8 @@ class LaunchProbe:
|
||||
# EVERY launch: what the browser wrote is saved, and the cores since it began (a content process can die and the parent still end with 0)
|
||||
self._save_output(conn, entry)
|
||||
entry["cores"], entry["dmp"] = [c.name for c in cores], dmp
|
||||
if state.get("closing") is not None:
|
||||
entry["closing_at"] = state["closing"]
|
||||
if not cores:
|
||||
entry["core_said"] = core_said(folders, kernel_core_pattern(), self.windows)
|
||||
if entry["returncode"] != 0 or cores or dmp:
|
||||
@@ -654,11 +952,29 @@ class LaunchProbe:
|
||||
write_crash_files(crash, self.crash_dir / name)
|
||||
entry["evidence"] = "%s/%s" % (self.crash_dir.name, name)
|
||||
entry["said"] = crash["said"]
|
||||
if cores:
|
||||
entry["crash_records"] = self._crash_records(cores, crash, entry.get("closing_at"))
|
||||
except Exception as e: # noqa: BLE001 - what could not be collected is said
|
||||
entry["probe_error"] = "%s: %s" % (type(e).__name__, e)
|
||||
with self._lock:
|
||||
self.launches.append(entry)
|
||||
|
||||
@staticmethod
|
||||
def _crash_records(cores, crash: dict, closing_at) -> list:
|
||||
"""One record per core name (`crash_record`), from the text gdb gave of that core and the core's own name and time: what `exit_problems` judges."""
|
||||
texts = (crash.get("cores") or {}).get("backtraces") or {}
|
||||
records, done = [], set()
|
||||
for core in cores:
|
||||
if core.name in done:
|
||||
continue
|
||||
done.add(core.name)
|
||||
try:
|
||||
mtime = core.stat().st_mtime
|
||||
except OSError:
|
||||
mtime = None
|
||||
records.append({"core": core.name, "record": crash_record(texts.get(core.name, ""), core.name, mtime, closing_at)})
|
||||
return records
|
||||
|
||||
# -
|
||||
# What the browsers wrote.
|
||||
|
||||
@@ -946,9 +1262,11 @@ def read_exits(path) -> dict | None:
|
||||
return document if document.get("format") == FORMAT else None
|
||||
|
||||
|
||||
def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool = True) -> list:
|
||||
def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool = True, notes: list | None = None, measurements_complete: bool | None = None,
|
||||
missing=(), binary: str | None = None) -> list:
|
||||
"""The red lines of the launches a run process recorded in `crash_dir/exits.json`. No file, or no launch in it, is red when the run was to make some: an oracle
|
||||
that did not see how its browsers ended did not see them."""
|
||||
that did not see how its browsers ended did not see them. `notes`, `measurements_complete`, `missing` and `binary` are `exit_problems`': the cores of the launches are judged against
|
||||
the known Mozilla defects only when the caller says whether the run's measurements are complete."""
|
||||
if not crash_dir:
|
||||
return []
|
||||
document = read_exits(Path(crash_dir) / "exits.json")
|
||||
@@ -956,7 +1274,7 @@ def exits_of_run(crash_dir, run: str, windows: bool | None = None, needed: bool
|
||||
return ["the run %s left no record of how its browsers ended (%s/exits.json): the probe did not see them" % (run, Path(crash_dir).name)] if needed else []
|
||||
if not document["launches"] and needed:
|
||||
return ["the run %s recorded no launch in %s/exits.json: the probe did not see a browser" % (run, Path(crash_dir).name)]
|
||||
problems = exit_problems(document["launches"], run, windows)
|
||||
problems = exit_problems(document["launches"], run, windows, notes=notes, measurements_complete=measurements_complete, missing=missing, binary=binary)
|
||||
if document.get("stderr_said"):
|
||||
problems.append("the run %s could not save what its browsers wrote: %s" % (run, document["stderr_said"]))
|
||||
for launch in document["launches"]:
|
||||
|
||||
@@ -81,8 +81,15 @@ EXCLUDED = {
|
||||
#: fine: it is the pref of a core that comes later than the one in use (or earlier than the one that added it), and the pair
|
||||
#: of cores must give the same file. maximized_ui is of the panel because the core declares the bar from the work area's
|
||||
#: height as well as from the scale (declared_maximized_ui: compact when the work area is short in CSS px).
|
||||
#: The screen's size in device pixels is of the panel too: the core declares it as the whole panel (device_width and
|
||||
#: device_height of ScreenProfile, invisible_core/_fpforge/profile.py:121 and :126; the prefs, invisible_core/prefs.py:1293-1294)
|
||||
#: and the work area as the screen minus the taskbar (profile.py:131-145). So, from the panel's own prefs, the width is
|
||||
#: avail_device_width and the height is avail_device_height plus the taskbar in device pixels. The test compares the prefs with
|
||||
#: the core's own ScreenProfile for each seed: no copy of the taskbar or of the formula lives here.
|
||||
DERIVED = {
|
||||
P + "screen.maximized_ui": "screen_panel",
|
||||
P + "screen.device_width": "screen_panel",
|
||||
P + "screen.device_height": "screen_panel",
|
||||
}
|
||||
#: What the candidate run visits: the smallest set that reaches every one of these dimensions' values.
|
||||
CANDIDATE_DIMENSIONS = ("webgl_renderer", "dpr")
|
||||
|
||||
@@ -3154,6 +3154,29 @@ def _with_trace(failure: BaseException, trace: str) -> BaseException:
|
||||
return RuntimeError("%s [%s]" % (failure, trace))
|
||||
|
||||
|
||||
#: The key of a context's `viewport` that says the size is only the one the core declares for the main window (`context_geometry`), not one
|
||||
#: the user chose. The session puts it on its default context options (`_default_context_kwargs`); a viewport the user passes has no such
|
||||
#: key, so it replaces the declared one whole. It travels to the engine as `isDeclaredDefault` of `Browser.setDefaultViewport`, where a popup
|
||||
#: that names no size is then left to its own window; it never reaches the client (`_viewport_as_told`).
|
||||
DECLARED_VIEWPORT_KEY = "isDeclaredDefault"
|
||||
|
||||
|
||||
def declared_viewport(viewport: Dict[str, Any]) -> Dict[str, Any]:
|
||||
"""`viewport` (the core's `{"width", "height"}`) marked as the declared default of the session."""
|
||||
return dict(viewport, **{DECLARED_VIEWPORT_KEY: True})
|
||||
|
||||
|
||||
def _viewport_is_declared(viewport: Optional[Dict[str, Any]]) -> bool:
|
||||
return bool(viewport and viewport.get(DECLARED_VIEWPORT_KEY))
|
||||
|
||||
|
||||
def _viewport_as_told(viewport: Optional[Dict[str, Any]]) -> Optional[Dict[str, Any]]:
|
||||
"""The size the client is told: the width and the height, never the mark."""
|
||||
if not viewport:
|
||||
return None
|
||||
return {"width": viewport["width"], "height": viewport["height"]}
|
||||
|
||||
|
||||
def _target_is_gone(error: BaseException) -> bool:
|
||||
"""Whether a failed command failed because the target or its session no longer exists (the engine closed the tab under it)."""
|
||||
if isinstance(error, juggler.TargetClosedError):
|
||||
@@ -3422,16 +3445,22 @@ class PageDispatcher(Dispatcher):
|
||||
self.actions = context.browser.actions_for_page(
|
||||
session, self.lifecycle, self.injected, self.number)
|
||||
#: The viewport as the client was told it (the initializer's, then
|
||||
#: `setViewportSize`): the hand plans inside it.
|
||||
self.viewport_size = context.options.get("viewport") or {
|
||||
#: `setViewportSize`): the hand plans inside it, unless the page is not pinned (`planning_viewport`).
|
||||
self.viewport_size = _viewport_as_told(context.options.get("viewport")) or {
|
||||
"width": 1280, "height": 720}
|
||||
#: ⛔ A POPUP THE ENGINE DID NOT PIN has no viewport of its own: its size is its window's, which can still change after its first
|
||||
#: script, so the client is told none (`viewport_size` None, Playwright's meaning of a page whose viewport is not emulated) and
|
||||
#: the wrapper reads the size when it needs it (`planning_viewport`). True from birth for a popup under the declared default;
|
||||
#: `setViewportSize` pins the page and ends it.
|
||||
self.viewport_unpinned = self._is_unpinned_popup(context, opener)
|
||||
self._last_window_size: Optional[Dict[str, int]] = None
|
||||
#: ⛔ THE HAND, built where the page's number and the session's seed
|
||||
#: meet: one stream per page, the seed the client's cursor drew from
|
||||
#: (`_cursor.page_motion_seed`). See `pointer.py`.
|
||||
self.pointer = Pointer(
|
||||
self.actions, self.injected, self.number,
|
||||
context.browser.session_seed, context.browser.motion_budget_s,
|
||||
lambda: self.viewport_size,
|
||||
self.planning_viewport,
|
||||
draws=context.browser.pointer_draws)
|
||||
self._frames: Dict[str, Any] = {}
|
||||
#: The child frames the client was told of (`frameAttached`), to tell it of the ones born before the hook was in.
|
||||
@@ -3481,14 +3510,15 @@ class PageDispatcher(Dispatcher):
|
||||
name=getattr(known, "name", "") or "",
|
||||
load_states=sorted(getattr(known, "states", []) or []) or None,
|
||||
told_commit=self._last_commit(known))
|
||||
viewport = self.viewport_size
|
||||
viewport = self.told_viewport()
|
||||
# `pageNumber` is ours, not Playwright's: the number the page's
|
||||
# rhythms are drawn under (`pointer.py` and the actions' nonce read it
|
||||
# from `self.number`), told to the client so that it can name the page
|
||||
# the way the server does.
|
||||
initializer = {"mainFrame": self.frame.channel,
|
||||
"viewportSize": viewport, "isClosed": False,
|
||||
initializer = {"mainFrame": self.frame.channel, "isClosed": False,
|
||||
"pageNumber": self.number}
|
||||
if viewport is not None:
|
||||
initializer["viewportSize"] = viewport
|
||||
if opener is not None:
|
||||
# ⛔ THE OPENER TRAVELS IN THE INITIALIZER, and nowhere else. The
|
||||
# client resolves `page.opener()` from it and emits `popup` on the
|
||||
@@ -4437,11 +4467,45 @@ class PageDispatcher(Dispatcher):
|
||||
return None
|
||||
|
||||
# ── viewport, media, capture ────────────────────────────────────────────
|
||||
@staticmethod
|
||||
def _is_unpinned_popup(context: "BrowserContextDispatcher", opener: Optional["PageDispatcher"]) -> bool:
|
||||
"""Whether this page is a popup the engine did not pin: the context's viewport is only the declared default."""
|
||||
return opener is not None and _viewport_is_declared(context.options.get("viewport"))
|
||||
|
||||
def told_viewport(self) -> Optional[Dict[str, int]]:
|
||||
"""The viewport the client is told (`page.viewport_size`): none for a popup the engine did not pin."""
|
||||
return None if self.viewport_unpinned else self.viewport_size
|
||||
|
||||
def planning_viewport(self) -> Dict[str, int]:
|
||||
"""The size the hand plans inside and the bounds checks use, at the time of use: the window's own for a popup the engine did not
|
||||
pin (the last one read when the window cannot be read now), else the viewport the client was told."""
|
||||
if not self.viewport_unpinned:
|
||||
return self.viewport_size
|
||||
size = self._window_size()
|
||||
if size is not None:
|
||||
self._last_window_size = size
|
||||
return self._last_window_size or self.viewport_size
|
||||
|
||||
def _window_size(self) -> Optional[Dict[str, int]]:
|
||||
"""The content size of this page's window, as the page reads it (`innerWidth`, `innerHeight`), or None when it cannot be read."""
|
||||
try:
|
||||
box = self.injected.evaluate(
|
||||
self.main_frame_id,
|
||||
"({width: window.innerWidth, height: window.innerHeight})")
|
||||
except Exception:
|
||||
return None
|
||||
if (isinstance(box, dict) and isinstance(box.get("width"), (int, float))
|
||||
and isinstance(box.get("height"), (int, float))
|
||||
and box["width"] > 0 and box["height"] > 0):
|
||||
return {"width": int(box["width"]), "height": int(box["height"])}
|
||||
return None
|
||||
|
||||
def op_set_viewport_size(self, params: Dict) -> Any:
|
||||
self.send("Page.setViewportSize", only_set(
|
||||
{"viewportSize": params.get("viewportSize")}))
|
||||
if params.get("viewportSize"):
|
||||
self.viewport_size = params["viewportSize"]
|
||||
self.viewport_unpinned = False # a size the client set pins the page
|
||||
return None
|
||||
|
||||
def op_emulate_media(self, params: Dict) -> Any:
|
||||
@@ -6530,6 +6594,10 @@ class BrowserDispatcher(Dispatcher):
|
||||
# this project spends a pref on getting right.
|
||||
wanted: Dict[str, Any] = {"viewportSize": {
|
||||
"width": viewport["width"], "height": viewport["height"]}}
|
||||
# ⛔ ONE BIT: the size is the core's declaration for the main window, not the user's. The engine pins a tab to it either way;
|
||||
# a popup that names no size is pinned only to a size the user chose, as upstream does.
|
||||
if _viewport_is_declared(viewport):
|
||||
wanted["isDeclaredDefault"] = True
|
||||
screen = params.get("screen")
|
||||
if screen:
|
||||
wanted["screenSize"] = {"width": screen["width"],
|
||||
|
||||
@@ -26,7 +26,8 @@ from ._cursor import (ENGINE_PYTHON,
|
||||
enable_for as _enable_cursor_engine,
|
||||
max_seconds_for as _cursor_max_seconds)
|
||||
from ._engine import resolve_executable
|
||||
from ._juggler.server import COMPOSED_PREF, MOTION_BUDGET_PREF, POINTER_PREF, SESSION_SEED_PREF, UDP_EXIT_PREF, UDP_STUN_PREF
|
||||
from ._juggler.server import (COMPOSED_PREF, MOTION_BUDGET_PREF, POINTER_PREF, SESSION_SEED_PREF, UDP_EXIT_PREF, UDP_STUN_PREF,
|
||||
declared_viewport)
|
||||
from typing import Any, Dict, Optional
|
||||
|
||||
from invisible_core import compose_session_prefs, context_geometry, make_virtual_display
|
||||
@@ -514,8 +515,13 @@ class CommonLaunch:
|
||||
# the profile's screen is the PANEL, and until wrapper 0.28.0 the
|
||||
# panel's device pixels went out here as CSS (screen.width 1920 at
|
||||
# DPR 1.25).
|
||||
geometry = context_geometry(self._profile)
|
||||
kwargs: Dict[str, Any] = {
|
||||
**context_geometry(self._profile),
|
||||
**geometry,
|
||||
# ⛔ THE VIEWPORT IS MARKED AS THE CORE'S, not the user's: a viewport the user passes to `new_context` / `new_page` replaces
|
||||
# this one whole, mark included, so what reaches the server without the mark is a choice. A popup that names no size is
|
||||
# pinned to a chosen viewport as in Playwright and left to its own window under this one (`declared_viewport`).
|
||||
"viewport": declared_viewport(geometry["viewport"]),
|
||||
# ⛔ device_scale_factor and color_scheme are NO LONGER passed.
|
||||
# They were a second source for two facts invisible_core already
|
||||
# declares (layout.css.devPixelsPerPx and, since 2026-08-24,
|
||||
|
||||
@@ -0,0 +1,97 @@
|
||||
"""What the browser writes to its output, read by every e2e test that launches the engine, and the lines that fail the test.
|
||||
|
||||
The core reads the browser's stdout and stderr (one pipe) through ``invisible_core.juggler.connection.ProcessOutput``, one reader for the whole life of the process, and keeps the last 200 lines. Nothing in the e2e suites looked at those
|
||||
lines: a line the engine writes to say that it did something it should not have done passed in silence. The check is here: while an e2e test runs, a tee in front of that reader (the bytes are the ones the reader gets, and the browser cannot
|
||||
tell) matches every line against ``FAILING_LINES``; the test fails, at its teardown, naming each line it saw.
|
||||
|
||||
``tests/conftest.py`` installs it for every test marked ``e2e`` (``_the_browser_log_holds_no_line_that_fails_the_test``). A browser that a test starts in a child process of its own (the A/B oracles) is not seen from here: its output is
|
||||
kept by ``scripts/ci_crash_evidence.py`` and judged by the oracle.
|
||||
|
||||
THE LINES.
|
||||
|
||||
* An expired wait for ``popupshown``. The engine's Juggler (``juggler/protocol/PageHandler.js``, ``_waitForPopupOfPress``) holds the release of a click until the popup its press opened (a select dropdown) says ``popupshown``, at most one
|
||||
second, and when the second passes it goes on and writes ``WARNING: popup <id> did not say popupshown within <ms> ms of its press, the release goes on``. The release that goes on is one the dropdown may drop, so a click that a test saw
|
||||
pass can have lost its ``mouseup``. The text here is the engine's, character for character; the id is the popup's element id (or its tag name) and the number is ``POPUP_SHOWN_WAIT_MS``.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import re
|
||||
import threading
|
||||
from typing import List
|
||||
|
||||
import pytest
|
||||
|
||||
#: The lines of the browser's output that fail an e2e test, each with what it means (the message names both the line and this).
|
||||
FAILING_LINES = (
|
||||
(re.compile(r"WARNING: popup \S+ did not say popupshown within \d+ ms of its press, the release goes on"),
|
||||
"a release waited for the popup its press opened to say popupshown, and went on without it (the engine's bound passed)"),
|
||||
)
|
||||
|
||||
|
||||
def failing(text: str) -> List[str]:
|
||||
"""The lines of ``text`` that fail a test, each as ``line <- what it means``."""
|
||||
found = []
|
||||
for line in text.splitlines():
|
||||
for pattern, meaning in FAILING_LINES:
|
||||
hit = pattern.search(line)
|
||||
if hit:
|
||||
found.append("%s <- %s" % (hit.group(0), meaning))
|
||||
return found
|
||||
|
||||
|
||||
class Sink:
|
||||
"""What the browsers of one test wrote that fails it, and the readers that were tee'd."""
|
||||
|
||||
def __init__(self) -> None:
|
||||
self.lines: List[str] = []
|
||||
self.outputs: list = []
|
||||
self._lock = threading.Lock()
|
||||
|
||||
def add(self, text: str) -> None:
|
||||
found = failing(text)
|
||||
if found:
|
||||
with self._lock:
|
||||
self.lines.extend(found)
|
||||
|
||||
def fail_if_any(self, wait: float = 0.5) -> None:
|
||||
"""Fail the test, naming every line, when a browser of the test wrote one. A browser that has just closed has its last lines still in the pipe: its reader is given ``wait`` seconds to reach the end."""
|
||||
for output in self.outputs:
|
||||
thread = getattr(output, "_thread", None)
|
||||
if thread is not None and thread.is_alive():
|
||||
thread.join(wait)
|
||||
with self._lock:
|
||||
lines = list(self.lines)
|
||||
if lines:
|
||||
pytest.fail("the browser's output holds %d line(s) that fail an e2e test:\n %s" % (len(lines), "\n ".join(lines)), pytrace=False)
|
||||
|
||||
|
||||
class ScanStream:
|
||||
"""The stream the core's reader reads, with every line it reads matched against ``FAILING_LINES``: the same lines in the same order to the same reader, and nothing written to the browser."""
|
||||
|
||||
def __init__(self, stream, sink: Sink) -> None:
|
||||
self._stream, self._sink = stream, sink
|
||||
|
||||
def readline(self, *args):
|
||||
line = self._stream.readline(*args)
|
||||
if line:
|
||||
try:
|
||||
self._sink.add(line.decode("utf-8", "replace") if isinstance(line, bytes) else str(line))
|
||||
except Exception: # noqa: BLE001 - a check never breaks a launch
|
||||
pass
|
||||
return line
|
||||
|
||||
def __getattr__(self, name):
|
||||
return getattr(self._stream, name)
|
||||
|
||||
|
||||
def install(monkeypatch, sink: Sink) -> None:
|
||||
"""Put the tee in front of the reader of every browser the process launches through the core, until ``monkeypatch`` undoes it."""
|
||||
from invisible_core.juggler.connection import ProcessOutput
|
||||
|
||||
original = ProcessOutput.__init__
|
||||
|
||||
def init(self, stream, *args, **kwargs):
|
||||
original(self, ScanStream(stream, sink), *args, **kwargs)
|
||||
sink.outputs.append(self)
|
||||
|
||||
monkeypatch.setattr(ProcessOutput, "__init__", init)
|
||||
@@ -1,7 +1,7 @@
|
||||
"""The strace stand-in of the Linux font tests: the engine's directory as links, whose executable runs the real one under ``strace`` in the
|
||||
engine's place (same pid, same process group), and what reads its log (who is the parent and who a content process) and cleans its group.
|
||||
|
||||
Used by tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py. No test of its own, no browser."""
|
||||
Used by tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py and tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py. No test of its own, no browser."""
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
|
||||
@@ -274,6 +274,20 @@ def _no_test_asks_the_world_where_it_leaves_from():
|
||||
pytest.fail("the question of the exit went toward the internet: " + "; ".join(asked), pytrace=False)
|
||||
|
||||
|
||||
@pytest.fixture(autouse=True)
|
||||
def _the_browser_log_holds_no_line_that_fails_the_test(request, monkeypatch):
|
||||
"""An e2e test fails when a browser it launched wrote a line that fails it (``tests/_browser_log.py``: the engine's expired wait for ``popupshown`` among them), and the failure names the line."""
|
||||
if request.node.get_closest_marker("e2e") is None:
|
||||
yield
|
||||
return
|
||||
import _browser_log
|
||||
|
||||
sink = _browser_log.Sink()
|
||||
_browser_log.install(monkeypatch, sink)
|
||||
yield
|
||||
sink.fail_if_any()
|
||||
|
||||
|
||||
def _park_the_os_cursor():
|
||||
"""Windows: the OS cursor goes where no window of the browsers below the test process covers (the bottom-right corner while none is open), read back."""
|
||||
if sys.platform == "win32":
|
||||
|
||||
@@ -0,0 +1,358 @@
|
||||
#!/usr/bin/env python3
|
||||
"""CI known Mozilla defects - the list of crashes a test may meet and the matcher that reads it (stdlib only, Python >= 3.11).
|
||||
|
||||
A crash that comes from a defect of Mozilla's own Firefox (one the stock browser has too) is not fixed by a patch of ours (see the
|
||||
engine's rule on Mozilla defects); the tests that meet it still have to say so by name and not by a threshold, a skip or a rerun.
|
||||
That is this file's job. Each repository that judges crashes keeps a list (the core and the wrapper: ci/mozilla-defects.json; the series:
|
||||
tools/mozilla-defects.json), a JSON array with one row per known defect. The matcher is shared: every repository reads it from the
|
||||
core's main, so the judge is never the branch being judged (the way scripts/ci_regressions.py is read).
|
||||
|
||||
THE RULE, as a question every verdict asks of every crash:
|
||||
|
||||
Does the crash match exactly an entry of ci/mozilla-defects.json (D<n>, bug, signature: process type, thread or frame, exit phase),
|
||||
and does the entry hold for the Firefox version of the engine under test?
|
||||
|
||||
A row:
|
||||
|
||||
{"id": "D<n>", "bug": "<https://bugzilla.mozilla.org/show_bug.cgi?id=N, or empty until the bug is filed>",
|
||||
"firefox": {"from": "<major.minor>", "to": "<major.minor or major.*>"},
|
||||
"signature": {"process": "<parent|tab|gpu|rdd|socket|utility|backgroundtask|...>", "phase": "startup|run|exit",
|
||||
"thread": "<thread name, optional>", "frames": ["<top frame>", "..."], "reason": "<optional>"},
|
||||
"seen": "<owner>/<repo>/actions/runs/<digits>[/job/<digits>]", "why": "<one line>"}
|
||||
|
||||
`frames` is optional: an ordered prefix of the top frames of the crashing thread. `reason` is optional: the MOZ_CRASH text, the signal or
|
||||
the NTSTATUS. A signature must declare `process`, `phase` and at least one of `thread` or `frames`. Ids are unique. `firefox` is the range
|
||||
of Firefox releases the row was seen on and still holds for, both ends included: `from` is a major.minor, `to` is a major.minor or
|
||||
`<major>.*` (every minor of that major). The engine under test is a version string such as 159.0 or 159.0.1; only major.minor decides.
|
||||
|
||||
The crash record `C` is the one record a judge builds from its evidence:
|
||||
|
||||
{"process": "...", "phase": "...", "thread": "...", "frames": ["<top frame first>", "..."], "reason": "..."}
|
||||
|
||||
EXACT means exactly that: every field the row's signature declares is equal to the crash's field (frames: the row's list equals the first
|
||||
len(row frames) frames of the crash, in order, so a crash with fewer frames than the row misses). No regular expression, no wildcard, no
|
||||
case folding, no substring. A field the row does not declare is not compared. A row whose range does not contain the engine cannot match.
|
||||
|
||||
ci_mozilla_defects.py check --file F --engine-version V
|
||||
the schema of every row, every id once, and every row's range contains V. A row whose range does not contain V is RED: the port
|
||||
that moved the engine to V re-justifies the row for this version (a new range and a new `seen`) or drops it.
|
||||
ci_mozilla_defects.py match --file F --engine-version V --crash C.json
|
||||
the crash record C against the rows of F that hold for V. Exit 0 and one line `MATCHED D<n> (<bug or 'not filed'>): <why>`, which
|
||||
the caller prints and counts. Exit 1 and `no known defect matches: the crash stays red` with the record printed.
|
||||
|
||||
Exit codes: 0 ok (or matched); 1 red (a problem in the file, or no match); 2 the checker cannot run (a file that cannot be read or is
|
||||
not JSON, a version that is not major.minor[.patch], a crash record that is not a record) - the caller treats 2 as red, never as a pass;
|
||||
3 usage. Every problem prints one line:
|
||||
|
||||
FAIL <where>: <what>. Fix: <how>. Rule: <the rule, short>
|
||||
|
||||
A Python API for the callers in other repositories (they import this file by path, from the core's main): `load(path)`,
|
||||
`problems(rows, version, name=...)`, `match(rows, version, crash) -> row | None` and
|
||||
`verdict(rows, version, crashes, measurements_complete) -> (red, lines)`. `load` and the version parsing raise `CannotRun`.
|
||||
|
||||
THE VERDICT RULE (`verdict`). A match excuses ONLY the crash itself. The test's own assertions still have to pass, and every measurement
|
||||
must be present, compared and equal; a crash that cost a measurement (a visit that has no result, a dump that was not written) stays red
|
||||
as a missing result, even when the defect matched. So the verdict is RED when any crash has no match; RED when `measurements_complete`
|
||||
is False (even if every crash matched: the line names the defect that matched and says what is missing is the caller's to print); RED
|
||||
when the file has any problem (including a range that does not contain the engine). Otherwise it is not red and has one line per matched
|
||||
crash, naming its D<n>. Never a skip, never a threshold, never a rerun.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import argparse
|
||||
import json
|
||||
import re
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
RULE = ("Does the crash match exactly an entry of ci/mozilla-defects.json (D<n>, bug, signature: process type, thread or frame, "
|
||||
"exit phase), and does the entry hold for the Firefox version of the engine under test?")
|
||||
SHORT_RULE = "known Mozilla defect, exact match and range (ci/mozilla-defects.json)"
|
||||
DEFAULT_NAME = "ci/mozilla-defects.json"
|
||||
|
||||
PHASES = ("startup", "run", "exit")
|
||||
ROW_KEYS = {"id", "bug", "firefox", "signature", "seen", "why"}
|
||||
SIGNATURE_KEYS = {"process", "phase", "thread", "frames", "reason"}
|
||||
CRASH_KEYS = {"process", "phase", "thread", "frames", "reason"}
|
||||
_ID = re.compile(r"^D\d+$")
|
||||
_BUG = re.compile(r"^https://bugzilla\.mozilla\.org/show_bug\.cgi\?id=\d+$")
|
||||
_RUN = re.compile(r"^[\w.-]+/[\w.-]+/actions/runs/\d+(/job/\d+)?$")
|
||||
_VERSION = re.compile(r"^(\d+)\.(\d+)(\.\d+)*$")
|
||||
_FROM = re.compile(r"^(\d+)\.(\d+)$")
|
||||
_TO = re.compile(r"^(\d+)\.(\d+|\*)$")
|
||||
_ANY_MINOR = 10 ** 9
|
||||
|
||||
|
||||
class CannotRun(Exception):
|
||||
"""The checker cannot run (exit 2): unreadable file, not JSON, a bad version string or a bad crash record."""
|
||||
|
||||
|
||||
def _line(where: str, what: str, fix: str) -> str:
|
||||
return "FAIL %s: %s. Fix: %s. Rule: %s" % (where, what, fix, SHORT_RULE)
|
||||
|
||||
|
||||
def _text(value: object) -> bool:
|
||||
return isinstance(value, str) and bool(value.strip()) and "\n" not in value
|
||||
|
||||
|
||||
def parse_version(version: object) -> tuple[int, int]:
|
||||
"""major.minor of an engine version such as 159.0 or 159.0.1; CannotRun for anything else."""
|
||||
m = _VERSION.match(version) if isinstance(version, str) else None
|
||||
if not m:
|
||||
raise CannotRun("the engine version %r is not major.minor[.patch] (such as 159.0 or 159.0.1)" % (version,))
|
||||
return int(m.group(1)), int(m.group(2))
|
||||
|
||||
|
||||
def load(path: "str | Path") -> list:
|
||||
"""The rows of a defects file; CannotRun when it cannot be read or is not JSON. Not being an array is a schema problem, not here."""
|
||||
try:
|
||||
raw = Path(path).read_bytes()
|
||||
except OSError as exc:
|
||||
raise CannotRun("the file %s cannot be read (%s)" % (path, exc)) from exc
|
||||
try:
|
||||
return json.loads(raw.decode("utf-8"))
|
||||
except (UnicodeDecodeError, ValueError) as exc:
|
||||
raise CannotRun("the file %s is not JSON (%s)" % (path, exc)) from exc
|
||||
|
||||
|
||||
def _range(row: object) -> "tuple[tuple[int, int], tuple[int, int]] | None":
|
||||
"""((from major, minor), (to major, minor or _ANY_MINOR)) of a well-formed range, else None."""
|
||||
rng = row.get("firefox") if isinstance(row, dict) else None
|
||||
if not isinstance(rng, dict):
|
||||
return None
|
||||
lo, hi = rng.get("from"), rng.get("to")
|
||||
ml = _FROM.match(lo) if isinstance(lo, str) else None
|
||||
mh = _TO.match(hi) if isinstance(hi, str) else None
|
||||
if not ml or not mh:
|
||||
return None
|
||||
low = (int(ml.group(1)), int(ml.group(2)))
|
||||
high = (int(mh.group(1)), _ANY_MINOR if mh.group(2) == "*" else int(mh.group(2)))
|
||||
return (low, high) if low <= high else None
|
||||
|
||||
|
||||
def _where(name: str, row: object, index: int) -> str:
|
||||
rid = row.get("id") if isinstance(row, dict) else None
|
||||
if isinstance(rid, str) and _ID.match(rid):
|
||||
return "%s row %s" % (name, rid)
|
||||
return "%s row #%d" % (name, index)
|
||||
|
||||
|
||||
def _row_problems(row: object, where: str) -> list[str]:
|
||||
if not isinstance(row, dict):
|
||||
return [_line(where, "the row is not an object", "write the row as a JSON object with the fields of the format")]
|
||||
out: list[str] = []
|
||||
for key in sorted(set(row) - ROW_KEYS):
|
||||
out.append(_line(where, "unknown field %r" % key, "remove it; the format has only %s" % ", ".join(sorted(ROW_KEYS))))
|
||||
for key in sorted(ROW_KEYS - set(row)):
|
||||
out.append(_line(where, "field %r is missing" % key, "add it (`bug` may be an empty string until the bug is filed)"))
|
||||
if "id" in row and not (isinstance(row["id"], str) and _ID.match(row["id"])):
|
||||
out.append(_line(where, "field 'id' is not D<n> (%r)" % (row["id"],), "write it as D followed by digits, such as D31"))
|
||||
if "bug" in row and not (row["bug"] == "" or (isinstance(row["bug"], str) and _BUG.match(row["bug"]))):
|
||||
out.append(_line(where, "field 'bug' is neither empty nor a Bugzilla URL (%r)" % (row["bug"],),
|
||||
"write https://bugzilla.mozilla.org/show_bug.cgi?id=<digits>, or an empty string until the bug is filed"))
|
||||
if "seen" in row and not (isinstance(row["seen"], str) and _RUN.match(row["seen"])):
|
||||
out.append(_line(where, "field 'seen' is not a run (%r)" % (row["seen"],),
|
||||
"write <owner>/<repo>/actions/runs/<digits>[/job/<digits>]"))
|
||||
if "why" in row and not _text(row["why"]):
|
||||
out.append(_line(where, "field 'why' is empty or not one line", "write why this crash is Mozilla's in one line"))
|
||||
if "firefox" in row and _range(row) is None:
|
||||
out.append(_line(where, "field 'firefox' is not {\"from\": \"<major.minor>\", \"to\": \"<major.minor or major.*>\"} with from <= to (%r)"
|
||||
% (row["firefox"],), "write the range of Firefox releases, both ends included, such as 159.0 to 159.*"))
|
||||
if "signature" in row:
|
||||
out.extend(_signature_problems(row["signature"], where))
|
||||
return out
|
||||
|
||||
|
||||
def _signature_problems(sig: object, where: str) -> list[str]:
|
||||
if not isinstance(sig, dict):
|
||||
return [_line(where, "field 'signature' is not an object", "write {\"process\": ..., \"phase\": ..., \"thread\": ... or \"frames\": ...}")]
|
||||
out: list[str] = []
|
||||
for key in sorted(set(sig) - SIGNATURE_KEYS):
|
||||
out.append(_line(where, "unknown signature field %r" % key,
|
||||
"remove it; a signature has only %s" % ", ".join(sorted(SIGNATURE_KEYS))))
|
||||
for key in ("process", "phase"):
|
||||
if key not in sig:
|
||||
out.append(_line(where, "signature field %r is missing" % key, "declare it: a signature names the process type and the phase"))
|
||||
if "thread" not in sig and "frames" not in sig:
|
||||
out.append(_line(where, "the signature declares neither 'thread' nor 'frames'",
|
||||
"declare the crashing thread's name or the top frames (an ordered prefix): the process and the phase alone match too much"))
|
||||
if "process" in sig and not _text(sig["process"]):
|
||||
out.append(_line(where, "signature field 'process' is empty or not one line", "write the process type, such as parent or gpu"))
|
||||
if "phase" in sig and sig["phase"] not in PHASES:
|
||||
out.append(_line(where, "signature field 'phase' is %r" % (sig["phase"],), "use one of %s" % ", ".join(PHASES)))
|
||||
for key in ("thread", "reason"):
|
||||
if key in sig and not _text(sig[key]):
|
||||
out.append(_line(where, "signature field %r is empty or not one line" % key, "write the exact text, or remove the field"))
|
||||
if "frames" in sig and not (isinstance(sig["frames"], list) and sig["frames"] and all(_text(f) for f in sig["frames"])):
|
||||
out.append(_line(where, "signature field 'frames' is not a non-empty list of frame names",
|
||||
"write the top frames of the crashing thread, top first, one string each"))
|
||||
return out
|
||||
|
||||
|
||||
def problems(rows: object, version: str, name: str = DEFAULT_NAME) -> list[str]:
|
||||
"""Every problem of the file for the engine `version`: schema, duplicate ids, and a range that does not contain the engine."""
|
||||
ver = parse_version(version)
|
||||
if not isinstance(rows, list):
|
||||
return [_line(name, "the file is not a JSON array of rows", "write the file as an array, [] when no defect is known")]
|
||||
out: list[str] = []
|
||||
seen_ids: dict[str, int] = {}
|
||||
for index, row in enumerate(rows):
|
||||
where = _where(name, row, index)
|
||||
out.extend(_row_problems(row, where))
|
||||
rid = row.get("id") if isinstance(row, dict) else None
|
||||
if isinstance(rid, str) and _ID.match(rid):
|
||||
if rid in seen_ids:
|
||||
out.append(_line(where, "the id %s is also row #%d" % (rid, seen_ids[rid]),
|
||||
"give every defect its own D<n>; one row per defect"))
|
||||
else:
|
||||
seen_ids[rid] = index
|
||||
rng = _range(row)
|
||||
if rng is not None and not rng[0] <= ver <= rng[1]:
|
||||
out.append(_line(where, "its range %s to %s does not contain the engine under test (%s)"
|
||||
% (row["firefox"]["from"], row["firefox"]["to"], version),
|
||||
"the port re-justifies the row for this version (a new range and a new `seen`) or drops it"))
|
||||
return out
|
||||
|
||||
|
||||
def _crash_problem(crash: object) -> "str | None":
|
||||
if not isinstance(crash, dict):
|
||||
return "the crash record is not an object"
|
||||
extra = sorted(set(crash) - CRASH_KEYS)
|
||||
if extra:
|
||||
return "the crash record has unknown fields %s" % ", ".join(extra)
|
||||
for key in ("process", "phase"):
|
||||
if not isinstance(crash.get(key), str):
|
||||
return "the crash record has no string %r" % key
|
||||
for key in ("thread", "reason"):
|
||||
if key in crash and not isinstance(crash[key], str):
|
||||
return "the crash record field %r is not a string" % key
|
||||
frames = crash.get("frames", [])
|
||||
if not (isinstance(frames, list) and all(isinstance(f, str) for f in frames)):
|
||||
return "the crash record field 'frames' is not a list of strings"
|
||||
return None
|
||||
|
||||
|
||||
def _equal(row: dict, crash: dict) -> bool:
|
||||
sig = row["signature"]
|
||||
for key in ("process", "phase", "thread", "reason"):
|
||||
if key in sig and sig[key] != crash.get(key):
|
||||
return False
|
||||
if "frames" in sig:
|
||||
frames = crash.get("frames", [])
|
||||
if frames[:len(sig["frames"])] != sig["frames"]:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
def match(rows: object, version: str, crash: object) -> "dict | None":
|
||||
"""The first row that holds for `version` and whose signature equals the crash field by field; None otherwise. CannotRun on a bad record."""
|
||||
ver = parse_version(version)
|
||||
bad = _crash_problem(crash)
|
||||
if bad:
|
||||
raise CannotRun(bad)
|
||||
if not isinstance(rows, list):
|
||||
return None
|
||||
for row in rows:
|
||||
if not isinstance(row, dict) or _row_problems(row, "x"):
|
||||
continue # a malformed row never matches; `problems` is what says so
|
||||
rng = _range(row)
|
||||
if rng is None or not rng[0] <= ver <= rng[1]:
|
||||
continue
|
||||
if _equal(row, crash):
|
||||
return row
|
||||
return None
|
||||
|
||||
|
||||
def _matched_line(row: dict) -> str:
|
||||
return "MATCHED %s (%s): %s" % (row["id"], row["bug"] or "not filed", row["why"])
|
||||
|
||||
|
||||
def verdict(rows: object, version: str, crashes: list, measurements_complete: bool,
|
||||
name: str = DEFAULT_NAME) -> "tuple[bool, list[str]]":
|
||||
"""(red, lines) of a test that met `crashes` (the crash records it found, possibly none).
|
||||
|
||||
A match excuses only the crash itself. Red when any crash has no match; red when `measurements_complete` is False even if every crash
|
||||
matched; red when the file has any problem. Otherwise not red, with one MATCHED line per matched crash. No skip, no threshold, no rerun."""
|
||||
lines = problems(rows, version, name)
|
||||
red = bool(lines)
|
||||
matched: list[dict] = []
|
||||
for index, crash in enumerate(crashes):
|
||||
where = "crash #%d" % index
|
||||
try:
|
||||
row = match(rows, version, crash)
|
||||
except CannotRun as exc:
|
||||
lines.append(_line(where, "%s" % exc, "build the record {process, phase, thread, frames, reason} from the crash evidence"))
|
||||
red = True
|
||||
continue
|
||||
if row is None:
|
||||
lines.append(_line(where, "no known defect matches: the crash stays red (%s)" % json.dumps(crash, sort_keys=True),
|
||||
"fix the product, or declare the crash as a Mozilla defect with its bug and an exact signature in %s" % name))
|
||||
red = True
|
||||
else:
|
||||
matched.append(row)
|
||||
lines.append(_matched_line(row))
|
||||
if not measurements_complete:
|
||||
red = True
|
||||
names = ", ".join(r["id"] for r in matched)
|
||||
what = ("the crash matched %s, which excuses the crash only, and a measurement is missing" % names
|
||||
if matched else "a measurement is missing")
|
||||
lines.append(_line("measurements", what,
|
||||
"a missing result stays red: the test's own assertions and every measurement must still pass; the caller "
|
||||
"prints which measurement is missing"))
|
||||
return red, lines
|
||||
|
||||
|
||||
class _Parser(argparse.ArgumentParser):
|
||||
def error(self, message: str) -> None: # usage is exit 3, as the rule of exit codes says
|
||||
self.print_usage(sys.stderr)
|
||||
sys.stderr.write("%s: error: %s\n" % (self.prog, message))
|
||||
raise SystemExit(3)
|
||||
|
||||
|
||||
def _build_parser() -> argparse.ArgumentParser:
|
||||
ap = _Parser(prog="ci_mozilla_defects.py", description=__doc__.split("\n", 1)[0])
|
||||
sub = ap.add_subparsers(dest="mode", required=True, parser_class=_Parser)
|
||||
for mode in ("check", "match"):
|
||||
p = sub.add_parser(mode)
|
||||
p.add_argument("--file", required=True)
|
||||
p.add_argument("--engine-version", required=True)
|
||||
if mode == "match":
|
||||
p.add_argument("--crash", required=True)
|
||||
return ap
|
||||
|
||||
|
||||
def main(argv: "list[str] | None" = None) -> int:
|
||||
args = _build_parser().parse_args(argv)
|
||||
try:
|
||||
rows = load(args.file)
|
||||
version = args.engine_version
|
||||
parse_version(version)
|
||||
found = problems(rows, version, str(args.file))
|
||||
if args.mode == "check":
|
||||
for line in found:
|
||||
print(line)
|
||||
if found:
|
||||
return 1
|
||||
print("OK ci_mozilla_defects check: %d known defect(s), every range contains the engine %s" % (len(rows), version))
|
||||
return 0
|
||||
try:
|
||||
crash = json.loads(Path(args.crash).read_text(encoding="utf-8"))
|
||||
except (OSError, ValueError) as exc:
|
||||
raise CannotRun("the crash record %s cannot be read as JSON (%s)" % (args.crash, exc)) from exc
|
||||
row = match(rows, version, crash) if not found else None
|
||||
for line in found:
|
||||
print(line)
|
||||
if row is None:
|
||||
print("no known defect matches: the crash stays red")
|
||||
print(json.dumps(crash, sort_keys=True))
|
||||
return 1
|
||||
print(_matched_line(row))
|
||||
return 0
|
||||
except CannotRun as exc:
|
||||
print(_line("ci_mozilla_defects", "cannot run: %s" % exc,
|
||||
"give a readable JSON file, an engine version such as 159.0 and a crash record"))
|
||||
return 2
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
@@ -0,0 +1,216 @@
|
||||
[New LWP 14305]
|
||||
[New LWP 14187]
|
||||
[New LWP 14246]
|
||||
[New LWP 14202]
|
||||
[New LWP 14233]
|
||||
[New LWP 14241]
|
||||
[New LWP 14242]
|
||||
[New LWP 14244]
|
||||
[New LWP 14201]
|
||||
[New LWP 14452]
|
||||
[Thread debugging using libthread_db enabled]
|
||||
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
|
||||
Core was generated by `/tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/firefox --backg'.
|
||||
Program terminated with signal SIGSEGV, Segmentation fault.
|
||||
#0 0x00007fd9cb69ebec in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
[Current thread is 1 (Thread 0x7fd9a5b896c0 (LWP 14305))]
|
||||
|
||||
Thread 10 (Thread 0x7fd9ab6ff6c0 (LWP 14452)):
|
||||
#0 0x00007fd9cb6ecb9f in clock_nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9cb6f9ae7 in nanosleep () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#2 0x00007fd9cb72997c in usleep () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#3 0x00007fd9bca783f7 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#4 0x00007fd9cbcbc2e8 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnspr4.so
|
||||
#5 0x0000559e12f6d3d4 in ?? ()
|
||||
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 9 (Thread 0x7fd9b42ff6c0 (LWP 14201)):
|
||||
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9c0d6d7ad in g_cond_wait () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#2 0x00007fd9c0cde58b in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#3 0x00007fd9c0d43ec3 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#5 0x0000559e12f6d3d4 in ?? ()
|
||||
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 8 (Thread 0x7fd9aa6fe6c0 (LWP 14244)):
|
||||
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9c0d6e0a0 in g_cond_wait_until () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#2 0x00007fd9c0cde553 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#3 0x00007fd9c0cde6a6 in g_async_queue_timeout_pop () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#4 0x00007fd9c0d4853f in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#5 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#6 0x0000559e12f6d3d4 in ?? ()
|
||||
#7 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#8 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 7 (Thread 0x7fd9ab9be6c0 (LWP 14242)):
|
||||
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9ba2d2525 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#2 0x00007fd9b968aef2 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#3 0x00007fd9b9688973 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#4 0x00007fd9b96887ee in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#5 0x00007fd9b9688450 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#6 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#7 0x0000559e12f6d3d4 in ?? ()
|
||||
#8 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#9 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 6 (Thread 0x7fd9ab9ff6c0 (LWP 14241)):
|
||||
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9ba2d2525 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#2 0x00007fd9b968aef2 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#3 0x00007fd9b9688973 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#4 0x00007fd9b96887ee in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#5 0x00007fd9b9688450 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#6 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#7 0x0000559e12f6d3d4 in ?? ()
|
||||
#8 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#9 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 5 (Thread 0x7fd9b22fd6c0 (LWP 14233)):
|
||||
#0 0x00007fd9cb7274ed in syscall () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9b9698227 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#2 0x00007fd9ba4cff9a in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#3 0x00007fd9b96923e7 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#4 0x00007fd9b96883a4 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#5 0x00007fd9ba6286af in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#6 0x0000559e12f6d3d4 in ?? ()
|
||||
#7 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#8 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 4 (Thread 0x7fd9b32fe6c0 (LWP 14202)):
|
||||
#0 0x00007fd9cb71b75d in poll () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9c0d73b4e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#2 0x00007fd9c0d13ad3 in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#3 0x00007fd9c0d13b29 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#5 0x0000559e12f6d3d4 in ?? ()
|
||||
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 3 (Thread 0x7fd9a96fd6c0 (LWP 14246)):
|
||||
#0 0x00007fd9cb71b75d in poll () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9c0d73b4e in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#2 0x00007fd9c0d14ff7 in g_main_loop_run () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#3 0x00007fd9c0c016c2 in ?? () from /lib/x86_64-linux-gnu/libgio-2.0.so.0
|
||||
#4 0x00007fd9c0d430e2 in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
#5 0x0000559e12f6d3d4 in ?? ()
|
||||
#6 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#7 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
|
||||
Thread 2 (Thread 0x7fd9cbccdbc0 (LWP 14187)):
|
||||
#0 0x00007fd9c04012fc in ?? () from /lib/x86_64-linux-gnu/libz.so.1
|
||||
#1 0x00007fffa5a6b3d0 in ?? ()
|
||||
Backtrace stopped: previous frame identical to this frame (corrupt stack?)
|
||||
|
||||
Thread 1 (Thread 0x7fd9a5b896c0 (LWP 14305)):
|
||||
#0 0x00007fd9cb69ebec in pthread_kill () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#1 0x00007fd9cb64527e in raise () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#2 0x00007fd9bc1c2f71 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#3 <signal handler called>
|
||||
#4 0x0000559e12fc4d26 in mozilla::detail::MutexImpl::lock() ()
|
||||
#5 0x00007fd9b98cc564 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#6 0x00007fd9b9a54b99 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#7 0x00007fd9b98cae67 in ?? () from /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
#8 0x0000559e12f6d3d4 in ?? ()
|
||||
#9 0x00007fd9cb69cb64 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
#10 0x00007fd9cb729e8c in ?? () from /lib/x86_64-linux-gnu/libc.so.6
|
||||
0x559e12f3ccce: "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"
|
||||
From To Syms Read Shared Object Library
|
||||
0x00007fd9cbd05040 0x00007fd9cbd05105 Yes (*) /lib/x86_64-linux-gnu/libdl.so.2
|
||||
0x00007fd9cbaa55c0 0x00007fd9cbbe4ce2 Yes (*) /lib/x86_64-linux-gnu/libstdc++.so.6
|
||||
0x00007fd9cb927420 0x00007fd9cb9a53a6 Yes (*) /lib/x86_64-linux-gnu/libm.so.6
|
||||
0x00007fd9cbcda780 0x00007fd9cbcfd745 Yes (*) /lib/x86_64-linux-gnu/libgcc_s.so.1
|
||||
0x00007fd9cbcd2040 0x00007fd9cbcd2105 Yes (*) /lib/x86_64-linux-gnu/libpthread.so.0
|
||||
0x00007fd9cb628800 0x00007fd9cb7b0039 Yes (*) /lib/x86_64-linux-gnu/libc.so.6
|
||||
0x00007fd9cbd1f000 0x00007fd9cbd49175 Yes (*) /lib64/ld-linux-x86-64.so.2
|
||||
0x00007fd9cbca01f0 0x00007fd9cbcc3b5b Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnspr4.so
|
||||
0x00007fd9cbd0fd70 0x00007fd9cbd1136a Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libplc4.so
|
||||
0x00007fd9cbc8a5b0 0x00007fd9cbc8b4b8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libplds4.so
|
||||
0x00007fd9cb8ed3d0 0x00007fd9cb9139c6 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozsandbox.so
|
||||
0x00007fd9cbc84080 0x00007fd9cbc842b1 Yes (*) /lib/x86_64-linux-gnu/librt.so.1
|
||||
0x00007fd9c19ec7f0 0x00007fd9c20db8c5 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libgkcodecs.so
|
||||
0x00007fd9cb8c73e0 0x00007fd9cb8dcb05 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/liblgpllibs.so
|
||||
0x00007fd9cb89ab70 0x00007fd9cb8b0ffc Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnssutil3.so
|
||||
0x00007fd9cb46e2a0 0x00007fd9cb4f510b Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libnss3.so
|
||||
0x00007fd9cb868570 0x00007fd9cb8820b8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libsmime3.so
|
||||
0x00007fd9c218a6e0 0x00007fd9c22f59d4 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozsqlite3.so
|
||||
0x00007fd9c17a3760 0x00007fd9c17f6ff8 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libssl3.so
|
||||
0x00007fd9cbd0a6e0 0x00007fd9cbd0a7b3 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozgtk.so
|
||||
0x00007fd9c0e94a40 0x00007fd9c1230a2c Yes (*) /lib/x86_64-linux-gnu/libgtk-3.so.0
|
||||
0x00007fd9c16b9320 0x00007fd9c1736cf5 Yes (*) /lib/x86_64-linux-gnu/libgdk-3.so.0
|
||||
0x00007fd9cb849500 0x00007fd9cb84a5d2 Yes (*) /lib/x86_64-linux-gnu/libgmodule-2.0.so.0
|
||||
0x00007fd9c0cd6e90 0x00007fd9c0d74842 Yes (*) /lib/x86_64-linux-gnu/libglib-2.0.so.0
|
||||
0x00007fd9c1636110 0x00007fd9c166b3d0 Yes (*) /lib/x86_64-linux-gnu/libgobject-2.0.so.0
|
||||
0x00007fd9c0b277e0 0x00007fd9c0c36b86 Yes (*) /lib/x86_64-linux-gnu/libgio-2.0.so.0
|
||||
0x00007fd9cb83c680 0x00007fd9cb8427f4 Yes (*) /lib/x86_64-linux-gnu/libpangocairo-1.0.so.0
|
||||
0x00007fd9c0a912d0 0x00007fd9c0ac7f97 Yes (*) /lib/x86_64-linux-gnu/libpango-1.0.so.0
|
||||
0x00007fd9c097ae90 0x00007fd9c0a471e2 Yes (*) /lib/x86_64-linux-gnu/libharfbuzz.so.0
|
||||
0x00007fd9c0841f60 0x00007fd9c092f9af Yes (*) /lib/x86_64-linux-gnu/libcairo.so.2
|
||||
0x00007fd9cb8253e0 0x00007fd9cb82f677 Yes (*) /lib/x86_64-linux-gnu/libpangoft2-1.0.so.0
|
||||
0x00007fd9c15ddf90 0x00007fd9c160b2ee Yes (*) /lib/x86_64-linux-gnu/libfontconfig.so.1
|
||||
0x00007fd9cb416100 0x00007fd9cb4190b7 Yes (*) /lib/x86_64-linux-gnu/libfribidi.so.0
|
||||
0x00007fd9cb40c100 0x00007fd9cb40d5ba Yes (*) /lib/x86_64-linux-gnu/libcairo-gobject.so.2
|
||||
0x00007fd9c21300a0 0x00007fd9c21489bd Yes (*) /lib/x86_64-linux-gnu/libgdk_pixbuf-2.0.so.0
|
||||
0x00007fd9c080cd40 0x00007fd9c081b430 Yes (*) /lib/x86_64-linux-gnu/libatk-1.0.so.0
|
||||
0x00007fd9c073e240 0x00007fd9c07a3ca1 Yes (*) /lib/x86_64-linux-gnu/libepoxy.so.0
|
||||
0x00007fd9c06ce4a0 0x00007fd9c06d9e09 Yes (*) /lib/x86_64-linux-gnu/libXi.so.6
|
||||
0x00007fd9c05a7100 0x00007fd9c063610e Yes (*) /lib/x86_64-linux-gnu/libX11.so.6
|
||||
0x00007fd9c05600e0 0x00007fd9c0576cc2 Yes (*) /lib/x86_64-linux-gnu/libatk-bridge-2.0.so.0
|
||||
0x00007fd9cb815300 0x00007fd9cb817a4a Yes (*) /lib/x86_64-linux-gnu/libXfixes.so.3
|
||||
0x00007fd9c050d5a0 0x00007fd9c052c672 Yes (*) /lib/x86_64-linux-gnu/libxkbcommon.so.0
|
||||
0x00007fd9c04fd580 0x00007fd9c0502b84 Yes (*) /lib/x86_64-linux-gnu/libwayland-client.so.0
|
||||
0x00007fd9c04f04a0 0x00007fd9c04f1d8b Yes (*) /lib/x86_64-linux-gnu/libwayland-cursor.so.0
|
||||
0x00007fd9cbc7f080 0x00007fd9cbc7f249 Yes (*) /lib/x86_64-linux-gnu/libwayland-egl.so.1
|
||||
0x00007fd9c04de600 0x00007fd9c04e8bce Yes (*) /lib/x86_64-linux-gnu/libXext.so.6
|
||||
0x00007fd9c04d0660 0x00007fd9c04d55ec Yes (*) /lib/x86_64-linux-gnu/libXcursor.so.1
|
||||
0x00007fd9cb4041a0 0x00007fd9cb404b59 Yes (*) /lib/x86_64-linux-gnu/libXdamage.so.1
|
||||
0x00007fd9c2122140 0x00007fd9c2122b8b Yes (*) /lib/x86_64-linux-gnu/libXcomposite.so.1
|
||||
0x00007fd9c04c33a0 0x00007fd9c04c9ee9 Yes (*) /lib/x86_64-linux-gnu/libXrandr.so.2
|
||||
0x00007fd9c15d11a0 0x00007fd9c15d1b0e Yes (*) /lib/x86_64-linux-gnu/libXinerama.so.1
|
||||
0x00007fd9c0429300 0x00007fd9c04963b0 Yes (*) /lib/x86_64-linux-gnu/libpcre2-8.so.0
|
||||
0x00007fd9c041d460 0x00007fd9c042307a Yes (*) /lib/x86_64-linux-gnu/libffi.so.8
|
||||
0x00007fd9c0401260 0x00007fd9c0412c80 Yes (*) /lib/x86_64-linux-gnu/libz.so.1
|
||||
0x00007fd9c03bc3a0 0x00007fd9c03ee4fc Yes (*) /lib/x86_64-linux-gnu/libmount.so.1
|
||||
0x00007fd9c038c040 0x00007fd9c03a75bc Yes (*) /lib/x86_64-linux-gnu/libselinux.so.1
|
||||
0x00007fd9c037c340 0x00007fd9c037fd97 Yes (*) /lib/x86_64-linux-gnu/libthai.so.0
|
||||
0x00007fd9c02bb7f0 0x00007fd9c034b6ca Yes (*) /lib/x86_64-linux-gnu/libfreetype.so.6
|
||||
0x00007fd9c028b240 0x00007fd9c02a7f89 Yes (*) /lib/x86_64-linux-gnu/libgraphite2.so.3
|
||||
0x00007fd9c0255510 0x00007fd9c027ccf8 Yes (*) /lib/x86_64-linux-gnu/libpng16.so.16
|
||||
0x00007fd9c0246440 0x00007fd9c024c787 Yes (*) /lib/x86_64-linux-gnu/libXrender.so.1
|
||||
0x00007fd9c0226660 0x00007fd9c0238ebe Yes (*) /lib/x86_64-linux-gnu/libxcb.so.1
|
||||
0x00007fd9c0211120 0x00007fd9c0215ccb Yes (*) /lib/x86_64-linux-gnu/libxcb-render.so.0
|
||||
0x00007fd9c02080e0 0x00007fd9c0208b07 Yes (*) /lib/x86_64-linux-gnu/libxcb-shm.so.0
|
||||
0x00007fd9c0162300 0x00007fd9c01ee85e Yes (*) /lib/x86_64-linux-gnu/libpixman-1.so.0
|
||||
0x00007fd9c012e210 0x00007fd9c014c473 Yes (*) /lib/x86_64-linux-gnu/libexpat.so.1
|
||||
0x00007fd9c00ab580 0x00007fd9c00f7720 Yes (*) /lib/x86_64-linux-gnu/libjpeg.so.8
|
||||
0x00007fd9c007ef80 0x00007fd9c009563d Yes (*) /lib/x86_64-linux-gnu/libatspi.so.0
|
||||
0x00007fd9c002af10 0x00007fd9c00597bb Yes (*) /lib/x86_64-linux-gnu/libdbus-1.so.3
|
||||
0x00007fd9bffead40 0x00007fd9c000d9b7 Yes (*) /lib/x86_64-linux-gnu/libblkid.so.1
|
||||
0x00007fd9bffdc240 0x00007fd9bffdf58d Yes (*) /lib/x86_64-linux-gnu/libdatrie.so.1
|
||||
0x00007fd9bffc8280 0x00007fd9bffd4ff3 Yes (*) /lib/x86_64-linux-gnu/libbz2.so.1.0
|
||||
0x00007fd9bffb91a0 0x00007fd9bffc0bca Yes (*) /lib/x86_64-linux-gnu/libbrotlidec.so.1
|
||||
0x00007fd9bffb3360 0x00007fd9bffb4042 Yes (*) /lib/x86_64-linux-gnu/libXau.so.6
|
||||
0x00007fd9bffac1a0 0x00007fd9bffada89 Yes (*) /lib/x86_64-linux-gnu/libXdmcp.so.6
|
||||
0x00007fd9bfee1e20 0x00007fd9bff6e770 Yes (*) /lib/x86_64-linux-gnu/libsystemd.so.0
|
||||
0x00007fd9bfea80a0 0x00007fd9bfea87be Yes (*) /lib/x86_64-linux-gnu/libbrotlicommon.so.1
|
||||
0x00007fd9bfe95de0 0x00007fd9bfea04f6 Yes (*) /lib/x86_64-linux-gnu/libbsd.so.0
|
||||
0x00007fd9bfe879c0 0x00007fd9bfe8c607 Yes (*) /lib/x86_64-linux-gnu/libcap.so.2
|
||||
0x00007fd9bfd4aac0 0x00007fd9bfe3e91e Yes (*) /lib/x86_64-linux-gnu/libgcrypt.so.20
|
||||
0x00007fd9bfd1c180 0x00007fd9bfd36e8c Yes (*) /lib/x86_64-linux-gnu/liblz4.so.1
|
||||
0x00007fd9bfcea400 0x00007fd9bfd0b66f Yes (*) /lib/x86_64-linux-gnu/liblzma.so.5
|
||||
0x00007fd9bfc31400 0x00007fd9bfcd77b2 Yes (*) /lib/x86_64-linux-gnu/libzstd.so.1
|
||||
0x00007fd9bfc20160 0x00007fd9bfc28a7a Yes (*) /lib/x86_64-linux-gnu/libmd.so.0
|
||||
0x00007fd9bfbfda20 0x00007fd9bfc12d72 Yes (*) /lib/x86_64-linux-gnu/libgpg-error.so.0
|
||||
0x00007fd9cb856500 0x00007fd9cb856a13 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libmozwayland.so
|
||||
0x00007fd9b7776980 0x00007fd9bf392d25 Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libxul.so
|
||||
0x00007fd9bfbdf6e0 0x00007fd9bfbe7f19 Yes (*) /lib/x86_64-linux-gnu/libresolv.so.2
|
||||
0x00007fd9bfafd500 0x00007fd9bfb9b0f8 Yes (*) /lib/x86_64-linux-gnu/libasound.so.2
|
||||
0x00007fd9cb84f040 0x00007fd9cb84f11f Yes (*) /lib/x86_64-linux-gnu/libX11-xcb.so.1
|
||||
0x00007fd9a5c78640 0x00007fd9a5dbc1fd Yes (*) /tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/libfreeblpriv3.so
|
||||
(*): Shared library is missing debugging information.
|
||||
|
||||
warning: Can't open file /memfd:mozilla-ipc (deleted) during file-backed mapping note processing
|
||||
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"gdb-core.FSBroker14298.14187.1796087906.txt": {
|
||||
"source": "run 46539190316 of oss-invisible/firefox_antidetect_patch, job 142310624770 (wrapper.e2e.ab_oracle), crash/firefox-70-again/09-63-1.5-ab-visit/",
|
||||
"sha256": "a84ad75b5688dd306aed1d4a059d4a51a1117e8497cff0a061090373fab95b08"
|
||||
},
|
||||
"ci_mozilla_defects.py.txt": {
|
||||
"source": "oss-invisible/core scripts/ci_mozilla_defects.py",
|
||||
"core_main_sha": "882eed52ae1776c570053eb772c068206207cac8",
|
||||
"last_commit": "3946b2679d3faee0c6b748d9d941db69945bcada",
|
||||
"sha256": "256908b42bb7ccdfa119eb3d5b57b4ee0c6747fcc646f14dd6f09f0c5af3a98d"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,199 @@
|
||||
"""A popup opened from a maximized main window reads the sizes retail Firefox reads, at every declared scale.
|
||||
|
||||
What it fixes: ``window.open(url, '', features)`` from a window the browser has stored as maximized. The size a popup gets depends on the feature string: a
|
||||
``width`` and a ``height`` give the content size asked for; a popup that names no size (``popup``) or only one of the two takes the rest from the main window (its
|
||||
content area, less the popup's own frame); the screen and the scale decide the numbers. The expectations are retail Firefox 159 on Windows, measured, with a
|
||||
maximized main window whose state the browser has stored, per display case: scale 1.0, 1.25 and 1.5 on a 1920x1080 panel and scale 2.0 on a 1600x1200 one (device
|
||||
pixels), the four cases of ``_window_origin.CASES``.
|
||||
|
||||
Each popup reads its own window twice: in its first inline script (the moment a page's first script can look) and at ``load``. Both readings are asserted, one test
|
||||
function per feature string, each in a fresh browser and page with ONE popup per case:
|
||||
|
||||
* ``width=500,height=400``: inner 500x400 at every scale; outer 516x480, 514x478, 514x478, 513x476; ``visualViewport.height`` 399.5 at 2.0 and 400 elsewhere.
|
||||
* ``popup``: inner 1920x968, 1536x752, 1280x609, 800x489; outer 1936x1048, 1550x830, 1295x687, 813x565; ``visualViewport.height`` 968, 752, 608.67, 488.5.
|
||||
* ``width=500``: inner 500x856, 500x662, 501x533, 500x428.
|
||||
* ``height=400``: inner 1280x400, 1280x401, 1153x400, 720x400.
|
||||
* ``width=300,height=200``: 300x200 at every scale.
|
||||
* ``width=800,height=600``: 800x600, 800x600, 800x594, 787x476.
|
||||
|
||||
A popup that names a position and no size (``left=100,top=100``, ``left=5000,top=5000``) opens normal, not maximized, at the size the main window stored, at the page's
|
||||
position kept inside the work area (retail Firefox 159 on Windows, measured, the same main window): inner, outer and ``screenX``/``screenY`` are asserted.
|
||||
|
||||
* ``left=100,top=100``: inner 1280x856, 1280x662, 1153x533, 720x428; outer 1296x936, 1294x741, 1168x611, 733x504; screen 100,96, 100,75, 100,61, 67,48.
|
||||
* ``left=5000,top=5000``: the same sizes, moved to the right edge, the same top: screen 624,96, 242,75, 112,61, 67,48.
|
||||
|
||||
Also read, and named in the failure message but not asserted (no retail value was measured for them): ``visualViewport.width``, and ``screenX``, ``screenY`` for the
|
||||
feature strings that name no position. ``devicePixelRatio`` is asserted equal to the case's scale.
|
||||
|
||||
Why a page reads it: the size of a popup it opened, and the outer size around it, are one line of script; a popup whose sizes are the host window manager's is a
|
||||
browser that does not run on Windows. Linux and Windows run the same assertions: the declaration, not the host, is what is read.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Dict, Optional, Tuple
|
||||
|
||||
import pytest
|
||||
from _fission_frames import Sites
|
||||
from _window_origin import CASES, DEADLINE_S, launch_case, settled, wait_for
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
#: The four cases in the order of their scale: 1.0, 1.25, 1.5, 2.0 (the keys of ``_window_origin.CASES``, in the order of the numbers below).
|
||||
ORDER = ["1920x1080-dpr1.0", "1920x1080-dpr1.25", "1920x1080-dpr1.5", "1600x1200-dpr2.0"]
|
||||
|
||||
#: The button that opens the popup: ``position:fixed`` at (20, 20), 160x40 CSS pixels; its centre is the point of the real click.
|
||||
OPEN = (100, 40)
|
||||
|
||||
TOP = """<!doctype html><meta charset=utf-8><title>main</title>
|
||||
<style>html,body{margin:0;padding:0;height:100%}
|
||||
#open{position:fixed;left:20px;top:20px;width:160px;height:40px;margin:0}</style>
|
||||
<body><button id=open>popup</button><script>
|
||||
document.getElementById('open').addEventListener('click', () => { window.open(window.__popupUrl, '', window.__popupFeatures); });
|
||||
</script>"""
|
||||
|
||||
#: The first inline script records the window as it is when the script runs; the load listener records it again at ``load``.
|
||||
POPUP = """<!doctype html><meta charset=utf-8><title>popup</title><body style=margin:0>x<script>
|
||||
function read() {
|
||||
return {iw: innerWidth, ih: innerHeight, ow: outerWidth, oh: outerHeight, vw: visualViewport.width, vh: visualViewport.height,
|
||||
dpr: devicePixelRatio, sx: screenX, sy: screenY};
|
||||
}
|
||||
window.__first = read();
|
||||
window.addEventListener('load', () => { window.__load = read(); });
|
||||
</script>"""
|
||||
|
||||
READ = "() => ({first: window.__first, load: window.__load || null})"
|
||||
|
||||
#: case -> (inner, outer or None, visualViewport.height or None): retail's numbers; None where retail was not measured for the feature string.
|
||||
Row = Tuple[Tuple[int, int], Optional[Tuple[int, int]], Optional[float]]
|
||||
|
||||
|
||||
def _table(*rows: Row) -> Dict[str, Row]:
|
||||
return dict(zip(ORDER, rows))
|
||||
|
||||
|
||||
SIZED = _table(((500, 400), (516, 480), 400), ((500, 400), (514, 478), 400), ((500, 400), (514, 478), 400), ((500, 400), (513, 476), 399.5))
|
||||
POPUP_ONLY = _table(((1920, 968), (1936, 1048), 968), ((1536, 752), (1550, 830), 752), ((1280, 609), (1295, 687), 608.67), ((800, 489), (813, 565), 488.5))
|
||||
WIDTH_ONLY = _table(((500, 856), None, None), ((500, 662), None, None), ((501, 533), None, None), ((500, 428), None, None))
|
||||
HEIGHT_ONLY = _table(((1280, 400), None, None), ((1280, 401), None, None), ((1153, 400), None, None), ((720, 400), None, None))
|
||||
SMALL = _table(((300, 200), None, None), ((300, 200), None, None), ((300, 200), None, None), ((300, 200), None, None))
|
||||
MEDIUM = _table(((800, 600), None, None), ((800, 600), None, None), ((800, 594), None, None), ((787, 476), None, None))
|
||||
|
||||
|
||||
def _read_popup(firefox_binary: str, case: str, features: str, viewport: Optional[Dict[str, int]] = None) -> Dict[str, Any]:
|
||||
"""One popup of ``features`` from a real click on a fresh page, read in its first script and at load (the load reading after two equal looks).
|
||||
|
||||
``viewport`` is the one the user gives ``new_page``; without it the page takes the viewport the core declares for the main window."""
|
||||
with Sites() as sites:
|
||||
sites.route("A", "/page", TOP)
|
||||
sites.route("A", "/popup", POPUP)
|
||||
with launch_case(firefox_binary, case) as browser:
|
||||
page = browser.new_page(viewport=viewport) if viewport else browser.new_page()
|
||||
page.goto(sites.url("A", "/page"), wait_until="load", timeout=30000)
|
||||
page.evaluate("([url, features]) => { window.__popupUrl = url; window.__popupFeatures = features; }", [sites.url("A", "/popup"), features])
|
||||
with page.expect_popup(timeout=30000) as opened:
|
||||
page.mouse.click(*OPEN) # the client's own click: a trusted event, so window.open is allowed
|
||||
popup = opened.value
|
||||
try:
|
||||
popup.wait_for_load_state("load", timeout=30000)
|
||||
wait_for(popup, lambda: popup.evaluate(READ)["load"] is not None, DEADLINE_S)
|
||||
return settled(popup, lambda: popup.evaluate(READ))
|
||||
finally:
|
||||
popup.close()
|
||||
|
||||
|
||||
#: case -> (inner, outer, screen): retail's numbers for a popup that names a position and no size, with the screen position the page's left and top give.
|
||||
Placed = Tuple[Tuple[int, int], Tuple[int, int], Tuple[int, int]]
|
||||
|
||||
|
||||
def _placed(*rows: Placed) -> Dict[str, Placed]:
|
||||
return dict(zip(ORDER, rows))
|
||||
|
||||
|
||||
NEAR = _placed(((1280, 856), (1296, 936), (100, 96)), ((1280, 662), (1294, 741), (100, 75)), ((1153, 533), (1168, 611), (100, 61)), ((720, 428), (733, 504), (67, 48)))
|
||||
FAR = _placed(((1280, 856), (1296, 936), (624, 96)), ((1280, 662), (1294, 741), (242, 75)), ((1153, 533), (1168, 611), (112, 61)), ((720, 428), (733, 504), (67, 48)))
|
||||
|
||||
|
||||
def _check_placed(firefox_binary: str, case: str, features: str, table: Dict[str, Placed]) -> None:
|
||||
inner, outer, screen = table[case]
|
||||
reading = _read_popup(firefox_binary, case, features)
|
||||
for when in ("first", "load"):
|
||||
r = reading[when]
|
||||
label = "%s, window.open(url, '', %r), read in the %s" % (case, features, "first inline script" if when == "first" else "load event")
|
||||
assert r is not None, "%s: nothing was read" % label
|
||||
seen = "(inner %rx%r, outer %rx%r, screen %r,%r)" % (r["iw"], r["ih"], r["ow"], r["oh"], r["sx"], r["sy"])
|
||||
assert (r["iw"], r["ih"]) == inner, "%s: the popup is %rx%r inside, retail reads %rx%r %s" % (label, r["iw"], r["ih"], inner[0], inner[1], seen)
|
||||
assert (r["ow"], r["oh"]) == outer, "%s: outerWidth x outerHeight is %rx%r, retail reads %rx%r %s" % (label, r["ow"], r["oh"], outer[0], outer[1], seen)
|
||||
assert (r["sx"], r["sy"]) == screen, "%s: screenX, screenY is %r,%r, retail reads %r,%r %s" % (label, r["sx"], r["sy"], screen[0], screen[1], seen)
|
||||
|
||||
|
||||
def _check(firefox_binary: str, case: str, features: str, table: Dict[str, Row]) -> None:
|
||||
inner, outer, vv_height = table[case]
|
||||
scale = CASES[case][0]
|
||||
reading = _read_popup(firefox_binary, case, features)
|
||||
for when in ("first", "load"):
|
||||
r = reading[when]
|
||||
label = "%s, window.open(url, '', %r), read in the %s" % (case, features, "first inline script" if when == "first" else "load event")
|
||||
assert r is not None, "%s: nothing was read" % label
|
||||
seen = "(inner %rx%r, outer %rx%r, visualViewport %rx%r, devicePixelRatio %r, screen %r,%r)" % (
|
||||
r["iw"], r["ih"], r["ow"], r["oh"], r["vw"], r["vh"], r["dpr"], r["sx"], r["sy"])
|
||||
assert (r["iw"], r["ih"]) == inner, "%s: the popup is %rx%r inside, retail reads %rx%r %s" % (label, r["iw"], r["ih"], inner[0], inner[1], seen)
|
||||
assert r["dpr"] == scale, "%s: devicePixelRatio is %r, the case declares %r %s" % (label, r["dpr"], scale, seen)
|
||||
if outer is not None:
|
||||
assert (r["ow"], r["oh"]) == outer, "%s: outerWidth x outerHeight is %rx%r, retail reads %rx%r %s" % (label, r["ow"], r["oh"], outer[0], outer[1], seen)
|
||||
if vv_height is not None:
|
||||
assert r["vh"] == pytest.approx(vv_height, abs=0.01), "%s: visualViewport.height is %r, retail reads %r %s" % (label, r["vh"], vv_height, seen)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_a_width_and_a_height_reads_the_retail_sizes(firefox_binary, case):
|
||||
_check(firefox_binary, case, "width=500,height=400", SIZED)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_no_size_reads_the_retail_sizes_of_the_main_window(firefox_binary, case):
|
||||
_check(firefox_binary, case, "popup", POPUP_ONLY)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_only_a_width_reads_the_retail_height(firefox_binary, case):
|
||||
_check(firefox_binary, case, "width=500", WIDTH_ONLY)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_only_a_height_reads_the_retail_width(firefox_binary, case):
|
||||
_check(firefox_binary, case, "height=400", HEIGHT_ONLY)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_small_popup_reads_its_size_at_every_scale(firefox_binary, case):
|
||||
_check(firefox_binary, case, "width=300,height=200", SMALL)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_medium_popup_reads_the_retail_size_at_every_scale(firefox_binary, case):
|
||||
_check(firefox_binary, case, "width=800,height=600", MEDIUM)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_a_position_and_no_size_opens_normal_at_the_stored_size_where_asked(firefox_binary, case):
|
||||
_check_placed(firefox_binary, case, "left=100,top=100", NEAR)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", ORDER)
|
||||
def test_a_popup_with_a_position_far_off_screen_opens_normal_at_the_right_edge(firefox_binary, case):
|
||||
_check_placed(firefox_binary, case, "left=5000,top=5000", FAR)
|
||||
|
||||
|
||||
#: A viewport the user sets, and a popup that names no size under it: Playwright's contract, kept. The viewport is the user's choice, so it pins the popup as it
|
||||
#: pins the page, where the viewport only declared for the main window leaves the popup to its own window (the tests above).
|
||||
USER_VIEWPORT = {"width": 1000, "height": 700}
|
||||
|
||||
|
||||
def test_a_popup_with_no_size_reads_the_viewport_the_user_set(firefox_binary):
|
||||
case = ORDER[0]
|
||||
r = _read_popup(firefox_binary, case, "popup", USER_VIEWPORT)["load"]
|
||||
assert r is not None, "%s, viewport %r: nothing was read at load" % (case, USER_VIEWPORT)
|
||||
seen = "(inner %rx%r, outer %rx%r, devicePixelRatio %r)" % (r["iw"], r["ih"], r["ow"], r["oh"], r["dpr"])
|
||||
assert (r["iw"], r["ih"]) == (USER_VIEWPORT["width"], USER_VIEWPORT["height"]), (
|
||||
"%s, new_page(viewport=%r), window.open(url, '', 'popup'): the popup is %rx%r inside, as stock Playwright it reads the viewport %s" % (
|
||||
case, USER_VIEWPORT, r["iw"], r["ih"], seen))
|
||||
@@ -0,0 +1,206 @@
|
||||
"""A popup that names no size is left to its own window under the viewport the core declares, and pinned to one the user chose.
|
||||
|
||||
The core declares a viewport for the main window (`context_geometry`), and the session gives it to every context as the default of
|
||||
`new_context` / `new_page`. Pinned to it, a popup that named no size (`window.open(url, '', 'popup')`) read the cells of a TAB where a real
|
||||
Firefox reads the popup's own window. The wrapper now says, in one bit, whether the viewport of a context is only that declaration:
|
||||
|
||||
* the session marks the viewport of its defaults (`declared_viewport`); a viewport the user passes replaces it, mark included;
|
||||
* the server turns the mark into `isDeclaredDefault` of `Browser.setDefaultViewport`, and never tells it to the client;
|
||||
* a popup the engine did not pin is told no viewport (`page.viewport_size` is None, as for a page whose viewport is not emulated) and the
|
||||
wrapper reads the size of its window each time it plans inside it; a pinned one, and a tab, keep what the context says (Playwright's own
|
||||
contract).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import types
|
||||
|
||||
import pytest
|
||||
|
||||
from invisible_core.juggler.connection import EventListeners
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
from invisible_playwright._juggler.server import (DECLARED_VIEWPORT_KEY, BrowserDispatcher, PageDispatcher, Server,
|
||||
_viewport_as_told, declared_viewport)
|
||||
from _browser_census import closes_with_the_test
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
USER = {"width": 800, "height": 600}
|
||||
|
||||
|
||||
class _Connection(EventListeners):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
closes_with_the_test(self)
|
||||
self.sent = []
|
||||
|
||||
def startup_send(self, method, params=None):
|
||||
return self.send(method, params, timeout=None)
|
||||
|
||||
def send(self, method, params=None, session=None, timeout=30):
|
||||
self.sent.append((method, params))
|
||||
return {"browserContextId": "CTX"}
|
||||
|
||||
|
||||
def _default_viewport_command(options):
|
||||
conn = _Connection()
|
||||
dispatcher = BrowserDispatcher(Server(), None, conn, "151.0")
|
||||
conn.sent.clear()
|
||||
dispatcher._apply_context_options("CTX", options)
|
||||
found = [p for m, p in conn.sent if m == "Browser.setDefaultViewport"]
|
||||
assert len(found) == 1, conn.sent
|
||||
return found[0]["viewport"]
|
||||
|
||||
|
||||
class _Browser:
|
||||
"""What `_patch_new_context_defaults` wraps: it records the keywords the context is finally made with."""
|
||||
|
||||
def __init__(self):
|
||||
self.context_kwargs = []
|
||||
|
||||
def new_context(self, **kw):
|
||||
self.context_kwargs.append(kw)
|
||||
return types.SimpleNamespace(new_page=lambda **k: None, add_cookies=lambda c: None)
|
||||
|
||||
def new_page(self, **kw):
|
||||
self.context_kwargs.append(kw)
|
||||
|
||||
|
||||
def _made_with(**user):
|
||||
ip = InvisiblePlaywright(seed=42)
|
||||
browser = _Browser()
|
||||
ip._patch_new_context_defaults(browser)
|
||||
browser.new_context(**user)
|
||||
return browser.context_kwargs[0]
|
||||
|
||||
|
||||
# ── the session: the mark ────────────────────────────────────────────
|
||||
|
||||
|
||||
def test_the_default_viewport_of_the_session_is_marked_as_the_cores():
|
||||
kw = InvisiblePlaywright(seed=42)._default_context_kwargs()
|
||||
assert kw["viewport"].get(DECLARED_VIEWPORT_KEY) is True
|
||||
assert {"width", "height"} <= set(kw["viewport"])
|
||||
|
||||
|
||||
def test_a_context_that_names_no_viewport_gets_the_marked_default():
|
||||
assert _made_with()["viewport"].get(DECLARED_VIEWPORT_KEY) is True
|
||||
|
||||
|
||||
def test_a_viewport_the_user_names_is_not_marked():
|
||||
assert _made_with(viewport=USER)["viewport"] == USER
|
||||
|
||||
|
||||
# ── the server: Browser.setDefaultViewport ───────────────────────────
|
||||
|
||||
|
||||
def test_a_declared_default_reaches_the_engine_as_the_bit():
|
||||
viewport = _default_viewport_command({"viewport": declared_viewport({"width": 1920, "height": 947})})
|
||||
assert viewport["isDeclaredDefault"] is True
|
||||
assert viewport["viewportSize"] == {"width": 1920, "height": 947}
|
||||
|
||||
|
||||
def test_a_viewport_the_user_chose_reaches_the_engine_with_no_bit():
|
||||
viewport = _default_viewport_command({"viewport": USER})
|
||||
assert "isDeclaredDefault" not in viewport
|
||||
assert viewport["viewportSize"] == USER
|
||||
|
||||
|
||||
# ── the server: the size a popup is told, and the size the wrapper plans inside ──
|
||||
|
||||
|
||||
class _Injected:
|
||||
"""A page whose window can change size between two reads: `boxes` is the answer of each read in turn, the last one stays."""
|
||||
|
||||
def __init__(self, *boxes):
|
||||
self.boxes = list(boxes)
|
||||
self.asked = []
|
||||
|
||||
def evaluate(self, frame_id, expression):
|
||||
self.asked.append((frame_id, expression))
|
||||
box = self.boxes.pop(0) if len(self.boxes) > 1 else self.boxes[0]
|
||||
if isinstance(box, Exception):
|
||||
raise box
|
||||
return box
|
||||
|
||||
|
||||
POPUP = object() # any opener: the page is a popup
|
||||
WINDOW = {"width": 1920, "height": 968}
|
||||
DECLARED = declared_viewport({"width": 1920, "height": 947})
|
||||
|
||||
|
||||
def _page(context_viewport, opener, *boxes):
|
||||
"""A PageDispatcher with what `_build` sets before the hand and the initializer read it."""
|
||||
page = PageDispatcher.__new__(PageDispatcher)
|
||||
context = types.SimpleNamespace(options={"viewport": context_viewport})
|
||||
page.injected = _Injected(*(boxes or (WINDOW,)))
|
||||
page.main_frame_id = "F1"
|
||||
page.viewport_size = _viewport_as_told(context_viewport)
|
||||
page.viewport_unpinned = page._is_unpinned_popup(context, opener)
|
||||
page._last_window_size = None
|
||||
return page
|
||||
|
||||
|
||||
def test_a_popup_under_the_declared_default_is_told_no_viewport():
|
||||
page = _page(DECLARED, POPUP)
|
||||
assert page.viewport_unpinned is True
|
||||
assert page.told_viewport() is None
|
||||
|
||||
|
||||
def test_a_popup_under_a_viewport_the_user_chose_is_told_that_viewport():
|
||||
page = _page(USER, POPUP)
|
||||
assert page.viewport_unpinned is False
|
||||
assert page.told_viewport() == USER
|
||||
assert page.planning_viewport() == USER
|
||||
assert page.injected.asked == [], "a pinned popup was measured"
|
||||
|
||||
|
||||
def test_a_tab_under_the_declared_default_is_told_the_declared_viewport_and_not_measured():
|
||||
page = _page(DECLARED, None)
|
||||
assert page.viewport_unpinned is False
|
||||
assert page.told_viewport() == {"width": 1920, "height": 947}
|
||||
assert page.planning_viewport() == {"width": 1920, "height": 947}
|
||||
assert page.injected.asked == []
|
||||
|
||||
|
||||
def test_the_hand_of_an_unpinned_popup_plans_inside_the_live_size_of_its_window():
|
||||
first, second = {"width": 1920, "height": 968}, {"width": 1000, "height": 600}
|
||||
page = _page(DECLARED, POPUP, first, second)
|
||||
assert page.planning_viewport() == first
|
||||
assert page.planning_viewport() == second, "the second read answered the size of the first: the window was measured once"
|
||||
assert "innerWidth" in page.injected.asked[0][1] and page.injected.asked[0][0] == "F1"
|
||||
assert page.told_viewport() is None
|
||||
|
||||
|
||||
def test_the_pointer_of_an_unpinned_popup_reads_the_live_size_through_its_own_viewport_reader():
|
||||
from invisible_playwright._juggler.pointer import Pointer
|
||||
|
||||
first, second = {"width": 1920, "height": 968}, {"width": 800, "height": 500}
|
||||
page = _page(DECLARED, POPUP, first, second)
|
||||
pointer = Pointer.__new__(Pointer)
|
||||
pointer._viewport_of = page.planning_viewport
|
||||
assert pointer._viewport() == (1920, 968)
|
||||
assert pointer._viewport() == (800, 500)
|
||||
|
||||
|
||||
def test_a_window_that_cannot_be_read_now_keeps_the_last_size_read():
|
||||
page = _page(DECLARED, POPUP, WINDOW, RuntimeError("gone"))
|
||||
assert page.planning_viewport() == WINDOW
|
||||
assert page.planning_viewport() == WINDOW
|
||||
never = _page(DECLARED, POPUP, None)
|
||||
assert never.planning_viewport() == {"width": 1920, "height": 947}, "with no reading ever, the hand falls back to the declared default"
|
||||
|
||||
|
||||
def test_a_viewport_set_on_a_popup_pins_it():
|
||||
page = _page(DECLARED, POPUP)
|
||||
page.send = lambda *a, **k: None
|
||||
page.op_set_viewport_size({"viewportSize": USER})
|
||||
assert page.viewport_unpinned is False
|
||||
assert page.told_viewport() == USER
|
||||
assert page.planning_viewport() == USER
|
||||
|
||||
|
||||
def test_the_client_is_never_told_the_mark():
|
||||
from invisible_playwright._juggler import server
|
||||
|
||||
assert server._viewport_as_told(DECLARED) == {"width": 1920, "height": 947}
|
||||
assert server._viewport_as_told(None) is None
|
||||
@@ -0,0 +1,369 @@
|
||||
"""A press, a release or a wheel turn while a popup is open reaches the page as it does on retail Firefox 159 on Windows, in the top document and in a frame of another site.
|
||||
|
||||
THE SOURCE OF THE EXPECTATIONS is retail Firefox 159 on Windows, measured: round 9 of the retail captures (the ``rollup`` step: the real mouse of the system, a page that records every event it hears in the capture phase,
|
||||
the chrome-scope state of the popups read after each step). The records of the three display scales below are the same in every launch of the round, and the lists here are the events of those records, in the order the page heard them, with the
|
||||
id of each target and whether it was trusted. Nothing here is a number of ours.
|
||||
|
||||
WHAT THE RECORDS SHOW. On Windows a popup that is open is rolled up by the platform before the page hears anything, and a press on the anchor of an open dropdown is a press on a popup's own anchor: the platform closes the dropdown with it and the page does not
|
||||
hear that press. The rules, for a ``<select>`` of six options at (20, 20), 200 x 30, with its dropdown open:
|
||||
|
||||
* a left press on the anchor (its centre, or the last CSS pixel inside it) closes the dropdown and the page hears nothing of that press: its first events are the release's ``pointerup``, ``mouseup`` and ``click`` on the select. The dropdown stays
|
||||
closed, and the select keeps the focus;
|
||||
* a left press outside (a plain box) closes the dropdown too, and the page hears the whole click: ``pointerdown``, ``mousedown``, ``blur`` of the select, ``pointerup``, ``mouseup``, ``click`` on the box; the focus goes to the body;
|
||||
* a right press on the anchor closes the dropdown and the page hears the whole click on the select: ``pointerdown``, ``mousedown``, ``pointerup``, ``mouseup``, ``auxclick``, ``contextmenu``; the page context menu is open after it;
|
||||
* a double click on the anchor: the first press and release close the dropdown (the page hears the release), the second press is a press on a closed select and opens it again (the page hears ``pointerdown`` and ``mousedown``), and the second release,
|
||||
which the dropdown handles, reaches the page as the parent's ``mouseup`` and ``click`` on the select with no ``pointerup``; the dropdown is open at the end;
|
||||
* a press and a release at once on a closed select that has the focus (the second press of the double click above, with nothing between them): the press opens the dropdown and the page hears ``pointerdown`` and ``mousedown``; the release,
|
||||
which the dropdown handles, reaches the page as the parent's ``mouseup`` and ``click`` on the select with no ``pointerup``; the dropdown is open at the end. The release does not wait for the dropdown to be shown, so it is the one the
|
||||
engine has to hold until the dropdown has said it is open;
|
||||
* a left press on the second item of the open dropdown selects it: the page hears ``mousedown`` and ``mouseup`` on the ``option``, ``input`` and ``change`` on the select, ``click`` on the ``option``; the dropdown is closed and ``selectedIndex`` is 1;
|
||||
* a turn of the wheel over the page, over the anchor, or (with the page context menu open instead of the dropdown) over the page reaches the page as nothing at all: no event, the page does not scroll, and the popup is still open;
|
||||
* the datalist list of an ``<input>`` (open after a click and one typed letter): a press on the input reaches the page whole: ``pointerdown``, ``mousedown``, ``pointerup``, ``mouseup``, ``click`` on the input;
|
||||
* with the select in a frame of another site (an out-of-process iframe at (200, 20), the select at (20, 20) of the frame): a press on the anchor is heard by the frame as ``pointerup``, ``mouseup``, ``click`` and by the top document as nothing.
|
||||
|
||||
HOW IT IS READ. The client's own mouse (``page.mouse``) opens the popup with a real click, and the same mouse does the step. The page records ``pointerdown``, ``mousedown``, ``pointerup``, ``mouseup``, ``click``, ``dblclick``, ``auxclick``,
|
||||
``contextmenu``, ``focus``, ``blur``, ``change``, ``input``, ``wheel`` and ``scroll`` (type, target id, ``isTrusted``) in ``window.__events``. The chrome (Marionette, ``MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1``) reads the state of the dropdown, of
|
||||
the datalist list and of the page context menu. Each case waits (a condition with a deadline) until the page has heard what the record says and the popups are in the state it says, and then watches the same reading for one second (``observe``, the
|
||||
one bounded look of ``_window_origin``): it must not change, so an event or a reopening that comes after the verdict is seen. The events of the click that opened the popup are cleared first, after the page heard its release (that release is answered
|
||||
by the parent and comes to the page later). Every case runs on a fresh page, at the scales 1, 1.25 and 1.5.
|
||||
|
||||
THE POSITIVE CONTROLS. The dropdown is open (read from chrome) before every step. The second item is found from the chrome's own rectangle of the open dropdown, and its press must select it. After the wheel with a popup open, the same
|
||||
turn over the same page with the popup closed from chrome must scroll the page and be heard: the page scrolls and a ``wheel`` is recorded, so a page that does not scroll is not a page that cannot.
|
||||
|
||||
Red on an engine whose input does not roll the popups up the way the platform does (the engine of the first measurements: a press on the anchor of an open dropdown reaches the page as a ``pointerdown`` and a ``mousedown`` and the dropdown opens again).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import contextlib
|
||||
import json
|
||||
from typing import Any, Callable, Dict, Iterator, List, Tuple
|
||||
|
||||
import pytest
|
||||
from _fission_frames import Sites, frame_of
|
||||
from _stock_twin import MARIONETTE_ARGS, Chrome
|
||||
from _window_origin import CASES, DEADLINE_S, launch_case, observe, wait_for
|
||||
from test_a_select_dropdown_opens_at_its_element_e2e import CLOSE_JS
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
#: The display scales of the cases: 1, 1.25 and 1.5 (the 2.0 case of ``CASES`` has its own panel and no capture of this step).
|
||||
SCALES = sorted(case for case, (scale, _panel) in CASES.items() if scale <= 1.5)
|
||||
#: How long the reading is watched once it is what the record says.
|
||||
WATCH_S = 1.0
|
||||
|
||||
#: The places on the page, CSS pixels of the viewport: the select (20, 20, 200 x 30), the input (20, 80, 200 x 30), a plain box (300, 20, 200 x 100) and a point of the page clear of all of them.
|
||||
ANCHOR_CENTRE = (120, 35)
|
||||
#: The last CSS pixel inside the anchor (the anchor ends at x = 220).
|
||||
ANCHOR_LAST_PIXEL = (219, 35)
|
||||
INPUT_CENTRE = (120, 95)
|
||||
BOX_CENTRE = (400, 70)
|
||||
PAGE_POINT = (800, 300)
|
||||
#: One notch of the wheel, downwards, as the client's ``deltaY`` (the capture's ``SendInput`` of -120 is a notch towards the user, which scrolls the page down).
|
||||
WHEEL_NOTCH = 120
|
||||
#: The select in a frame of another site: the frame is at (200, 20), the select at (20, 20) of it, 200 x 30, so its centre is at (320, 55) of the top viewport; a plain point of the top document is the box at (700, 20).
|
||||
FRAME_ANCHOR_CENTRE = (320, 55)
|
||||
|
||||
#: What every page records, in the capture phase, and what it can say about itself.
|
||||
RECORDER = """<script>
|
||||
window.__events = [];
|
||||
(function () {
|
||||
const name = n => n === window ? 'window' : n === document ? 'document' : n && n.nodeType === 1 ? (n.id || n.nodeName.toLowerCase()) : null;
|
||||
const types = ['pointerdown', 'mousedown', 'pointerup', 'mouseup', 'click', 'dblclick', 'auxclick', 'contextmenu', 'focus', 'blur', 'change', 'input', 'wheel', 'scroll'];
|
||||
for (const type of types) window.addEventListener(type, e => window.__events.push([e.type, name(e.target), e.isTrusted]), true);
|
||||
window.__reset = () => { window.__events.length = 0; };
|
||||
window.__read = () => {
|
||||
const s = document.getElementById('s');
|
||||
return {events: window.__events.slice(), active: name(document.activeElement), scrollY: window.scrollY, selectedIndex: s ? s.selectedIndex : null};
|
||||
};
|
||||
})();
|
||||
</script>"""
|
||||
|
||||
OPTIONS = "<option>one</option><option>two</option><option>three</option><option>four</option><option>five</option><option>six</option>"
|
||||
PAGE = ("<!doctype html><meta charset=utf-8><title>rollup</title>"
|
||||
"<style>html,body{margin:0;padding:0;height:3000px}"
|
||||
"#s{position:absolute;left:20px;top:20px;width:200px;height:30px}"
|
||||
"#i{position:absolute;left:20px;top:80px;width:200px;height:30px;box-sizing:border-box}"
|
||||
"#box{position:absolute;left:300px;top:20px;width:200px;height:100px;background:#bd9}</style>"
|
||||
"<body><select id=s>" + OPTIONS + "</select>"
|
||||
"<input id=i list=d><datalist id=d><option value=apple><option value=apricot><option value=avocado><option value=banana><option value=blueberry></datalist>"
|
||||
"<div id=box>box</div>" + RECORDER)
|
||||
CROSS = ("<!doctype html><meta charset=utf-8><title>rollup cross</title>"
|
||||
"<style>html,body{margin:0;padding:0;height:100%}"
|
||||
"#f{position:absolute;left:200px;top:20px;width:400px;height:300px;border:0}"
|
||||
"#top_box{position:absolute;left:700px;top:20px;width:200px;height:100px;background:#bd9}</style>"
|
||||
'<body><iframe id=f src="@FRAME@"></iframe><div id=top_box>top</div>' + RECORDER)
|
||||
FRAME = ("<!doctype html><meta charset=utf-8><title>rollup frame</title>"
|
||||
"<style>html,body{margin:0;padding:0;height:100%}#s{position:absolute;left:20px;top:20px;width:200px;height:30px}</style>"
|
||||
"<body><select id=s>" + OPTIONS + "</select>" + RECORDER)
|
||||
|
||||
#: The state of the three popups a press can roll up, read in the chrome: the dropdown of a select, the datalist's list and the page context menu (``absent`` where the element is not there).
|
||||
STATES_JS = """
|
||||
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
const doc = win.document;
|
||||
const state = e => e && typeof e.state === "string" ? e.state : "absent";
|
||||
return JSON.stringify({select: state(doc.querySelector("#ContentSelectDropdown > menupopup")), autocomplete: state(doc.getElementById("PopupAutoComplete")),
|
||||
context: state(doc.getElementById("contentAreaContextMenu"))});
|
||||
"""
|
||||
#: Closes whatever of the three is open, so the next page starts clean.
|
||||
HIDE_JS = """
|
||||
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
const doc = win.document;
|
||||
for (const popup of [doc.querySelector("#ContentSelectDropdown > menupopup"), doc.getElementById("PopupAutoComplete"), doc.getElementById("contentAreaContextMenu")]) {
|
||||
if (popup && typeof popup.hidePopup === "function" && popup.state !== "closed") popup.hidePopup();
|
||||
}
|
||||
return JSON.stringify({});
|
||||
"""
|
||||
#: The middle of item ``arguments[0]`` of the open dropdown, in the chrome's CSS pixels from the top left of the content area: the popup's screen rectangle (``getOuterScreenRect``, the unit of
|
||||
#: ``toScreenRectInCSSUnits``, as ``test_a_select_dropdown_opens_at_its_element_e2e.py`` reads them) plus the item's place in the popup, less the content area's screen origin.
|
||||
ITEM_JS = """
|
||||
const [index] = arguments;
|
||||
const win = Services.wm.getMostRecentWindow("navigator:browser");
|
||||
const popup = win.document.querySelector("#ContentSelectDropdown > menupopup");
|
||||
const items = popup.querySelectorAll("menuitem");
|
||||
if (!items[index]) return JSON.stringify({error: "the dropdown has " + items.length + " items", state: popup.state});
|
||||
const outer = popup.getOuterScreenRect(), client = popup.getBoundingClientRect(), item = items[index].getBoundingClientRect();
|
||||
const b = win.gBrowser.selectedBrowser.getBoundingClientRect();
|
||||
const origin = win.windowUtils.toScreenRectInCSSUnits(b.left, b.top, 1, 1);
|
||||
return JSON.stringify({state: popup.state, items: items.length, dpr: win.devicePixelRatio,
|
||||
x: outer.left + (item.x - client.x) + item.width / 2 - origin.left, y: outer.top + (item.y - client.y) + item.height / 2 - origin.top,
|
||||
outer: {left: outer.left, top: outer.top, width: outer.width, height: outer.height}, origin: {left: origin.left, top: origin.top}});
|
||||
"""
|
||||
|
||||
|
||||
def ev(*rows: Tuple[str, str]) -> List[List[Any]]:
|
||||
"""The events a page is expected to hear: ``(type, target id)`` each, all trusted, as ``window.__events`` holds them."""
|
||||
return [[kind, at, True] for kind, at in rows]
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _session(firefox_binary: str, monkeypatch, case: str) -> Iterator[Tuple[Any, Chrome, Sites]]:
|
||||
"""Our browser on ``case`` with the pages served, and the chrome of it: ``(browser, chrome, sites)``. The first page is kept open (the window the chrome session waits for)."""
|
||||
monkeypatch.setenv("MOZ_REMOTE_ALLOW_SYSTEM_ACCESS", "1") # the chrome-scope reads
|
||||
with Sites() as sites, launch_case(firefox_binary, case, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
|
||||
sites.route("A", "/page", PAGE)
|
||||
sites.route("A", "/cross", lambda handler: CROSS.replace("@FRAME@", sites.url("B", "/frame")))
|
||||
sites.route("B", "/frame", FRAME)
|
||||
holder = browser.new_page()
|
||||
chrome = Chrome(holder)
|
||||
try:
|
||||
yield browser, chrome, sites
|
||||
finally:
|
||||
chrome.close()
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def _fresh_page(browser: Any, chrome: Chrome, url: str) -> Iterator[Any]:
|
||||
"""A new page on ``url``, closed (with every popup of the browser) when the case is done."""
|
||||
page = browser.new_page()
|
||||
try:
|
||||
page.goto(url)
|
||||
yield page
|
||||
finally:
|
||||
chrome.script(HIDE_JS)
|
||||
page.close()
|
||||
|
||||
|
||||
def _states(chrome: Chrome) -> Dict[str, str]:
|
||||
return chrome.script(STATES_JS)
|
||||
|
||||
|
||||
def _reading(page: Any, chrome: Chrome, keys: Tuple[str, ...]) -> Dict[str, Any]:
|
||||
"""What the page and the chrome say now, reduced to ``keys`` (the page's events, active element, scrollY and selectedIndex, and the three popup states)."""
|
||||
reading = dict(page.evaluate("() => window.__read()"), **_states(chrome))
|
||||
return {key: reading[key] for key in keys}
|
||||
|
||||
|
||||
def _heard(page: Any, want_events: List[List[Any]]) -> bool:
|
||||
return page.evaluate("() => window.__read()")["events"] == want_events
|
||||
|
||||
|
||||
def _open_select(page: Any, chrome: Chrome, at: Tuple[float, float] = ANCHOR_CENTRE) -> None:
|
||||
"""Open the dropdown with a real click, wait for ``open`` in chrome and for the click's release to reach the page, then clear the page's events."""
|
||||
page.mouse.click(*at)
|
||||
assert wait_for(page, lambda: _states(chrome)["select"] == "open", DEADLINE_S), "the real click at %r did not open the dropdown (states %r)" % (at, _states(chrome))
|
||||
assert wait_for(page, lambda: any(row[0] == "click" for row in page.evaluate("() => window.__read()")["events"]), DEADLINE_S), (
|
||||
"the release of the click that opened the dropdown never reached the page (events %r)" % page.evaluate("() => window.__read()")["events"])
|
||||
page.evaluate("() => window.__reset()")
|
||||
|
||||
|
||||
def _open_context_menu(page: Any, chrome: Chrome) -> None:
|
||||
"""Open the page context menu with a real right click on the plain box, wait for ``open`` and for the page's ``contextmenu``, then clear the page's events."""
|
||||
page.mouse.click(*BOX_CENTRE, button="right")
|
||||
assert wait_for(page, lambda: _states(chrome)["context"] == "open", DEADLINE_S), "the real right click did not open the context menu (states %r)" % _states(chrome)
|
||||
assert wait_for(page, lambda: any(row[0] == "contextmenu" for row in page.evaluate("() => window.__read()")["events"]), DEADLINE_S), "the page never heard the contextmenu of the right click"
|
||||
page.evaluate("() => window.__reset()")
|
||||
|
||||
|
||||
def _settled(label: str, read: Callable[[], Dict[str, Any]], page: Any, want: Dict[str, Any]) -> str:
|
||||
"""Empty when the reading becomes ``want`` and then stays it for ``WATCH_S``; else what was seen (every distinct reading, in order). ``want`` names the keys that are read."""
|
||||
arrived = wait_for(page, lambda: read() == want, DEADLINE_S)
|
||||
looks = observe(page, read, WATCH_S)
|
||||
if arrived and looks == [want]:
|
||||
return ""
|
||||
return "%s: wanted %s, the reading %s; the distinct readings over the next %s s, in order: %s" % (
|
||||
label, json.dumps(want), "never came within %s s" % DEADLINE_S if not arrived else "came but did not stay", WATCH_S, json.dumps(looks))
|
||||
|
||||
|
||||
def _press_case(page: Any, chrome: Chrome, label: str, do: Callable[[], None], want: Dict[str, Any]) -> str:
|
||||
keys = tuple(want)
|
||||
do()
|
||||
return _settled(label, lambda: _reading(page, chrome, keys), page, want)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_on_the_anchor_of_an_open_select_is_not_heard_but_its_release_is(firefox_binary, monkeypatch, case):
|
||||
problems: List[str] = []
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
for name, point in (("the centre of the anchor", ANCHOR_CENTRE), ("the last CSS pixel inside the anchor", ANCHOR_LAST_PIXEL)):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
_open_select(page, chrome)
|
||||
want = {"events": ev(("pointerup", "s"), ("mouseup", "s"), ("click", "s")), "select": "closed", "active": "s", "selectedIndex": 0}
|
||||
problems.append(_press_case(page, chrome, "%s, %s" % (case, name), lambda: page.mouse.click(*point), want))
|
||||
assert not [p for p in problems if p], "a press on the anchor of the open dropdown did not roll it up as the platform does:\n " + "\n ".join(p for p in problems if p)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_outside_an_open_select_closes_it_and_is_heard_whole(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
_open_select(page, chrome)
|
||||
want = {"events": ev(("pointerdown", "box"), ("mousedown", "box"), ("blur", "s"), ("pointerup", "box"), ("mouseup", "box"), ("click", "box")),
|
||||
"select": "closed", "active": "body"}
|
||||
problem = _press_case(page, chrome, "%s, a press on a plain box" % case, lambda: page.mouse.click(*BOX_CENTRE), want)
|
||||
assert not problem, problem
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_right_press_on_the_anchor_of_an_open_select_closes_it_and_opens_the_context_menu(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
_open_select(page, chrome)
|
||||
want = {"events": ev(("pointerdown", "s"), ("mousedown", "s"), ("pointerup", "s"), ("mouseup", "s"), ("auxclick", "s"), ("contextmenu", "s")),
|
||||
"select": "closed", "context": "open", "active": "s"}
|
||||
problem = _press_case(page, chrome, "%s, a right click on the anchor" % case, lambda: page.mouse.click(*ANCHOR_CENTRE, button="right"), want)
|
||||
assert not problem, problem
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_double_click_on_the_anchor_of_an_open_select_closes_it_and_opens_it_again(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
_open_select(page, chrome)
|
||||
want = {"events": ev(("pointerup", "s"), ("mouseup", "s"), ("click", "s"), ("pointerdown", "s"), ("mousedown", "s"), ("mouseup", "s"), ("click", "s")),
|
||||
"select": "open", "active": "s"}
|
||||
problem = _press_case(page, chrome, "%s, a double click on the anchor" % case, lambda: page.mouse.dblclick(*ANCHOR_CENTRE), want)
|
||||
assert not problem, problem
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_and_a_release_at_once_on_a_select_reach_the_page_as_the_parents_mouseup_and_click(firefox_binary, monkeypatch, case):
|
||||
"""The press opens the dropdown and the release follows with no delay, as a script's ``click`` does: the release is the dropdown's own and the page hears the parent's ``mouseup`` and ``click`` with no ``pointerup``, as retail does for the
|
||||
release of the second press of a double click. Red on an engine that sends the release while the dropdown is still opening: the dropdown drops it, and the page hears ``pointerdown`` and ``mousedown`` and nothing after them."""
|
||||
problems: List[str] = []
|
||||
want = {"events": ev(("pointerdown", "s"), ("mousedown", "s"), ("mouseup", "s"), ("click", "s")), "select": "open", "active": "s"}
|
||||
|
||||
def zero_delay_click(page: Any) -> None:
|
||||
page.mouse.click(*ANCHOR_CENTRE, delay=0)
|
||||
|
||||
def press_then_release(page: Any) -> None:
|
||||
page.mouse.move(*ANCHOR_CENTRE)
|
||||
page.mouse.down()
|
||||
page.mouse.up()
|
||||
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
for name, step in (("click with delay 0", zero_delay_click), ("down then up", press_then_release)):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
# The select has the focus and is closed, as at the second press of the double click: nothing but the click is left to hear.
|
||||
page.evaluate("() => { document.getElementById('s').focus(); window.__reset(); }")
|
||||
assert _states(chrome)["select"] != "open", "the dropdown is open before the click: %r" % _states(chrome)
|
||||
problems.append(_press_case(page, chrome, "%s, %s on the anchor of a closed select" % (case, name), lambda step=step, page=page: step(page), want))
|
||||
assert not [p for p in problems if p], "a press and a release at once on a select did not reach the page as retail does:\n " + "\n ".join(p for p in problems if p)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_on_the_second_item_of_an_open_select_selects_it(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
_open_select(page, chrome)
|
||||
item = chrome.script(ITEM_JS, (1,))
|
||||
assert "error" not in item and item["items"] == 6, "the open dropdown did not give its second item: %r" % item
|
||||
page_scale = page.evaluate("() => window.devicePixelRatio")
|
||||
point = (item["x"] * item["dpr"] / page_scale, item["y"] * item["dpr"] / page_scale)
|
||||
want = {"events": ev(("mousedown", "option"), ("mouseup", "option"), ("input", "s"), ("change", "s"), ("click", "option")),
|
||||
"select": "closed", "selectedIndex": 1, "active": "s"}
|
||||
problem = _press_case(page, chrome, "%s, a press at %r on the second item (chrome read %r, page scale %r)" % (case, point, item, page_scale),
|
||||
lambda: page.mouse.click(*point), want)
|
||||
assert not problem, problem
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_turn_of_the_wheel_with_a_popup_open_reaches_nothing_and_closes_nothing(firefox_binary, monkeypatch, case):
|
||||
problems: List[str] = []
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
for name, popup, opening, point in (("the dropdown open, over the page", "select", _open_select, PAGE_POINT),
|
||||
("the dropdown open, over the anchor", "select", _open_select, ANCHOR_CENTRE),
|
||||
("the context menu open, over the page", "context", _open_context_menu, PAGE_POINT)):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
opening(page, chrome)
|
||||
before = page.evaluate("() => window.scrollY")
|
||||
want = {"events": [], "scrollY": before, popup: "open"}
|
||||
|
||||
def turn(point=point, page=page) -> None:
|
||||
page.mouse.move(*point)
|
||||
page.mouse.wheel(0, WHEEL_NOTCH)
|
||||
|
||||
problems.append(_press_case(page, chrome, "%s, %s" % (case, name), turn, want))
|
||||
if popup == "select":
|
||||
# The positive control: the same turn over the same page with the popup closed scrolls it and is heard, so "nothing happened" above is not a page that cannot scroll.
|
||||
chrome.script(CLOSE_JS)
|
||||
assert wait_for(page, lambda: _states(chrome)["select"] == "closed", DEADLINE_S), "the dropdown did not close from chrome: %r" % _states(chrome)
|
||||
page.evaluate("() => window.__reset()")
|
||||
page.mouse.move(*PAGE_POINT)
|
||||
page.mouse.wheel(0, WHEEL_NOTCH)
|
||||
scrolled = wait_for(page, lambda: page.evaluate("() => window.scrollY") > before and any(row[0] == "wheel" for row in page.evaluate("() => window.__read()")["events"]), DEADLINE_S)
|
||||
assert scrolled, "the control wheel turn with no popup open did not scroll the page and reach it: %r" % page.evaluate("() => window.__read()")
|
||||
assert not [p for p in problems if p], "a turn of the wheel with a popup open was not swallowed whole by the platform:\n " + "\n ".join(p for p in problems if p)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_on_the_input_of_an_open_datalist_reaches_the_page(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/page")) as page:
|
||||
page.mouse.click(*INPUT_CENTRE)
|
||||
page.keyboard.type("a")
|
||||
assert wait_for(page, lambda: _states(chrome)["autocomplete"] == "open", DEADLINE_S), "a click on the input and a typed letter did not open the datalist list (states %r)" % _states(chrome)
|
||||
page.evaluate("() => window.__reset()")
|
||||
want = {"events": ev(("pointerdown", "i"), ("mousedown", "i"), ("pointerup", "i"), ("mouseup", "i"), ("click", "i")), "active": "i"}
|
||||
problem = _press_case(page, chrome, "%s, a press on the input with the datalist open" % case, lambda: page.mouse.click(*INPUT_CENTRE), want)
|
||||
assert not problem, problem
|
||||
|
||||
|
||||
@pytest.mark.parametrize("case", SCALES)
|
||||
def test_a_press_on_the_anchor_of_a_select_in_a_frame_of_another_site_is_heard_only_by_the_frame(firefox_binary, monkeypatch, case):
|
||||
with _session(firefox_binary, monkeypatch, case) as (browser, chrome, sites):
|
||||
with _fresh_page(browser, chrome, sites.url("A", "/cross")) as page:
|
||||
frame = None
|
||||
|
||||
def frame_up() -> bool:
|
||||
nonlocal frame
|
||||
frame = frame_of(page, sites.origin["B"], "/frame")
|
||||
try:
|
||||
return frame is not None and bool(frame.evaluate("() => !!window.__read"))
|
||||
except Exception: # noqa: BLE001 the frame is still loading: the wait goes on, and the deadline names it
|
||||
return False
|
||||
|
||||
assert wait_for(page, frame_up, DEADLINE_S), "the frame of the other site did not load; frames %r" % [f.url for f in page.frames]
|
||||
page.mouse.click(*FRAME_ANCHOR_CENTRE)
|
||||
assert wait_for(page, lambda: _states(chrome)["select"] == "open", DEADLINE_S), "the real click on the select of the frame did not open the dropdown (states %r)" % _states(chrome)
|
||||
assert wait_for(page, lambda: any(row[0] == "click" for row in frame.evaluate("() => window.__read()")["events"]), DEADLINE_S), "the release of the opening click never reached the frame"
|
||||
page.evaluate("() => window.__reset()")
|
||||
frame.evaluate("() => window.__reset()")
|
||||
|
||||
def read() -> Dict[str, Any]:
|
||||
top, inner = page.evaluate("() => window.__read()"), frame.evaluate("() => window.__read()")
|
||||
return {"frame_events": inner["events"], "top_events": top["events"], "select": _states(chrome)["select"], "top_active": top["active"], "frame_active": inner["active"]}
|
||||
|
||||
want = {"frame_events": ev(("pointerup", "s"), ("mouseup", "s"), ("click", "s")), "top_events": [], "select": "closed", "top_active": "f", "frame_active": "s"}
|
||||
page.mouse.click(*FRAME_ANCHOR_CENTRE)
|
||||
problem = _settled("%s, a press on the anchor of the select in the frame" % case, read, page, want)
|
||||
assert not problem, problem
|
||||
@@ -0,0 +1,75 @@
|
||||
"""A browser whose output says that a release went on without the popup its press opened failing the test that launched it, and a clean output not failing it.
|
||||
|
||||
The engine's Juggler writes ``WARNING: popup <id> did not say popupshown within 1000 ms of its press, the release goes on`` when the wait of a release for ``popupshown`` runs out (``juggler/protocol/PageHandler.js``,
|
||||
``_waitForPopupOfPress``). ``tests/_browser_log.py`` puts a tee in front of the core's reader of the browser's output, and ``tests/conftest.py`` fails every e2e test whose browser wrote the line. This test runs the real
|
||||
``ProcessOutput`` of the core over a pipe that holds a log: with the line the test fails and names it, with a clean log it passes, and the reader still gets every line (the tee takes nothing).
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import re
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import _browser_log
|
||||
from invisible_core.juggler.connection import ProcessOutput
|
||||
|
||||
#: The line as the engine writes it (PageHandler.js: ``WARNING: popup ${popup.id || popup.localName} did not say popupshown within ${POPUP_SHOWN_WAIT_MS} ms of its press, the release goes on``).
|
||||
EXPIRED = "WARNING: popup ContentSelectDropdownPopup did not say popupshown within 1000 ms of its press, the release goes on"
|
||||
CLEAN = ["console.warn: something else", "WARNING: 3 events wait for frame 7, Network.requestWillBeSent is dropped", "JavaScript warning: popupshown listener added", "popup shown"]
|
||||
|
||||
|
||||
def _read(monkeypatch, lines):
|
||||
"""The real reader of the core over ``lines``, with the tee installed: ``(sink, output)`` once the reader has reached the end."""
|
||||
sink = _browser_log.Sink()
|
||||
_browser_log.install(monkeypatch, sink)
|
||||
output = ProcessOutput(io.BytesIO(("\n".join(lines) + "\n").encode()))
|
||||
output._thread.join(5)
|
||||
assert not output._thread.is_alive(), "the reader of the output did not reach the end of the log"
|
||||
return sink, output
|
||||
|
||||
|
||||
def test_a_log_with_the_expired_wait_fails_the_test_and_names_the_line(monkeypatch):
|
||||
sink, output = _read(monkeypatch, CLEAN[:2] + [EXPIRED] + CLEAN[2:])
|
||||
with pytest.raises(pytest.fail.Exception) as failed:
|
||||
sink.fail_if_any()
|
||||
message = str(failed.value)
|
||||
assert EXPIRED in message, message
|
||||
assert "popupshown" in message and "1 line(s)" in message, message
|
||||
# The reader got every line, in order: the tee took nothing.
|
||||
assert output.tail(20) == CLEAN[:2] + [EXPIRED] + CLEAN[2:]
|
||||
|
||||
|
||||
def test_a_log_with_no_such_line_passes(monkeypatch):
|
||||
sink, output = _read(monkeypatch, CLEAN)
|
||||
sink.fail_if_any()
|
||||
assert sink.lines == []
|
||||
assert output.tail(20) == CLEAN
|
||||
|
||||
|
||||
def test_every_expired_wait_of_a_log_is_named_with_its_popup(monkeypatch):
|
||||
other = EXPIRED.replace("ContentSelectDropdownPopup", "menupopup")
|
||||
sink, _output = _read(monkeypatch, [EXPIRED, other])
|
||||
with pytest.raises(pytest.fail.Exception) as failed:
|
||||
sink.fail_if_any()
|
||||
assert "ContentSelectDropdownPopup" in str(failed.value) and "menupopup" in str(failed.value)
|
||||
assert "2 line(s)" in str(failed.value)
|
||||
|
||||
|
||||
def test_the_matcher_is_the_engines_line_and_nothing_wider():
|
||||
assert _browser_log.failing(EXPIRED)
|
||||
assert _browser_log.failing(" prefix " + EXPIRED + " suffix")
|
||||
# Another bound, another popup: the same line. A line that only mentions the words is not it.
|
||||
assert _browser_log.failing(EXPIRED.replace("1000", "250"))
|
||||
assert not _browser_log.failing("WARNING: popup x did not say popupshown")
|
||||
assert not _browser_log.failing("the popup said popupshown within 12 ms of its press")
|
||||
|
||||
|
||||
def test_the_conftest_installs_the_check_for_every_e2e_test_only():
|
||||
text = (Path(__file__).parent / "conftest.py").read_text(encoding="utf-8")
|
||||
body = text[text.index("def _the_browser_log_holds_no_line_that_fails_the_test"):]
|
||||
body = body[:body.index("\n\n\n")]
|
||||
assert "@pytest.fixture(autouse=True)" in text[text.index("def _the_browser_log_holds_no_line_that_fails_the_test") - 80:text.index("def _the_browser_log_holds_no_line_that_fails_the_test")]
|
||||
assert re.search(r'get_closest_marker\("e2e"\) is None', body)
|
||||
assert "_browser_log.install(monkeypatch, sink)" in body and "sink.fail_if_any()" in body
|
||||
@@ -0,0 +1,509 @@
|
||||
"""A core a browser process leaves is judged against the list of known Mozilla defects, with the core's exact matcher (scripts/ci_crash_evidence.py).
|
||||
|
||||
A crash that matches a listed defect is reported by its D<n> and is not red; a crash that cost a measurement stays red; anything unmatched stays red; and the judge is closed:
|
||||
no matcher, a matcher without the API, an unreadable list or no engine version keeps every crash red and says why. The first caller is the A/A control of the A/B oracle
|
||||
(scripts/ci_ab_oracle.py); every other caller judges nothing and stays red as ever.
|
||||
|
||||
The evidence is a real core: the `FSBroker` thread of a `-backgroundtask` process of Firefox 159.0 that crashed at the exit with `pthread_mutex_lock failed` (run 46539190316), in
|
||||
tests/data/known_mozilla_defects/ with the matcher of the core's main (a copy, with its sha256 and source in `sources.json`; the tests do not use the network). The row of the list
|
||||
is written in the test: the wrapper's own list is tested in tests/test_the_wrapper_list_of_known_mozilla_defects.py.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
||||
import ci_ab_oracle as ab # noqa: E402
|
||||
import ci_crash_evidence as crash # noqa: E402
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
DATA = Path(__file__).resolve().parent / "data" / "known_mozilla_defects"
|
||||
CORE = "core.FSBroker14298.14187.1796087906"
|
||||
CLOSING = 1796087900.0 # the launch began to close the browser 6 s before the core was written
|
||||
D31 = {"id": "D31", "bug": "", "firefox": {"from": "159.0", "to": "159.*"},
|
||||
"signature": {"process": "backgroundtask", "phase": "exit", "thread": "FSBroker",
|
||||
"reason": "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"},
|
||||
"seen": "oss-invisible/firefox_antidetect_patch/actions/runs/46539190316/job/142310624770",
|
||||
"why": "at the exit of a -backgroundtask process the FSBroker thread unregisters from the profiler after the static destructors ran and locks a destroyed mutex"}
|
||||
RECORD = {"process": "backgroundtask", "phase": "exit", "thread": "FSBroker", "reason": D31["signature"]["reason"],
|
||||
"frames": ["pthread_kill", "raise", "??", "<signal handler called>", "mozilla::detail::MutexImpl::lock()", "??", "??", "??", "??", "??", "??"]}
|
||||
HEADER_FULL = "Core was generated by `/tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/firefox --backg'.\n"
|
||||
|
||||
|
||||
def gdb_text() -> str:
|
||||
return (DATA / "gdb-core.FSBroker14298.14187.1796087906.txt").read_text(encoding="utf-8")
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def world(tmp_path, monkeypatch):
|
||||
"""A matcher (the real one of the core's main, from the copy beside the evidence), a list with the row of D31, an engine folder with its application.ini, and a launch."""
|
||||
matcher = tmp_path / "matcher" / "ci_mozilla_defects.py"
|
||||
matcher.parent.mkdir()
|
||||
matcher.write_bytes((DATA / "ci_mozilla_defects.py.txt").read_bytes())
|
||||
rows = tmp_path / "ci" / "mozilla-defects.json"
|
||||
rows.parent.mkdir()
|
||||
rows.write_text(json.dumps([D31]), encoding="utf-8")
|
||||
engine = tmp_path / "engine"
|
||||
engine.mkdir()
|
||||
(engine / "application.ini").write_text("[App]\nVendor=Mozilla\nName=Firefox\nVersion=159.0\nBuildID=20261126160241\n", encoding="utf-8")
|
||||
monkeypatch.setenv(crash.MATCHER_ENV, str(matcher))
|
||||
monkeypatch.setattr(crash, "DEFECTS_LIST", rows)
|
||||
return type("World", (), {"matcher": matcher, "rows": rows, "binary": str(engine / "firefox"), "engine": engine, "path": tmp_path})
|
||||
|
||||
|
||||
def launch(record=None, code=0, cores=(CORE, CORE), **extra) -> dict:
|
||||
"""The entry the probe writes for the launch of the A/A control that left the core of the real crash (its two folders list it twice)."""
|
||||
out = {"n": 9, "label": {"seed": 63, "dpr": 1.5, "launch": "ab-visit"}, "pid": 14315, "returncode": code, "cores": list(cores), "dmp": [], "closing_at": CLOSING,
|
||||
"crash_records": [{"core": CORE, "record": copy.deepcopy(RECORD if record is None else record)}], "evidence": "firefox-70-again/09-63-1.5-ab-visit"}
|
||||
out.update(extra)
|
||||
return out
|
||||
|
||||
|
||||
def judged(world, launches, complete=True, notes=None, missing=()):
|
||||
return crash.exit_problems(launches, "firefox-70-again", False, notes=notes, measurements_complete=complete, missing=missing, binary=world.binary)
|
||||
|
||||
|
||||
# --- the record of a core ----------------------------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
def test_the_record_built_from_the_real_core_is_what_the_row_of_the_defect_names():
|
||||
assert crash.crash_record(gdb_text(), CORE, None, CLOSING) == RECORD
|
||||
|
||||
|
||||
def test_a_field_the_evidence_cannot_give_is_left_out_of_the_record():
|
||||
record = crash.crash_record("", "core", None, None)
|
||||
assert record == {}, "no gdb text, a core named without %e, no time: nothing is claimed"
|
||||
no_reason = gdb_text().replace("MOZ_CRASH(", "NOT_A_REASON(").replace('"NOT_A_REASON(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"', "<error: Cannot access memory>")
|
||||
assert "reason" not in crash.crash_record(no_reason, CORE, None, CLOSING)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("name, closing, phase", [
|
||||
("core.FSBroker14298.14187.1796087906", 1796087900.0, "exit"),
|
||||
("core.FSBroker14298.14187.1796087906", 1796087906.0, "exit"),
|
||||
("core.FSBroker14298.14187.1796087906", 1796087906.4, "exit"), # whole seconds: the second the close began is an exit
|
||||
("core.FSBroker14298.14187.1796087906", 1796087907.0, "run"),
|
||||
("core.FSBroker14298.14187.1796087906", None, None),
|
||||
])
|
||||
def test_the_phase_is_exit_when_the_core_was_written_at_or_after_the_close_began(name, closing, phase):
|
||||
assert crash.crash_record(gdb_text(), name, None, closing).get("phase") == phase
|
||||
|
||||
|
||||
def test_a_core_without_a_time_in_its_name_is_placed_by_its_mtime():
|
||||
assert crash.phase_of("core.77", 1000.0, 999.0) == "exit"
|
||||
assert crash.phase_of("core.77", 998.0, 999.0) == "run"
|
||||
assert crash.phase_of("core.77", None, 999.0) is None
|
||||
|
||||
|
||||
HEADER = "Core was generated by `%s'.\nProgram terminated with signal SIGSEGV, Segmentation fault.\n"
|
||||
|
||||
|
||||
@pytest.mark.parametrize("line, process", [
|
||||
("/e/firefox --backgroundtask pingsender", "backgroundtask"),
|
||||
("/e/firefox -backgroundtask pingsender", "backgroundtask"),
|
||||
("/e/firefox -contentproc -childID 4 -isForBrowser tab", "tab"),
|
||||
("/e/firefox --contentproc -childID 1 -prefsLen 7 gpu", "gpu"),
|
||||
("/e/firefox --profile /p about:blank", "parent"),
|
||||
("/e/firefox", "parent"),
|
||||
("/e/firefox -contentproc -childID 4 -isForBrowser notatype", None),
|
||||
("/e/firefox --foreground", "parent"),
|
||||
])
|
||||
def test_the_process_type_is_read_from_a_whole_command_line(line, process):
|
||||
assert crash.process_type(HEADER % line) == process
|
||||
|
||||
|
||||
@pytest.mark.parametrize("tail, process", [
|
||||
("--backg", "backgroundtask"), # the real core's line
|
||||
("--back", "backgroundtask"),
|
||||
("-backgroundtas", "backgroundtask"),
|
||||
("--bac", None), # three letters name no flag
|
||||
("--b", None),
|
||||
("--foregr", None),
|
||||
("-contentproc -childID 4 -isForBrowser ta", None), # the type is not known to be whole
|
||||
("-contentproc -childID 4 -isForBrowser tab", None), # a whole type at the cut is not known to be whole either
|
||||
("--profile /p", None),
|
||||
])
|
||||
def test_the_process_type_of_a_line_cut_at_79_characters_is_the_background_task_only_when_a_flag_of_it_is_cut(tail, process):
|
||||
path = "/tmp/ab-oracle" + "/" * (crash.CUT_LINE - 1 - len(tail) - len("/tmp/ab-oracle"))
|
||||
line = "%s %s" % (path, tail)
|
||||
assert len(line) == 79, "the kernel keeps 80 bytes of the arguments with the NUL: 79 visible characters"
|
||||
assert crash.process_type(HEADER % line) == process
|
||||
|
||||
|
||||
def test_the_real_header_is_a_cut_line_that_names_the_background_task():
|
||||
line = HEADER_FULL.split("`")[1].split("'")[0]
|
||||
assert len(line) == 79 and crash.process_type(HEADER_FULL) == "backgroundtask"
|
||||
assert crash.process_type("no header here") is None
|
||||
|
||||
|
||||
def test_a_cut_contentproc_line_gives_no_process():
|
||||
line = ("/tmp/ab-oracle-qi59xcf3/engines/firefox-70_159.0_20261126160241/firefox -contentproc -c")[:79]
|
||||
assert len(line) == 79 and crash.process_type("Core was generated by `%s'." % line) is None
|
||||
|
||||
|
||||
@pytest.mark.parametrize("header, name, thread", [
|
||||
('Thread 1 (Thread 0x7f (LWP 5) "FSBroker14298"):', "core.Other.5.1", "FSBroker"), # gdb quotes the name: it wins over %e
|
||||
("Thread 1 (Thread 0x7f (LWP 5)):", "core.FSBroker14298.5.1", "FSBroker"),
|
||||
("Thread 1 (Thread 0x7f (LWP 5)):", "core.Web Content.5.1", "Web Content"),
|
||||
("Thread 1 (Thread 0x7f (LWP 5)):", "core.123.5.1", None),
|
||||
("Thread 1 (Thread 0x7f (LWP 5)):", "core.5", None),
|
||||
])
|
||||
def test_the_thread_name_is_gdbs_or_the_name_of_the_core_without_its_instance_number(header, name, thread):
|
||||
text = "[Current thread is 1 (Thread 0x7f (LWP 5))]\n\n%s\n#0 0x1 in pthread_kill () from /lib/libc.so.6\n" % header
|
||||
assert crash.thread_name(text, name) == thread
|
||||
|
||||
|
||||
def test_the_frames_are_the_function_names_of_the_crashing_thread_top_first():
|
||||
text = ("[Current thread is 2 (Thread 0x7f (LWP 5))]\n\nThread 3 (Thread 0x1 (LWP 6)):\n#0 0x1 in other ()\n\nThread 2 (Thread 0x7f (LWP 5)):\n"
|
||||
"#0 0x00007f in ns::f<int> (a=1) at f.cpp:7\n#1 0x00007e in ?? () from /lib/libxul.so\n#2 <signal handler called>\n")
|
||||
assert crash.crashing_thread(text) == (None, ["ns::f<int>", "??", "<signal handler called>"])
|
||||
assert crash.crashing_thread("no current thread") == (None, None)
|
||||
|
||||
|
||||
# --- the judge: the matcher, the list, the version, closed ---------------------------------------------------------------------------------------------------------------
|
||||
|
||||
def test_the_a_a_with_the_core_of_d31_and_every_measurement_is_not_red_and_says_which_defect(world):
|
||||
notes: list = []
|
||||
assert judged(world, [launch()], True, notes) == []
|
||||
assert len(notes) == 1 and notes[0].startswith("known Mozilla defect D31 (not filed): at the exit of a -backgroundtask process")
|
||||
assert notes[0].endswith("run firefox-70-again, side B, seed 63, dpr 1.5, launch ab-visit, launch number 9")
|
||||
|
||||
|
||||
def test_the_same_with_a_measurement_missing_is_red_and_names_the_defect_and_what_is_missing(world):
|
||||
notes: list = []
|
||||
lines = judged(world, [launch()], False, notes, missing=["no dump of dpr1.0_seed64"])
|
||||
assert notes == []
|
||||
assert lines[0].startswith("a process of the browser crashed while the parent ended with 0") and "(evidence: firefox-70-again/09-63-1.5-ab-visit)" in lines[0]
|
||||
text = "\n".join(lines)
|
||||
assert "MATCHED D31" in text and "the crash matched D31" in text and "a measurement is missing" in text and "measurement missing: no dump of dpr1.0_seed64" in text
|
||||
|
||||
|
||||
@pytest.mark.parametrize("change", [
|
||||
{"thread": "FSBrokerX"},
|
||||
{"thread": None},
|
||||
{"reason": "MOZ_CRASH(another reason)"},
|
||||
{"reason": None},
|
||||
{"process": "tab"},
|
||||
{"process": None},
|
||||
{"phase": "run"},
|
||||
{"phase": None},
|
||||
])
|
||||
def test_a_core_that_is_not_exactly_the_listed_defect_stays_red(world, change):
|
||||
record = copy.deepcopy(RECORD)
|
||||
for key, value in change.items():
|
||||
record.pop(key) if value is None else record.__setitem__(key, value)
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(record)], True, notes)
|
||||
assert notes == [] and lines and lines[0].startswith("a process of the browser crashed while the parent ended with 0")
|
||||
assert any("no known defect matches" in x or "has no string" in x for x in lines[1:]), lines
|
||||
|
||||
|
||||
def test_a_core_written_before_the_close_began_is_a_crash_of_the_run_and_stays_red(world):
|
||||
record = crash.crash_record(gdb_text(), CORE, None, 1796087999.0)
|
||||
assert record["phase"] == "run"
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(record)], True, notes)
|
||||
assert notes == [] and any("no known defect matches" in x for x in lines)
|
||||
|
||||
|
||||
def test_a_parent_that_did_not_end_with_0_is_never_excused_whatever_its_cores_say(world):
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(code=-11)], True, notes)
|
||||
assert notes == [] and len(lines) == 1 and lines[0].startswith("the parent process exited with code")
|
||||
|
||||
|
||||
def test_a_minidump_is_not_judged_and_stays_red_even_beside_the_core_of_a_known_defect(world):
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(dmp=["x.dmp"]), launch(cores=[], dmp=["y.dmp"], crash_records=[])], True, notes)
|
||||
assert notes == [] and len(lines) == 2 and all("a process of the browser crashed while the parent ended with 0" in x for x in lines)
|
||||
assert "minidump x.dmp" in lines[0] and "minidump y.dmp" in lines[1]
|
||||
|
||||
|
||||
def test_a_core_with_no_record_stays_red(world):
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(crash_records=[])], True, notes)
|
||||
assert notes == [] and any("no crash record for core %s" % CORE in x for x in lines)
|
||||
|
||||
|
||||
def test_two_launches_are_judged_apart_and_one_unmatched_core_keeps_its_own_red(world):
|
||||
other = launch(n=10, cores=[CORE], crash_records=[{"core": CORE, "record": dict(RECORD, thread="Other")}])
|
||||
notes: list = []
|
||||
lines = judged(world, [launch(), other], True, notes)
|
||||
assert len(notes) == 1 and "launch number 9" in notes[0]
|
||||
assert lines and "launch number 10" in lines[0] and any("no known defect matches" in x for x in lines[1:])
|
||||
|
||||
|
||||
def test_a_caller_that_does_not_know_judges_nothing_and_stays_red_as_it_always_was(world, monkeypatch):
|
||||
monkeypatch.setattr(crash, "defects_judge", lambda *a, **k: pytest.fail("a caller that does not say whether its measurements are complete must not load a matcher"))
|
||||
notes: list = []
|
||||
lines = crash.exit_problems([launch()], "firefox-70-again", False, notes=notes)
|
||||
assert notes == [] and len(lines) == 1
|
||||
assert lines[0] == ("a process of the browser crashed while the parent ended with 0: run firefox-70-again, side B, seed 63, dpr 1.5, launch ab-visit, launch number 9 left core %s, %s"
|
||||
" (evidence: firefox-70-again/09-63-1.5-ab-visit)" % (CORE, CORE))
|
||||
assert crash.exit_problems([launch()], "firefox-70-again", False) == lines
|
||||
|
||||
|
||||
def test_the_matcher_is_called_with_the_rows_the_version_the_records_and_whether_the_measurements_are_complete(world, tmp_path):
|
||||
fake = tmp_path / "fake_matcher.py"
|
||||
fake.write_text("calls = []\n"
|
||||
"def load(path):\n return [path.name]\n"
|
||||
"def problems(rows, version, name=None):\n return []\n"
|
||||
"def verdict(rows, version, crashes, measurements_complete):\n calls.append((rows, version, crashes, measurements_complete))\n"
|
||||
" return False, ['MATCHED D1 (not filed): why']\n", encoding="utf-8")
|
||||
judge = crash.defects_judge(world.binary, environ={crash.MATCHER_ENV: str(fake)}, list_path=world.rows)
|
||||
notes: list = []
|
||||
assert crash.exit_problems([launch()], "r", False, notes=notes, measurements_complete=True, binary=world.binary, judge=judge) == []
|
||||
assert judge.module.calls == [(["mozilla-defects.json"], "159.0", [RECORD], True)]
|
||||
assert notes[0].startswith("known Mozilla defect D1 (not filed): why: run r,")
|
||||
|
||||
|
||||
# --- closed: no judge, every crash stays red, and the line says why -------------------------------------------------------------------------------------------------------
|
||||
|
||||
def closed(world, **kw):
|
||||
notes: list = []
|
||||
lines = crash.exit_problems([launch()], "firefox-70-again", False, notes=notes, measurements_complete=True, binary=kw.pop("binary", world.binary),
|
||||
judge=crash.defects_judge(kw.pop("binary_of_judge", world.binary), **kw))
|
||||
assert notes == []
|
||||
assert lines[0].startswith("a process of the browser crashed while the parent ended with 0")
|
||||
return "\n".join(lines[1:])
|
||||
|
||||
|
||||
def test_no_matcher_is_red_and_says_so(world, tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(crash, "_FETCHED", {})
|
||||
assert "does not exist" in closed(world, environ={crash.MATCHER_ENV: str(tmp_path / "nowhere.py")})
|
||||
|
||||
class Done:
|
||||
returncode, stdout, stderr = 128, "", "fatal: unable to access"
|
||||
|
||||
text = closed(world, environ={}, run=lambda *a, **k: Done())
|
||||
assert "main of oss-invisible/core cannot be resolved" in text and "every crash stays red" in text
|
||||
|
||||
|
||||
def test_a_matcher_without_the_api_is_red_and_says_so(world, tmp_path):
|
||||
broken = tmp_path / "broken.py"
|
||||
broken.write_text("def load(path):\n return []\n", encoding="utf-8")
|
||||
text = closed(world, environ={crash.MATCHER_ENV: str(broken)})
|
||||
assert "has no problems, verdict" in text
|
||||
broken.write_text("raise RuntimeError('boom')\n", encoding="utf-8")
|
||||
assert "cannot be imported (RuntimeError: boom)" in closed(world, environ={crash.MATCHER_ENV: str(broken)})
|
||||
|
||||
|
||||
def test_a_list_that_cannot_be_read_is_red_and_says_so(world, tmp_path):
|
||||
assert "cannot be read" in closed(world, list_path=tmp_path / "nowhere.json")
|
||||
broken = tmp_path / "broken.json"
|
||||
broken.write_text("{not json", encoding="utf-8")
|
||||
assert "is not JSON" in closed(world, list_path=broken)
|
||||
|
||||
|
||||
def test_an_engine_without_application_ini_or_without_a_version_is_red_and_says_so(world, tmp_path):
|
||||
assert "application.ini" in closed(world, binary_of_judge=str(tmp_path / "elsewhere" / "firefox"))
|
||||
(world.engine / "application.ini").write_text("[App]\nMinVersion=159.0\n", encoding="utf-8")
|
||||
assert "has no Version= line" in closed(world)
|
||||
assert "the browser binary is not known" in closed(world, binary_of_judge=None)
|
||||
(world.engine / "application.ini").write_text("[App]\nVersion=abc\n", encoding="utf-8")
|
||||
assert "cannot use the engine version abc" in closed(world)
|
||||
|
||||
|
||||
def test_an_engine_the_list_does_not_hold_for_is_red_even_for_the_listed_crash(world):
|
||||
(world.engine / "application.ini").write_text("[App]\nVersion=160.0\n", encoding="utf-8")
|
||||
notes: list = []
|
||||
lines = judged(world, [launch()], True, notes)
|
||||
assert notes == [] and any("does not contain the engine under test (160.0)" in x for x in lines)
|
||||
|
||||
|
||||
def test_the_matcher_of_the_core_is_fetched_once_per_process_from_the_sha_of_main_and_the_sha_is_printed(tmp_path, monkeypatch):
|
||||
monkeypatch.setattr(crash, "_FETCHED", {})
|
||||
sha = "882eed52ae1776c570053eb772c068206207cac8"
|
||||
asked, said = [], []
|
||||
|
||||
class Done:
|
||||
returncode, stdout, stderr = 0, "%s\trefs/heads/main\n" % sha, ""
|
||||
|
||||
class Page:
|
||||
def __enter__(self):
|
||||
return self
|
||||
|
||||
def __exit__(self, *a):
|
||||
return False
|
||||
|
||||
def read(self):
|
||||
return (DATA / "ci_mozilla_defects.py.txt").read_bytes()
|
||||
|
||||
def run(argv, **kw):
|
||||
asked.append(argv)
|
||||
return Done()
|
||||
|
||||
def urlopen(url, timeout=None):
|
||||
asked.append(url)
|
||||
return Page()
|
||||
|
||||
first = crash.matcher_path({}, run, urlopen, said.append)
|
||||
second = crash.matcher_path({}, run, urlopen, said.append)
|
||||
assert first == second and first.name == "ci_mozilla_defects.py" and crash.load_matcher(first).problems([], "159.0") == []
|
||||
assert asked == [["git", "ls-remote", "https://github.com/oss-invisible/core", "refs/heads/main"],
|
||||
"https://raw.githubusercontent.com/oss-invisible/core/%s/scripts/ci_mozilla_defects.py" % sha]
|
||||
assert len(said) == 1 and sha in said[0]
|
||||
|
||||
|
||||
def test_the_copy_of_the_matcher_is_the_one_its_sidecar_names():
|
||||
sources = json.loads((DATA / "sources.json").read_text(encoding="utf-8"))
|
||||
for name, entry in sources.items():
|
||||
assert hashlib.sha256((DATA / name).read_bytes()).hexdigest() == entry["sha256"], name
|
||||
assert sources["ci_mozilla_defects.py.txt"]["source"] == "oss-invisible/core scripts/ci_mozilla_defects.py"
|
||||
|
||||
|
||||
# --- the probe records what the judge reads, and the A/A passes whether its visits are all there ---------------------------------------------------------------------------
|
||||
|
||||
class ProcessOf:
|
||||
pid = 4242
|
||||
|
||||
def __init__(self, code):
|
||||
self.code = code
|
||||
|
||||
def poll(self):
|
||||
return self.code
|
||||
|
||||
def terminate(self):
|
||||
pass
|
||||
|
||||
|
||||
class Gdb:
|
||||
"""`subprocess.run` that answers gdb with the text of the real core."""
|
||||
|
||||
def __init__(self):
|
||||
self.calls = []
|
||||
|
||||
def __call__(self, argv, **kw):
|
||||
self.calls.append(argv)
|
||||
|
||||
class Done:
|
||||
stdout, stderr = gdb_text(), ""
|
||||
|
||||
return Done()
|
||||
|
||||
which = staticmethod(lambda name: "/usr/bin/gdb" if name == "gdb" else None)
|
||||
|
||||
|
||||
def a_launch_that_leaves(probe, core_name, folder):
|
||||
from invisible_core.juggler.connection import Connection, ProcessOutput
|
||||
|
||||
probe.set_label(seed=63, dpr=1.5, launch="ab-visit")
|
||||
to_r, to_w = os.pipe()
|
||||
from_r, from_w = os.pipe()
|
||||
out_r, out_w = os.pipe()
|
||||
output = ProcessOutput(os.fdopen(out_r, "rb"))
|
||||
conn = Connection(to_w, from_r, ProcessOf(0))
|
||||
conn.output = output
|
||||
os.close(out_w)
|
||||
output.settle()
|
||||
(folder / core_name).write_bytes(b"\x7fELF") # the browser's process dies; the core is written before the close the launch makes
|
||||
conn.close()
|
||||
os.close(from_w)
|
||||
os.close(to_r)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("core_name, phase", [("core.FSBroker14298.14187.9999999999", "exit"), ("core.FSBroker14298.14187.1000000000", "run")])
|
||||
def test_the_probe_records_when_the_close_began_and_a_record_of_every_core_it_found(tmp_path, core_name, phase):
|
||||
from invisible_core.juggler.connection import Connection
|
||||
|
||||
cores = tmp_path / "cores"
|
||||
cores.mkdir()
|
||||
gdb = Gdb()
|
||||
probe = crash.LaunchProbe("/e/firefox", tmp_path / "out" / "crash", windows=False, folders=[], core_folders=[cores], run=gdb, which=gdb.which)
|
||||
probe.install(Connection, output=None)
|
||||
try:
|
||||
a_launch_that_leaves(probe, core_name, cores)
|
||||
finally:
|
||||
probe.uninstall()
|
||||
entry = probe.launches[0]
|
||||
assert entry["closing_at"] > 1_700_000_000 and entry["cores"] == [core_name]
|
||||
expected = dict(RECORD, phase=phase)
|
||||
assert entry["crash_records"] == [{"core": core_name, "record": expected}]
|
||||
probe.write()
|
||||
assert crash.read_exits(tmp_path / "out" / "crash" / "exits.json")["launches"][0]["crash_records"] == entry["crash_records"]
|
||||
|
||||
|
||||
def write_visits(folder: Path, keys) -> None:
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
for dpr, seed in keys:
|
||||
(folder / ("%s.json" % ab.visit_name(dpr, seed))).write_text(json.dumps({"dpr": dpr, "seed": seed, "result": {"items": {"a": {"b": 1}}}}), encoding="utf-8")
|
||||
|
||||
|
||||
def fake_dump(exits_dir: Path, written, record=None):
|
||||
"""`run_dump` that writes the visits `written` and the exits.json of a probe that saw the launch of the core of D31."""
|
||||
def run_dump(binary, seal, leg, out, visits, **kw):
|
||||
write_visits(out, written)
|
||||
document = {"format": crash.FORMAT, "core_limit": None, "stderr_said": None, "launches_without_connection": [], "launches": [launch(record)]}
|
||||
folder = Path(os.environ[crash.CRASH_DIR_ENV])
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
(folder / "exits.json").write_text(json.dumps(document), encoding="utf-8")
|
||||
return 0
|
||||
return run_dump
|
||||
|
||||
|
||||
def test_the_a_a_with_the_core_of_d31_and_every_visit_is_not_red_and_names_the_defect(world, monkeypatch):
|
||||
visits = [(1.5, 63), (1.0, 64)]
|
||||
monkeypatch.setattr(ab, "run_dump", fake_dump(world.path, visits))
|
||||
notes: list = []
|
||||
rc, problems = ab.dump_with_exits("firefox-70-again", world.binary, None, "linux-x86_64", visits, world.path / "t", world.path / "out", notes=notes, control=True)
|
||||
assert rc == 0 and problems == []
|
||||
assert len(notes) == 1 and notes[0].startswith("known Mozilla defect D31 (not filed)")
|
||||
|
||||
|
||||
def test_the_a_a_with_the_core_of_d31_and_a_visit_missing_is_red_and_says_which(world, monkeypatch):
|
||||
visits = [(1.5, 63), (1.0, 64)]
|
||||
monkeypatch.setattr(ab, "run_dump", fake_dump(world.path, visits[:1]))
|
||||
notes: list = []
|
||||
rc, problems = ab.dump_with_exits("firefox-70-again", world.binary, None, "linux-x86_64", visits, world.path / "t", world.path / "out", notes=notes, control=True)
|
||||
text = "\n".join(problems)
|
||||
assert notes == [] and problems[0].startswith("a process of the browser crashed while the parent ended with 0")
|
||||
assert "MATCHED D31" in text and "the crash matched D31" in text and "measurement missing: no dump of dpr1.0_seed64" in text
|
||||
|
||||
|
||||
def test_a_dump_that_is_not_the_a_a_judges_no_core_and_stays_red(world, monkeypatch):
|
||||
visits = [(1.5, 63)]
|
||||
monkeypatch.setattr(ab, "run_dump", fake_dump(world.path, visits))
|
||||
monkeypatch.setattr(crash, "defects_judge", lambda *a, **k: pytest.fail("only the A/A judges a core"))
|
||||
notes: list = []
|
||||
rc, problems = ab.dump_with_exits("candidate", world.binary, None, "linux-x86_64", visits, world.path / "t", world.path / "out", notes=notes)
|
||||
assert notes == [] and len(problems) == 1 and "crashed while the parent ended with 0" in problems[0]
|
||||
|
||||
|
||||
def test_a_visit_whose_tab_died_is_not_a_complete_measurement(tmp_path):
|
||||
folder = tmp_path / "t"
|
||||
write_visits(folder, [(1.5, 63)])
|
||||
assert ab.visits_complete(0, folder, [(1.5, 63)]) == (True, [])
|
||||
path = folder / "dpr1.5_seed63.json"
|
||||
document = json.loads(path.read_text(encoding="utf-8"))
|
||||
document["result"]["items"] = {"crash.tab.visit.error": "Target closed", "crash.tab.visit.step": "goto"}
|
||||
path.write_text(json.dumps(document), encoding="utf-8")
|
||||
complete, missing = ab.visits_complete(0, folder, [(1.5, 63)])
|
||||
assert not complete and "the tab of dpr1.5_seed63 died" in missing[0]
|
||||
assert ab.visits_complete(None, folder / "none", [(1.5, 63)]) == (False, ["the dump process ended with None", "no dump of dpr1.5_seed63"])
|
||||
|
||||
|
||||
def test_the_a_a_run_prints_the_notes_and_keeps_them_in_its_report(world, monkeypatch, capsys):
|
||||
visits = [(1.5, 63)]
|
||||
seen = []
|
||||
|
||||
def dumps(name, exe, seal_file, leg, asked, work, out, file_name, python=None, notes=None, control=False):
|
||||
seen.append((name, control))
|
||||
if control and name.endswith("-again"):
|
||||
notes.append("known Mozilla defect D31 (not filed): why: run %s" % name)
|
||||
return {(1.5, 63): {"a": {"b": 1}}}, []
|
||||
|
||||
monkeypatch.setattr(ab, "_dump_visits", dumps)
|
||||
monkeypatch.setattr(ab, "split_published", lambda published: ("pub", None, None))
|
||||
monkeypatch.setattr(ab.gate, "load_exceptions", lambda: {"noise": []})
|
||||
monkeypatch.setattr(ab, "MIN_LEAVES", {1.5: 1})
|
||||
out = world.path / "out"
|
||||
ab.run_ab("linux-x86_64", out, "firefox-70", published=("pub", None), visits=visits)
|
||||
assert seen == [("firefox-70", True), ("firefox-70-again", True)], "the two dumps of the A/A are the control; no other dump is"
|
||||
assert "NOTE known Mozilla defect D31 (not filed): why: run firefox-70-again" in capsys.readouterr().out
|
||||
assert json.loads((out / "diff-a-a.json").read_text(encoding="utf-8"))["known_defects"] == ["known Mozilla defect D31 (not filed): why: run firefox-70-again"]
|
||||
@@ -78,10 +78,11 @@ EXPECTED = {
|
||||
('frame', 'mousemove', True, None, None, None, 0, 0, 0),
|
||||
('frame', 'pointerdown', True, 0.5, 0, 'mouse', 2, 2, 0),
|
||||
('frame', 'mousedown', True, None, None, None, 2, 2, 1),
|
||||
('frame', 'contextmenu', True, 0.5, 0, 'mouse', 2, 2, 1),
|
||||
('frame', 'pointerup', True, 0, 0, 'mouse', 0, 2, 0),
|
||||
('frame', 'mouseup', True, None, None, None, 0, 2, 1),
|
||||
('frame', 'auxclick', True, 0, 0, 'mouse', 0, 2, 1),
|
||||
# the contextmenu comes after the release, as on Windows (WM_CONTEXTMENU follows WM_RBUTTONUP): no button is held, so no pressure
|
||||
('frame', 'contextmenu', True, 0, 0, 'mouse', 0, 2, 1),
|
||||
],
|
||||
'move with button down': [
|
||||
('frame', 'pointermove', True, 0, 0, 'mouse', 0, -1, 0),
|
||||
|
||||
+406
@@ -0,0 +1,406 @@
|
||||
"""No fontconfig file of the host is opened, and the screenshot draws the bundle even when the host's caches are poisoned (e2e, Linux).
|
||||
|
||||
Why Linux only: fontconfig exists only there. On Windows the parent rebuilds a font from the path a text run carries with DirectWrite, which opens the
|
||||
file by its path and has no configuration and no cache of fonts to read; this test has no Windows form (the row of ``ci/required-suites.json`` says so:
|
||||
``linux_only``).
|
||||
|
||||
It replaces the test of the warm cache (``test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py``), which asked that a second launch read
|
||||
fontconfig's cache of the bundle. The engine no longer has that behaviour, on purpose: it runs fontconfig on its own empty configuration. It reads no
|
||||
``fonts.conf``, no rule, no cache folder and no GTK or Xft font option, it does not show ``<GRE>/fonts`` to fontconfig (the core declares
|
||||
``gfx.bundled-fonts.activate=0`` on Linux), and the screenshot takes the file and the face of each text run from the bundle's manifest. So the host's
|
||||
fontconfig can neither decide a face nor be asked.
|
||||
|
||||
What the test does, in one launch under strace (the stand-in of ``tests/_strace_stand_in.py``: the engine's folder as links, whose executable runs the real
|
||||
one under ``strace -f`` in its place):
|
||||
|
||||
(a) POISONS the caches first. Fontconfig names the cache of a folder by the md5 of its path and trusts it while the folder's mtime is the one the cache
|
||||
recorded. The test makes a copy of the engine's fonts folder (links to the files) WITHOUT one ``.ttc`` (``msgothic5_32.ttc``: MS Gothic, MS PGothic,
|
||||
MS UI Gothic), gives the copy the mtime of the real folder, and has ``fc-cache`` write the cache of the copy AS IF it were the real folder
|
||||
(``<remap-dir as-path=...>``: the cache is named for the real path and lists the real path), once into ``$HOME/.fontconfig`` and once into
|
||||
``$XDG_CACHE_HOME/fontconfig`` of the test, the two folders an old engine reads. A cache valid for the real folder that does not list that face. The
|
||||
test then asks fontconfig itself (``fc-list``, with the real folder and one cache folder) and fails if the face is listed or the real folder is
|
||||
not what it lists: a poison that is not in force would let every assertion below pass for the wrong reason;
|
||||
(b) asserts that NO process of the browser (the parent, the content processes, any other) OPENS a path under ``/etc/fonts``, a file called
|
||||
``fonts.conf``, or a fontconfig cache file (``*.cache-*``, also the ``.NEW`` and ``.TMP-*`` it is written through), whatever the result of the open:
|
||||
an open that is refused (no such file) is a look at the host's configuration all the same. The other calls that look at a path
|
||||
(stat, access, readlink) are written to the evidence and not judged;
|
||||
(c) takes a screenshot of Japanese text in a bundled face (MS PGothic, which is face 2 of the ``.ttc`` the poison lacks) and asserts it equals the content's
|
||||
own drawing, as ``tests/test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e.py`` does: the same text as HTML (the parent
|
||||
rebuilds it for the screenshot) and as a canvas the content drew, in the same screenshot, equal byte by byte.
|
||||
|
||||
Red on the old engine: it opens ``/etc/fonts/fonts.conf`` (and the caches) at ``FcInit``, and with the poisoned cache the parent asks fontconfig which file is the
|
||||
face of the text run, which does not list it: it draws another file's outlines (a font of the host), so the two boxes differ. Green on the engine that runs
|
||||
fontconfig on its own empty configuration.
|
||||
|
||||
The environment reaches the browser as it does for a user: the test sets ``HOME`` and ``XDG_CACHE_HOME`` in its own environment (and ``XDG_CONFIG_HOME`` to a
|
||||
folder with nothing in it), and the core composes the engine's environment from it. ``FONTCONFIG_FILE`` and ``FONTCONFIG_PATH`` of the runner are taken off.
|
||||
|
||||
Evidence, whatever the verdict: when ``RUNNER_TEMP`` is set the test writes ``result.json`` (the poison, what fontconfig says of it, every open of a
|
||||
forbidden path with the role of its process, every other forbidden look, the boxes of the screenshot) and the screenshot under
|
||||
``$RUNNER_TEMP/invpw-evidence/fontconfig-host-files/``.
|
||||
|
||||
Run: pytest tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py -m e2e -v
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import hashlib
|
||||
import json
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import shutil
|
||||
import subprocess
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
import _page_bytes as pb
|
||||
from _waits import wait_until
|
||||
from _strace_stand_in import (
|
||||
_detached, _group_members, _group_of, _kill_group, _LINE, _require_strace_can_trace, _RESUMED, _roles, _stand_in, _SYSCALLS, _wait_for_exit)
|
||||
from test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e import (
|
||||
BLOCK_H, BLOCK_W, EVIDENCE_FOLDER, PIN, VIEWPORT, _dark, _integer_box, _page)
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.e2e,
|
||||
pytest.mark.skipif(not sys.platform.startswith("linux"), reason="fontconfig is the Linux font system"),
|
||||
]
|
||||
|
||||
SEED = 21
|
||||
|
||||
#: The face of the screenshot: MS PGothic is face 2 of msgothic5_32.ttc (face 0 is MS Gothic), the file the poison lacks.
|
||||
FAMILY = "MS PGothic"
|
||||
MISSING_FACE_FILE = "msgothic5_32.ttc"
|
||||
|
||||
#: What is traced: the opens (what the test judges), the other calls that look at a path (evidence), and the clones and the execve (the role of a process).
|
||||
TRACE = _SYSCALLS + ",openat2"
|
||||
OPEN_CALLS = ("open", "openat", "openat2")
|
||||
_LOOK_CALLS = ("stat", "lstat", "newfstatat", "statx", "access", "faccessat", "faccessat2", "readlink")
|
||||
#: Calls whose first argument is a directory descriptor (``-y`` prints its path: ``3</etc/fonts/conf.d>``, ``AT_FDCWD</cwd>``).
|
||||
_AT_CALLS = ("openat", "openat2", "newfstatat", "statx", "faccessat", "faccessat2")
|
||||
|
||||
_QUOTED_FIRST = re.compile(r'^"((?:[^"\\]|\\.)*)"')
|
||||
_AT_ARGS = re.compile(r'^([^,"]*),\s*"((?:[^"\\]|\\.)*)"')
|
||||
_RETURN = re.compile(r"\)\s+=\s+(-?\d+)")
|
||||
#: A fontconfig cache file: ``<md5 or uuid>-<arch>.cache-<n>``, and what it is written through (``.NEW``, ``.TMP-xxxxxx``).
|
||||
_CACHE_FILE = re.compile(r"\.cache-\d+(\.|$)")
|
||||
|
||||
#: The folders an old engine reads a cache from, besides ``/var/cache/fontconfig``: the legacy ``~/.fontconfig`` and ``$XDG_CACHE_HOME/fontconfig``.
|
||||
POISONED_FOLDERS = ("home", "xdg")
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
# What the log says (pure: unit-tested without a browser, tests/unit/test_fontconfig_cache_criterion.py)
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
def is_a_fontconfig_file_of_the_host(path: str) -> bool:
|
||||
"""A path the engine must never open: under ``/etc/fonts``, a file called ``fonts.conf`` (anywhere: a user's, the system's, a bundle's), or a
|
||||
fontconfig cache file (``*.cache-<n>`` and what it is written through)."""
|
||||
folder = posixpath.normpath(path)
|
||||
base = posixpath.basename(folder)
|
||||
return folder == "/etc/fonts" or folder.startswith("/etc/fonts/") or base == "fonts.conf" or _CACHE_FILE.search(base) is not None
|
||||
|
||||
|
||||
def _full_path(dirfd: str, path: str) -> str:
|
||||
"""The path a call names: absolute as it is; a relative one with the folder ``-y`` printed for its descriptor (``3</etc/fonts/conf.d>``)."""
|
||||
if path.startswith("/"):
|
||||
return posixpath.normpath(path)
|
||||
folder = re.search(r"<(.*)>", dirfd)
|
||||
return posixpath.normpath(posixpath.join(folder.group(1), path)) if folder else path
|
||||
|
||||
|
||||
def _results_of_unfinished(lines) -> dict:
|
||||
"""``{index of an unfinished call: its result}``: strace -f writes a call that another thread interrupts as "PID openat(...<unfinished ...>" and gives
|
||||
the result on the next line of that pid, "PID <... openat resumed>) = -1 ENOENT". An unfinished line with no resumed line has no entry."""
|
||||
pending, results = {}, {}
|
||||
for i, line in enumerate(lines):
|
||||
m = _LINE.match(line)
|
||||
if m and "<unfinished ...>" in m.group(3):
|
||||
pending[(int(m.group(1)), m.group(2))] = i
|
||||
continue
|
||||
r = _RESUMED.match(line)
|
||||
if r and (int(r.group(1)), r.group(2)) in pending:
|
||||
result = _RETURN.search(r.group(3))
|
||||
if result:
|
||||
results[pending.pop((int(r.group(1)), r.group(2)))] = int(result.group(1))
|
||||
return results
|
||||
|
||||
|
||||
def paths_of_calls(lines, calls) -> list:
|
||||
"""``[{"line", "pid", "call", "path", "result"}]``: every call of ``calls`` on the log, with the path it names, whatever its result (``None`` when the log
|
||||
has none: an unfinished call with no resumed line). A call that names a path through a descriptor with no printed folder keeps the relative path."""
|
||||
results = _results_of_unfinished(lines)
|
||||
found = []
|
||||
for i, line in enumerate(lines):
|
||||
m = _LINE.match(line)
|
||||
if not m or m.group(2) not in calls:
|
||||
continue
|
||||
call, rest = m.group(2), m.group(3)
|
||||
if call in _AT_CALLS:
|
||||
args = _AT_ARGS.match(rest)
|
||||
path = _full_path(args.group(1), args.group(2)) if args else None
|
||||
else:
|
||||
args = _QUOTED_FIRST.match(rest)
|
||||
path = posixpath.normpath(args.group(1)) if args else None
|
||||
if path is None:
|
||||
continue
|
||||
result = _RETURN.search(rest)
|
||||
found.append({"line": i, "pid": int(m.group(1)), "call": call, "path": path,
|
||||
"result": int(result.group(1)) if result else results.get(i)})
|
||||
return found
|
||||
|
||||
|
||||
def host_fontconfig_looks(lines, real: str) -> dict:
|
||||
"""``{"opens": [...], "other": [...]}``: the opens of a fontconfig file of the host by any process of the browser, and (evidence, not judged) the stat,
|
||||
access and readlink calls on one. Each has the role of its process (``parent``, ``content`` or ``other``)."""
|
||||
role, _argv = _roles(lines, real)
|
||||
out = {"opens": [], "other": []}
|
||||
for key, calls in (("opens", OPEN_CALLS), ("other", _LOOK_CALLS)):
|
||||
for call in paths_of_calls(lines, calls):
|
||||
if is_a_fontconfig_file_of_the_host(call["path"]):
|
||||
out[key].append(dict(call, role=role(call["pid"])))
|
||||
return out
|
||||
|
||||
|
||||
def poison_config(as_path: str, copy: str, cache_dir: str) -> str:
|
||||
"""The configuration ``fc-cache`` reads to write the poison: scan ``copy`` AS IF it were ``as_path`` (the cache is named for ``as_path`` and lists
|
||||
its path), into ``cache_dir`` only, and nothing else (no system folder, no rule)."""
|
||||
return ('<?xml version="1.0"?>\n<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">\n<fontconfig>\n'
|
||||
' <remap-dir as-path="%s">%s</remap-dir>\n <cachedir>%s</cachedir>\n</fontconfig>\n' % (as_path, copy, cache_dir))
|
||||
|
||||
|
||||
def reader_config(folder: str, cache_dir: str) -> str:
|
||||
"""The configuration that asks fontconfig what the cache holds for ``folder``: the folder and one cache folder, nothing else."""
|
||||
return ('<?xml version="1.0"?>\n<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">\n<fontconfig>\n'
|
||||
' <dir>%s</dir>\n <cachedir>%s</cachedir>\n</fontconfig>\n' % (folder, cache_dir))
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
# The test's own steps
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
def _evidence_dir():
|
||||
base = os.environ.get("RUNNER_TEMP")
|
||||
return Path(base) / EVIDENCE_FOLDER / "fontconfig-host-files" if base else None
|
||||
|
||||
|
||||
def _tool_env(conf: Path, home: Path) -> dict:
|
||||
"""The environment of ``fc-cache`` and ``fc-list``: the test's own, with this one configuration and nothing of the variables the core strips."""
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith(("FONTCONFIG_", "FC_"))}
|
||||
env["FONTCONFIG_FILE"] = str(conf)
|
||||
env["HOME"] = str(home)
|
||||
return env
|
||||
|
||||
|
||||
def _run(argv, env) -> str:
|
||||
done = subprocess.run(argv, env=env, capture_output=True, text=True, timeout=300)
|
||||
assert done.returncode == 0, "%s failed (%d): %s" % (" ".join(argv), done.returncode, (done.stderr or done.stdout)[-800:])
|
||||
return done.stdout
|
||||
|
||||
|
||||
def _poison(work: Path, gre_fonts: str, home: Path, xdg_cache: Path) -> dict:
|
||||
"""Write the poisoned cache of the real fonts folder into ``home/.fontconfig`` and ``xdg_cache/fontconfig``; -> what was written and what fontconfig says
|
||||
of each (the files it lists for the real folder, read back by ``fc-list`` from that cache folder alone)."""
|
||||
copy = work / "fonts-without-one-ttc"
|
||||
copy.mkdir()
|
||||
entries = sorted((e for e in os.scandir(gre_fonts) if e.is_file()), key=lambda e: e.name)
|
||||
assert any(e.name == MISSING_FACE_FILE for e in entries), "<GRE>/fonts has no %s: the poison has nothing to lack" % MISSING_FACE_FILE
|
||||
for entry in entries:
|
||||
if entry.name != MISSING_FACE_FILE:
|
||||
(copy / entry.name).symlink_to(entry.path)
|
||||
stat = os.stat(gre_fonts)
|
||||
# The cache is valid while the folder's mtime is the one it recorded (the package gives the folder 1767225600): the copy gets the real folder's own, in
|
||||
# nanoseconds, after the links, which moved it.
|
||||
os.utime(copy, ns=(stat.st_atime_ns, stat.st_mtime_ns))
|
||||
md5 = hashlib.md5(gre_fonts.rstrip("/").encode()).hexdigest()
|
||||
caches = {"home": home / ".fontconfig", "xdg": xdg_cache / "fontconfig"}
|
||||
said = {}
|
||||
for name, folder in caches.items():
|
||||
folder.mkdir(parents=True, exist_ok=True)
|
||||
conf = work / ("poison-%s.conf" % name)
|
||||
conf.write_text(poison_config(gre_fonts, str(copy), str(folder)), encoding="utf-8")
|
||||
_run(["fc-cache", "-f", "-v"], _tool_env(conf, home))
|
||||
reader = work / ("reader-%s.conf" % name)
|
||||
reader.write_text(reader_config(gre_fonts, str(folder)), encoding="utf-8")
|
||||
listed = sorted(line for line in _run(["fc-list", "-f", "%{file}\\n"], _tool_env(reader, home)).splitlines() if line.strip())
|
||||
said[name] = {
|
||||
"cache_folder": str(folder),
|
||||
"cache_files": sorted(f.name for f in folder.iterdir() if f.is_file()),
|
||||
"listed_files": sorted(set(listed)),
|
||||
}
|
||||
return {"copy": str(copy), "real_folder": gre_fonts, "md5_of_the_real_folder": md5, "mtime_ns": stat.st_mtime_ns,
|
||||
"font_files_in_the_real_folder": [e.name for e in entries], "caches": said}
|
||||
|
||||
|
||||
def _poison_problems(poison: dict) -> list:
|
||||
"""Why the poison is not in force (empty when it is): a cache that fontconfig does not read for the real folder, or that still lists the face, is no poison."""
|
||||
problems = []
|
||||
real = poison["real_folder"]
|
||||
for name, said in poison["caches"].items():
|
||||
mine = [f for f in said["cache_files"] if f.startswith(poison["md5_of_the_real_folder"]) and _CACHE_FILE.search(f)]
|
||||
if not mine:
|
||||
problems.append("%s: no cache named for the real folder (%s-*.cache-*) in %s (it holds %s)"
|
||||
% (name, poison["md5_of_the_real_folder"], said["cache_folder"], said["cache_files"]))
|
||||
listed = said["listed_files"]
|
||||
if not listed:
|
||||
problems.append("%s: fontconfig lists no font for the real folder %s with this cache" % (name, real))
|
||||
elif any(posixpath.dirname(f) != real for f in listed):
|
||||
problems.append("%s: fontconfig lists files outside the real folder: %s" % (name, [f for f in listed if posixpath.dirname(f) != real][:3]))
|
||||
if any(posixpath.basename(f) == MISSING_FACE_FILE for f in listed):
|
||||
problems.append("%s: fontconfig lists %s for the real folder: the cache is not the poisoned one (the folder was scanned again)" % (name, MISSING_FACE_FILE))
|
||||
return problems
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def launch(firefox_binary, tmp_path_factory):
|
||||
"""The one launch under strace, with the caches poisoned: -> {poison, looks, measured, whole, dom, cv, ...}; the record is written before any assertion."""
|
||||
for tool in ("strace", "fc-cache", "fc-list"):
|
||||
if shutil.which(tool) is None:
|
||||
pytest.fail("needs %s (apt install strace fontconfig): without it nothing is measured" % tool, pytrace=False)
|
||||
work = tmp_path_factory.mktemp("fcfiles")
|
||||
_require_strace_can_trace(work)
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
real = os.path.realpath(firefox_binary)
|
||||
gre_fonts = os.path.join(os.path.dirname(real), "fonts")
|
||||
home, xdg_cache, xdg_config = work / "home", work / "xdg-cache", work / "xdg-config"
|
||||
for folder in (home, xdg_cache, xdg_config):
|
||||
folder.mkdir()
|
||||
out = {"poison": _poison(work, gre_fonts, home, xdg_cache)}
|
||||
|
||||
run = work / "run"
|
||||
run.mkdir()
|
||||
log, pidfile = run / "strace.log", run / "stand-in.pid"
|
||||
stand_in = _stand_in(firefox_binary, run / "engine", log, pidfile, syscalls=TRACE, fd_paths=True)
|
||||
shot, measured = None, None
|
||||
try:
|
||||
with pytest.MonkeyPatch.context() as patch:
|
||||
patch.setenv("HOME", str(home))
|
||||
patch.setenv("XDG_CACHE_HOME", str(xdg_cache))
|
||||
patch.setenv("XDG_CONFIG_HOME", str(xdg_config))
|
||||
for variable in ("FONTCONFIG_FILE", "FONTCONFIG_PATH"):
|
||||
patch.delenv(variable, raising=False)
|
||||
with InvisiblePlaywright(seed=SEED, binary_path=stand_in, headless=True, pin=PIN) as browser:
|
||||
page = browser.new_context(viewport=VIEWPORT).new_page()
|
||||
page.set_content(_page())
|
||||
page.evaluate("fam => { window.DONE = false; window.ERR = null;"
|
||||
" draw(fam).then(r => { window.R = r; window.DONE = true; },"
|
||||
" e => { window.ERR = String(e); window.DONE = true; }); }", FAMILY)
|
||||
page.wait_for_function("window.DONE === true", timeout=60_000)
|
||||
out["page_error"] = page.evaluate("window.ERR")
|
||||
measured = page.evaluate("window.R")
|
||||
shot = page.screenshot(type="png")
|
||||
finally:
|
||||
_kill_group(pidfile)
|
||||
lines = log.read_text(encoding="utf-8", errors="replace").splitlines()
|
||||
out["log_lines"] = len(lines)
|
||||
out["looks"] = host_fontconfig_looks(lines, real)
|
||||
out["measured"], out["shot"] = measured, shot
|
||||
if shot is not None and measured is not None:
|
||||
whole = pb.unfiltered(shot)
|
||||
out["whole"] = {"w": whole["w"], "h": whole["h"]}
|
||||
out["dom"] = _integer_box("DOM", measured["dom"])
|
||||
out["cv"] = _integer_box("canvas", measured["cv"])
|
||||
out["dom_img"] = pb.crop(whole, out["dom"]["x"], out["dom"]["y"], out["dom"]["width"], out["dom"]["height"])
|
||||
out["cv_img"] = pb.crop(whole, out["cv"]["x"], out["cv"]["y"], out["cv"]["width"], out["cv"]["height"])
|
||||
out["diff"] = pb.pixels_differ(out["dom_img"], out["cv_img"])
|
||||
where = _evidence_dir()
|
||||
if where is not None:
|
||||
try:
|
||||
where.mkdir(parents=True, exist_ok=True)
|
||||
record = {k: v for k, v in out.items() if k not in ("shot", "dom_img", "cv_img")}
|
||||
(where / "result.json").write_text(json.dumps(record, indent=1, sort_keys=True, default=str) + "\n", encoding="utf-8")
|
||||
if shot is not None:
|
||||
(where / "page.png").write_bytes(shot)
|
||||
except Exception as exc: # a record never changes the outcome
|
||||
print("the record could not be written:", repr(exc))
|
||||
return out
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
# The tests
|
||||
# --------------------------------------------------------------------------------------------------------------------------------------
|
||||
@pytest.mark.timeout(120, method="thread")
|
||||
def test_the_stand_in_stays_in_the_engine_s_place_and_its_group_is_killed_whole(tmp_path):
|
||||
"""The tool, without a browser. A fake engine (a script that starts a child and waits for it) is launched through the stand-in
|
||||
as the core launches the engine: the leader of a process group of its own (``_detached``). Once the fake engine says its child
|
||||
runs (a signal file, no pause), the process the launcher holds must be alive and be the fake engine's parent, strace: with the
|
||||
stand-in that exec'd ``setsid``, setsid forked (its caller led a group), its parent exited 0 at once, and the core saw the engine
|
||||
exit during startup (candidate 44161687675, job 134356188701). The group the cleanup kills is the launcher's, it holds strace and
|
||||
the fake engine's child, and nothing of it is left afterwards."""
|
||||
if shutil.which("strace") is None:
|
||||
pytest.fail("needs strace (apt install strace): without it the stand-in cannot be tried", pytrace=False)
|
||||
_require_strace_can_trace(tmp_path)
|
||||
real = tmp_path / "real" / "firefox"
|
||||
real.parent.mkdir()
|
||||
# The signal, written whole (a rename) once the child runs: the child's pid and the fake engine's parent, the process strace is.
|
||||
signal_file = tmp_path / "started"
|
||||
real.write_text('#!/bin/sh\nsleep 300 &\necho "$! $PPID" > %s.tmp && mv %s.tmp %s\nwait\n' % (signal_file, signal_file, signal_file))
|
||||
real.chmod(0o755)
|
||||
log, pidfile = tmp_path / "strace.log", tmp_path / "stand-in.pid"
|
||||
stand_in = _stand_in(str(real), tmp_path / "engine", log, pidfile)
|
||||
proc = _detached([stand_in], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||
try:
|
||||
started = wait_until(signal_file.exists, 30, lambda: time.sleep(0.05))
|
||||
child, engine_parent = (int(word) for word in signal_file.read_text().split()) if started else (None, None)
|
||||
exited_with = proc.poll()
|
||||
pgid = _group_of(pidfile)
|
||||
members = _group_members(pgid) if pgid is not None else []
|
||||
comms = sorted(Path("/proc/%d/comm" % p).read_text().strip() for p in members if Path("/proc/%d/comm" % p).exists())
|
||||
killed = _kill_group(pidfile)
|
||||
proc.wait(timeout=30)
|
||||
left = _wait_for_exit(pgid) if pgid is not None else []
|
||||
finally:
|
||||
_kill_group(pidfile)
|
||||
if proc.poll() is None:
|
||||
proc.kill()
|
||||
proc.wait(timeout=30)
|
||||
assert started, "the fake engine did not start its child under the stand-in"
|
||||
assert exited_with is None and engine_parent == proc.pid, (
|
||||
"the process the launcher holds (pid %d, exited with %s) is not the one that runs the engine (its parent is %s): the launcher would "
|
||||
"see the engine gone" % (proc.pid, exited_with, engine_parent))
|
||||
assert pgid == proc.pid and pgid != os.getpgrp(), "the group is not the one the launcher gave (group %s, pid %d)" % (pgid, proc.pid)
|
||||
assert "strace" in comms and child in members, "the group holds %s (%s), not strace and the child %s" % (members, comms, child)
|
||||
assert killed == pgid and not left, "after the kill of group %s: killed %s, left %s" % (pgid, killed, left)
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_the_caches_of_the_host_hold_a_valid_cache_of_the_bundle_that_lacks_a_face(launch):
|
||||
"""The precondition of the two below, in fontconfig's own words: without it a clean log and an equal screenshot would prove nothing."""
|
||||
problems = _poison_problems(launch["poison"])
|
||||
assert not problems, "the poison is not in force, so the test measures nothing: %s" % "; ".join(problems)
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_no_process_of_the_browser_opens_a_fontconfig_file_of_the_host(launch):
|
||||
problems = _poison_problems(launch["poison"])
|
||||
assert not problems, "the poison is not in force, so the test measures nothing: %s" % "; ".join(problems)
|
||||
assert launch["log_lines"] > 0, "strace wrote nothing: the browser was not traced"
|
||||
opens = launch["looks"]["opens"]
|
||||
assert not opens, (
|
||||
"%d open(s) of a fontconfig file of the host by the browser (under /etc/fonts, a fonts.conf, or a *.cache-* cache), by role: %s. The first ones: %s. "
|
||||
"Looks that are not opens (stat, access, readlink), not judged: %d"
|
||||
% (len(opens), sorted({o["role"] for o in opens}),
|
||||
[(o["role"], o["call"], o["path"], o["result"]) for o in opens[:8]], len(launch["looks"]["other"])))
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_the_screenshot_of_japanese_text_in_a_bundled_face_is_the_content_s_drawing_with_the_caches_poisoned(launch):
|
||||
problems = _poison_problems(launch["poison"])
|
||||
assert not problems, "the poison is not in force, so the test measures nothing: %s" % "; ".join(problems)
|
||||
assert launch["page_error"] is None, "the page could not draw the two blocks: %s" % launch["page_error"]
|
||||
measured, whole, dom, cv = launch["measured"], launch["whole"], launch["dom"], launch["cv"]
|
||||
assert measured["dpr"] == 1, "the device pixel ratio is %r, not 1: the boxes would be resampled" % measured["dpr"]
|
||||
assert (dom["width"], dom["height"]) == (cv["width"], cv["height"]) == (BLOCK_W, BLOCK_H), (dom, cv)
|
||||
assert measured["lines"] == 6, "the block has %r lines, not 6" % measured["lines"]
|
||||
assert (whole["w"], whole["h"]) == (VIEWPORT["width"], VIEWPORT["height"]), (
|
||||
"the screenshot is %dx%d for a viewport of %dx%d: the boxes are not where the page measured them"
|
||||
% (whole["w"], whole["h"], VIEWPORT["width"], VIEWPORT["height"]))
|
||||
dom_img, cv_img, diff = launch["dom_img"], launch["cv_img"], launch["diff"]
|
||||
# a box with no text in it would be equal to another box with no text in it
|
||||
assert _dark(dom_img) > 0, "the DOM box of %s is blank: the screenshot has no text there" % FAMILY
|
||||
assert _dark(cv_img) > 0, "the canvas box of %s is blank: the SVG image drew no text" % FAMILY
|
||||
assert dom_img["data"] == cv_img["data"], (
|
||||
"%s: the text the screenshot rebuilt in the parent (the DOM box) is not the text the content drew (the canvas box): %d of %d pixels differ, the first at %r, "
|
||||
"inside the box %r. With the caches of the host poisoned (a valid cache of the bundle without %s), the parent drew the face from another file."
|
||||
% (FAMILY, diff["pixels"], BLOCK_W * BLOCK_H, diff["first"], diff["box"], MISSING_FACE_FILE))
|
||||
@@ -0,0 +1,103 @@
|
||||
"""A page that closes with a popup open leaves no popup open and no browser element that cannot be pointed at, as on every Firefox.
|
||||
|
||||
The popups that a page opens in the chrome (the dropdown of a ``<select>``, the datalist's list, the page context menu) belong to the tab that opened them. A tab that goes away with one open takes it with it: no menu is left
|
||||
showing over the window, and nothing that the automation did to let a press through (it can switch the ``pointer-events`` of the browser elements while a popup is open) is left on a browser element that stays. A popup that outlives its page
|
||||
is a window nobody can close, and a browser element that keeps ``pointer-events: none`` is a page that no longer takes a click, in the tab the user goes back to.
|
||||
|
||||
What it does, per popup (the dropdown, the context menu, the datalist list), on one display case (the 1920x1080 panel at scale 1.0): two pages are open (the first is kept open, as a user's other tab), the second is clicked with the client's own mouse
|
||||
until the popup is open (read from chrome: the state ``open``), and then closed with ``page.close()``. The chrome (Marionette, ``MOZ_REMOTE_ALLOW_SYSTEM_ACCESS=1``) walks every ``navigator:browser`` window and lists every ``menupopup`` and ``panel`` whose state is not
|
||||
``closed``, and reads, for every ``browser`` element that is left, the inline ``pointer-events`` and the computed one. The wait is a condition with a deadline (``wait_for``), and the verdict is on the last reading: no popup is open, and no browser element
|
||||
has an inline ``none`` or a pair that no browser element had before the popup was opened (the baseline is read on the same two pages, with nothing open).
|
||||
|
||||
The positive control is in the same test: with the popup open, before the page closes, the same walk must list it as not closed, so a walk that answered ``closed`` whatever was open would not pass for nothing.
|
||||
|
||||
Green on the published engine and on the one under test: the close of a tab with a popup open is what the engine must not break.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any, Callable, Dict, List
|
||||
|
||||
import pytest
|
||||
from _fission_frames import Sites
|
||||
from _stock_twin import MARIONETTE_ARGS, Chrome
|
||||
from _window_origin import DEADLINE_S, launch_case, wait_for
|
||||
from test_a_press_on_an_open_select_follows_windows_rollup_e2e import ANCHOR_CENTRE, BOX_CENTRE, INPUT_CENTRE, PAGE, STATES_JS
|
||||
|
||||
pytestmark = pytest.mark.e2e
|
||||
|
||||
CASE = "1920x1080-dpr1.0"
|
||||
|
||||
#: Every window of the browser: the popups that are not closed (``menupopup`` and ``panel``), and for each ``browser`` element the inline ``pointer-events`` and the computed one.
|
||||
WALK_JS = """
|
||||
const out = {popups: [], browsers: [], windows: 0};
|
||||
const windows = Services.wm.getEnumerator("navigator:browser");
|
||||
while (windows.hasMoreElements()) {
|
||||
const win = windows.getNext();
|
||||
out.windows += 1;
|
||||
for (const popup of win.document.querySelectorAll("menupopup, panel")) {
|
||||
if (typeof popup.state === "string" && popup.state !== "closed") out.popups.push({window: out.windows, id: popup.id, tag: popup.localName, state: popup.state});
|
||||
}
|
||||
for (const browser of win.document.querySelectorAll("browser")) {
|
||||
out.browsers.push({window: out.windows, id: browser.id, inline: browser.style.pointerEvents, computed: win.getComputedStyle(browser).pointerEvents});
|
||||
}
|
||||
}
|
||||
return JSON.stringify(out);
|
||||
"""
|
||||
|
||||
|
||||
def _open_dropdown(page: Any, chrome: Chrome) -> None:
|
||||
page.mouse.click(*ANCHOR_CENTRE)
|
||||
assert wait_for(page, lambda: chrome.script(STATES_JS)["select"] == "open", DEADLINE_S), "the real click did not open the dropdown: %r" % chrome.script(STATES_JS)
|
||||
|
||||
|
||||
def _open_context_menu(page: Any, chrome: Chrome) -> None:
|
||||
page.mouse.click(*BOX_CENTRE, button="right")
|
||||
assert wait_for(page, lambda: chrome.script(STATES_JS)["context"] == "open", DEADLINE_S), "the real right click did not open the context menu: %r" % chrome.script(STATES_JS)
|
||||
|
||||
|
||||
def _open_datalist(page: Any, chrome: Chrome) -> None:
|
||||
page.mouse.click(*INPUT_CENTRE)
|
||||
page.keyboard.type("a")
|
||||
assert wait_for(page, lambda: chrome.script(STATES_JS)["autocomplete"] == "open", DEADLINE_S), "a click on the input and a typed letter did not open the list: %r" % chrome.script(STATES_JS)
|
||||
|
||||
|
||||
#: Each popup, by what it is called here, and how a real click opens it.
|
||||
POPUPS: Dict[str, Callable[[Any, Chrome], None]] = {"the dropdown of a select": _open_dropdown, "the page context menu": _open_context_menu, "the datalist list": _open_datalist}
|
||||
|
||||
|
||||
def _problems(before: Dict[str, Any], after: Dict[str, Any]) -> List[str]:
|
||||
"""What is wrong with the walk ``after``: the popups still not closed, and the browser elements whose pointer-events are not what some browser element had with nothing open (an inline ``none`` never is)."""
|
||||
known = {(b["inline"], b["computed"]) for b in before["browsers"]}
|
||||
out = ["a popup is not closed: %r" % popup for popup in after["popups"]]
|
||||
out += ["a browser element has pointer-events %r (computed %r), which no browser element had with nothing open (%r)" % (b["inline"], b["computed"], sorted(known))
|
||||
for b in after["browsers"] if b["inline"] == "none" or (b["inline"], b["computed"]) not in known]
|
||||
return out
|
||||
|
||||
|
||||
@pytest.mark.parametrize("popup", sorted(POPUPS))
|
||||
def test_no_popup_is_left_when_a_page_closes(firefox_binary, monkeypatch, popup):
|
||||
monkeypatch.setenv("MOZ_REMOTE_ALLOW_SYSTEM_ACCESS", "1") # the chrome-scope reads
|
||||
with Sites() as sites, launch_case(firefox_binary, CASE, extra_args=MARIONETTE_ARGS, extra_prefs={"marionette.port": 0}) as browser:
|
||||
sites.route("A", "/page", PAGE)
|
||||
other = browser.new_page() # first: the window the chrome session waits for, and the second tab of the user that stays
|
||||
chrome = Chrome(other)
|
||||
try:
|
||||
page = browser.new_page()
|
||||
page.goto(sites.url("A", "/page"))
|
||||
before = chrome.script(WALK_JS)
|
||||
assert not before["popups"] and before["browsers"], "the baseline walk is not of a quiet browser with browser elements: %r" % before
|
||||
POPUPS[popup](page, chrome)
|
||||
open_now = chrome.script(WALK_JS)
|
||||
assert open_now["popups"], "the walk did not list the popup that is open (the control of the walk): %r" % open_now
|
||||
page.close()
|
||||
seen: Dict[str, Any] = {}
|
||||
|
||||
def clean() -> bool:
|
||||
seen["after"] = chrome.script(WALK_JS)
|
||||
return not _problems(before, seen["after"])
|
||||
|
||||
wait_for(other, clean, DEADLINE_S)
|
||||
problems = _problems(before, seen["after"])
|
||||
assert not problems, "after page.close() with %s open (waited %s s): %s; baseline %r, walk %r" % (popup, DEADLINE_S, "; ".join(problems), before, seen["after"])
|
||||
finally:
|
||||
chrome.close()
|
||||
@@ -202,3 +202,20 @@ def test_the_derived_prefs_of_the_core_in_use_are_functions_of_their_dimensions(
|
||||
# compute() raises on the first seed pair that breaks it; this core's own prefs, over a range.
|
||||
features = pc.compute(2000, workers=1)
|
||||
assert all("_derived" not in f for f in features.values())
|
||||
|
||||
|
||||
def test_the_screen_size_in_device_pixels_is_the_formula_of_the_screen_panel():
|
||||
# The core declares the screen as the whole panel and the work area as the screen minus the taskbar
|
||||
# (invisible_core/_fpforge/profile.py:121-145). The prefs are compared with the core's own ScreenProfile, per seed.
|
||||
from invisible_core._fpforge.profile import generate_profile
|
||||
|
||||
width, height = "zoom.stealth.screen.device_width", "zoom.stealth.screen.device_height"
|
||||
assert pc.DERIVED[width] == pc.DERIVED[height] == "screen_panel"
|
||||
scales = set()
|
||||
for seed in range(0, 400, 7):
|
||||
screen = generate_profile(seed).screen
|
||||
prefs = {k: json.loads(v) for k, v in pc.seed_features(seed)[1].items()}
|
||||
assert prefs[width] == screen.avail_device_width == screen.device_width, seed
|
||||
assert prefs[height] == screen.avail_device_height + screen.taskbar_device == screen.device_height, seed
|
||||
scales.add(screen.dpr)
|
||||
assert len(scales) > 1, "the seeds checked must cover more than one scale, or the taskbar term is not exercised"
|
||||
@@ -87,6 +87,10 @@ EXCLUDED = {
|
||||
(("windows",), "the GLX probe (gfxtest glx) is a child process of Firefox on GTK; Windows reads the adapter in the parent and has no such process"),
|
||||
"tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py":
|
||||
(("windows",), "wrapper.e2e.fontconfig is linux_only: fontconfig exists only on Linux (DirectWrite opens a font from its path)"),
|
||||
"tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py":
|
||||
(("windows",), "wrapper.e2e.fontconfig is linux_only: fontconfig exists only on Linux (DirectWrite opens a font from its path)"),
|
||||
"tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py":
|
||||
(("windows",), "wrapper.e2e.fontconfig is linux_only: fontconfig exists only on Linux (DirectWrite draws the text with no rule of a user)"),
|
||||
"tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py::test_webgl_draws_on_the_engine_s_own_gl":
|
||||
(("windows",), "skips on Windows: the engine's own GL is Linux's"),
|
||||
"tests/test_webgl_draws_on_the_engine_s_own_gl_e2e.py::test_every_declared_extension_answers_as_on_windows":
|
||||
@@ -99,7 +103,7 @@ EXCLUDED = {
|
||||
(("windows",), "skips on Windows: the Linux text path"),
|
||||
}
|
||||
#: Changed by hand, together with the list above: an exclusion is a test the candidate does not run, and it may not be added in silence.
|
||||
EXCLUDED_COUNT = 25
|
||||
EXCLUDED_COUNT = 27
|
||||
|
||||
|
||||
@functools.lru_cache(maxsize=None)
|
||||
|
||||
@@ -0,0 +1,447 @@
|
||||
"""The fontconfig rules of the user do not change a pixel of the text a page reads (e2e, Linux, a gate test that asserts the principle: same seed, same bytes).
|
||||
|
||||
Why Linux only: fontconfig exists only there. On Windows DirectWrite draws the text, with no rule of a user in between, so this test has no
|
||||
Windows form (the row of ``ci/required-suites.json`` says so: ``linux_only``).
|
||||
|
||||
The question. The engine draws a face with the parameters of its fontconfig pattern: ``rgba``, ``lcdfilter``, ``autohint``, ``embeddedbitmap``,
|
||||
``hintstyle`` and ``antialias``. On a machine, those are rules of a user (``~/.config/fontconfig``) or of the system (``/etc/fonts``), and the page
|
||||
reads their effect (``getImageData`` of a canvas with text). A value a page reads must not depend on the machine. The engine runs fontconfig on its
|
||||
own empty configuration: it reads no ``fonts.conf``, no rule, no cache folder and no GTK or Xft option, so every rule below must change nothing.
|
||||
|
||||
How a rule enters. As a real user's does: through the user's own configuration, ``$XDG_CONFIG_HOME/fontconfig/fonts.conf`` (the system
|
||||
``fonts.conf`` includes it through ``conf.d/50-user.conf``), set in the environment of the test. Not through ``FONTCONFIG_FILE``: the core removes
|
||||
``FONTCONFIG_*`` and ``FC_*`` from the environment of the engine, so a rule given that way would never arrive, and a test built on it would be green
|
||||
for the wrong reason. ``XDG_CONFIG_HOME`` is not removed, and the test reads ``/proc/<pid>/environ`` of the engine's processes to show it did arrive.
|
||||
|
||||
What is drawn. One local page (http://127.0.0.1, a secure context, so ``crypto.subtle`` answers) draws ``fillText`` with the same seed in every launch:
|
||||
|
||||
* on two canvases per row: (a) OPAQUE, ``getContext('2d', {alpha: false})``, white fill first (Skia turns subpixel anti-aliasing on only for an
|
||||
opaque canvas: ``SetPermitSubpixelAA(IsOpaque)``, which is where ``rgba`` and ``lcdfilter`` show); (b) the DEFAULT one, white fill first too,
|
||||
so that the only difference between the two is the opacity of the canvas;
|
||||
* with fonts of the engine's bundle (the manifest of the core: ``tests/_font_names.py``): Arial (Latin), SimSun and MS Gothic (CJK). The two CJK
|
||||
faces are the ones of the bundle that ship embedded bitmaps on a retail Windows (SimSun at 12 to 16 px, MS Gothic at its small sizes), so they
|
||||
are where ``embeddedbitmap`` can show; Arial and its outlines are the control that has none;
|
||||
* at 9, 11, 12, 13 and 16 px, one row per (font, size) and canvas.
|
||||
|
||||
Each row returns the sha256 of the ``getImageData`` bytes, the number of pixels with R != G or G != B (subpixel anti-aliasing: grayscale text has
|
||||
none), the number of pixels that are not white (the text is there) and the width ``measureText`` gives.
|
||||
|
||||
Seven launches, one engine, one seed, each with its own user ``fonts.conf``:
|
||||
|
||||
1. nothing: a ``fonts.conf`` with no rule (the rules of the machine, whatever they are);
|
||||
2. ``rgba=none`` and ``lcdfilter=lcdnone`` (the runner's own rules say rgba=rgb: this is the other side of it);
|
||||
3. ``rgba=bgr``;
|
||||
4. ``embeddedbitmap=false``;
|
||||
5. ``autohint=true``;
|
||||
6. ``hintstyle=hintfull`` and ``antialias=false`` (the two the engine declares: a rule of a user must not move them either);
|
||||
7. a rule that really moves ``system-ui`` inside fontconfig: ``<match target="pattern">`` on the family ``system-ui``, ``<edit name="family"
|
||||
mode="prepend_first" binding="strong">`` of a face every runner has (the engine builds exactly such a pattern for a generic family:
|
||||
FC_FAMILY = "system-ui", FC_SCALABLE, FC_LANG, then ``FcConfigSubstitute`` and ``FcFontSort``).
|
||||
|
||||
Each is a separate configuration. Before each engine starts, ``fc-match`` runs in the same environment (the same ``XDG_CONFIG_HOME``) and says whether
|
||||
the rule is in force; a launch whose rule is not in force measures nothing and the test says so, and fails: a launch that measures nothing is not a pass
|
||||
(the raw lines are in ``result.json``). Why the system-ui rule did not take in the measurement of the old engine (run 45078210028): ``fc-match
|
||||
system-ui`` PARSES its argument as a fontconfig name, in which ``-`` starts the size (``family-size``), so fontconfig matched the family ``system``
|
||||
and the rule on ``system-ui`` never fired. The test asks ``fc-match`` for ``system\\-ui`` (the hyphen escaped), which is the family the engine builds.
|
||||
|
||||
The assertions:
|
||||
* every launch has its rule in force in fontconfig itself and its ``XDG_CONFIG_HOME`` in the environment of an engine process, and every
|
||||
row drew text (a blank canvas would equal any other);
|
||||
* every launch gives the same pixel hashes as launch 1, row by row, for the opaque canvas and for the default one;
|
||||
* with the rule on ``system-ui``, a page reads the same computed ``font-family`` and the same widths (canvas and layout, Latin and CJK) as in launch 1.
|
||||
|
||||
Red on the old engine (run 45078210028: ``rgba=none`` with ``lcdfilter=none`` changed 11 of 15 opaque rows, and ``embeddedbitmap=false`` changed 8 of 15
|
||||
rows on both canvases): the rules reach the face through the host's configuration. Green on the engine that runs fontconfig on its own empty one.
|
||||
|
||||
Evidence, whatever the verdict: when ``RUNNER_TEMP`` is set the test writes ``result.json`` under ``$RUNNER_TEMP/invpw-evidence/fontconfig-rules/``: per
|
||||
launch, the configuration, the hashes and subpixel counts by row, the reads of ``system-ui``, what ``fc-match`` says and the environment seen in the engine's
|
||||
processes. A table is printed (launch by canvas: same or different from launch 1, subpixel pixels in total). A failure to write it never changes the outcome.
|
||||
|
||||
Run: pytest tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py -m e2e -v -s
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import http.server
|
||||
import json
|
||||
import os
|
||||
import shutil
|
||||
import socketserver
|
||||
import subprocess
|
||||
import sys
|
||||
import threading
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
from test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e import EVIDENCE_FOLDER
|
||||
|
||||
pytestmark = [
|
||||
pytest.mark.e2e,
|
||||
pytest.mark.skipif(not sys.platform.startswith("linux"), reason="fontconfig is the Linux font system"),
|
||||
]
|
||||
|
||||
SEED = 21
|
||||
|
||||
#: (font, text, why). The text of each is in the writing the face draws.
|
||||
FONTS = [
|
||||
("Arial", "Hamburgefonstiv 0123456789 éèàü", "Latin outlines: the control, no embedded bitmaps"),
|
||||
("SimSun", "中文汉字测试 ABC abc 0123", "CJK, embedded bitmaps at 12-16 px on a retail Windows"),
|
||||
("MS Gothic", "日本語のテキスト ABC abc アイウエオ", "CJK, embedded bitmaps at its small sizes"),
|
||||
]
|
||||
SIZES = [9, 11, 12, 13, 16]
|
||||
CANVASES = ["opaque", "default"]
|
||||
|
||||
#: A face a runner has, whose family differs from the one fontconfig answers to ``system-ui`` by default (a sans): the rule of the last launch
|
||||
#: puts it first.
|
||||
HOST_FACE_CANDIDATES = [
|
||||
("/usr/share/fonts/truetype/dejavu/DejaVuSerif.ttf", "DejaVu Serif"),
|
||||
("/usr/share/fonts/truetype/liberation/LiberationSerif-Regular.ttf", "Liberation Serif"),
|
||||
]
|
||||
|
||||
#: name of the launch -> the rules, ``(property, kind, value)``. The user's ``fonts.conf`` of a launch holds them and nothing else.
|
||||
LAUNCHES = [
|
||||
("1_nothing", []),
|
||||
("2_rgba_none_lcdnone", [("rgba", "const", "none"), ("lcdfilter", "const", "lcdnone")]),
|
||||
("3_rgba_bgr", [("rgba", "const", "bgr")]),
|
||||
("4_embeddedbitmap_off", [("embeddedbitmap", "bool", "false")]),
|
||||
("5_autohint", [("autohint", "bool", "true")]),
|
||||
("6_hintfull_antialias_off", [("hintstyle", "const", "hintfull"), ("antialias", "bool", "false")]),
|
||||
("7_system_ui_prepend", []),
|
||||
]
|
||||
SYSTEM_UI_LAUNCH = "7_system_ui_prepend"
|
||||
BASE_LAUNCH = "1_nothing"
|
||||
#: The pattern the engine builds for a generic family (``gfxFcPlatformFontList::FindGenericFamilies``: FC_FAMILY = the generic name, FC_SCALABLE true,
|
||||
#: FC_LANG = the sample language), written as ``fc-match`` reads a name: the hyphen of ``system-ui`` is escaped, or it starts the size.
|
||||
ENGINE_PATTERN = "system\\-ui:scalable=true:lang=en"
|
||||
PROPERTIES = ("rgba", "lcdfilter", "autohint", "embeddedbitmap", "hintstyle", "antialias")
|
||||
#: What ``fc-match -f '%{property}'`` prints for the configuration of each launch: the integers are fontconfig's own constants (FC_RGBA_BGR 2,
|
||||
#: FC_RGBA_NONE 5, FC_LCD_NONE 0, FC_HINT_FULL 3), a boolean prints True or False. The raw ``fc-match -v`` lines of every launch are in result.json
|
||||
#: beside them. A value that is not the one written here still counts as the rule in force when it is DIFFERENT from what launch 1 prints for the
|
||||
#: same property (the form is uncertain, the move is not); both are recorded.
|
||||
EXPECTED_FC = {
|
||||
"2_rgba_none_lcdnone": {"rgba": "5", "lcdfilter": "0"},
|
||||
"3_rgba_bgr": {"rgba": "2"},
|
||||
"4_embeddedbitmap_off": {"embeddedbitmap": "False"},
|
||||
"5_autohint": {"autohint": "True"},
|
||||
"6_hintfull_antialias_off": {"hintstyle": "3", "antialias": "False"},
|
||||
}
|
||||
|
||||
#: Draws every row. ``args`` = [fonts, sizes]. Returns [{canvas, font, size, sha256, subpixel, ink, width, fallback_width}].
|
||||
ROWS_JS = """async (args) => {
|
||||
const [fonts, sizes] = args;
|
||||
const hex = (buf) => Array.from(new Uint8Array(buf)).map(b => b.toString(16).padStart(2, '0')).join('');
|
||||
const fnv = (bytes) => { let h = 0x811c9dc5; for (let i = 0; i < bytes.length; i++) { h ^= bytes[i]; h = Math.imul(h, 0x01000193) >>> 0; } return 'fnv:' + h.toString(16); };
|
||||
const out = [];
|
||||
for (const kind of ['opaque', 'default']) {
|
||||
for (const [family, text] of fonts) {
|
||||
for (const size of sizes) {
|
||||
const c = document.createElement('canvas'); c.width = 400; c.height = size * 2 + 12;
|
||||
const x = kind === 'opaque' ? c.getContext('2d', {alpha: false}) : c.getContext('2d');
|
||||
x.fillStyle = '#fff'; x.fillRect(0, 0, c.width, c.height);
|
||||
x.fillStyle = '#000'; x.textBaseline = 'alphabetic';
|
||||
x.font = size + 'px "' + family + '"';
|
||||
x.fillText(text, 4, size + 4);
|
||||
const width = x.measureText(text).width;
|
||||
x.font = size + 'px "NoSuchFamilyForTheFallback"';
|
||||
const fallback_width = x.measureText(text).width;
|
||||
const data = x.getImageData(0, 0, c.width, c.height).data;
|
||||
let subpixel = 0, ink = 0;
|
||||
for (let i = 0; i < data.length; i += 4) {
|
||||
if (data[i] !== data[i + 1] || data[i + 1] !== data[i + 2]) subpixel++;
|
||||
if (data[i] !== 255 || data[i + 1] !== 255 || data[i + 2] !== 255) ink++;
|
||||
}
|
||||
const sha256 = (window.crypto && crypto.subtle) ? hex(await crypto.subtle.digest('SHA-256', data)) : fnv(data);
|
||||
out.push({canvas: kind, font: family, size, sha256, subpixel, ink, width, fallback_width});
|
||||
}
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}"""
|
||||
|
||||
#: What a page reads of ``system-ui``.
|
||||
SYSTEM_UI_JS = """() => {
|
||||
const latin = 'Hamburgefonstiv 0123456789', cjk = '\\u4e2d';
|
||||
const span = (text) => { const s = document.createElement('span'); s.style.cssText = 'position:absolute;left:-9999px;white-space:pre;font:16px system-ui'; s.textContent = text; document.body.appendChild(s); return s; };
|
||||
const a = span(latin), b = span(cjk);
|
||||
const x = document.createElement('canvas').getContext('2d');
|
||||
x.font = '16px system-ui';
|
||||
const out = {
|
||||
computed_font_family: getComputedStyle(a).fontFamily,
|
||||
canvas_font: x.font,
|
||||
canvas_width_latin: x.measureText(latin).width,
|
||||
canvas_width_cjk: x.measureText(cjk).width,
|
||||
dom_width_latin: a.getBoundingClientRect().width,
|
||||
dom_width_cjk: b.getBoundingClientRect().width,
|
||||
};
|
||||
a.remove(); b.remove();
|
||||
return out;
|
||||
}"""
|
||||
|
||||
_PAGE = b"<!doctype html><meta charset=utf-8><title>fcrules</title><body style='margin:0;background:#fff'>"
|
||||
|
||||
|
||||
class _Handler(http.server.BaseHTTPRequestHandler):
|
||||
def do_GET(self): # noqa: N802
|
||||
self.send_response(200)
|
||||
self.send_header("Content-Type", "text/html; charset=utf-8")
|
||||
self.send_header("Content-Length", str(len(_PAGE)))
|
||||
self.end_headers()
|
||||
self.wfile.write(_PAGE)
|
||||
|
||||
def log_message(self, *args, **kwargs):
|
||||
pass
|
||||
|
||||
|
||||
class _Server(socketserver.ThreadingTCPServer):
|
||||
allow_reuse_address = True
|
||||
daemon_threads = True
|
||||
|
||||
|
||||
def _evidence_dir():
|
||||
base = os.environ.get("RUNNER_TEMP")
|
||||
return Path(base) / EVIDENCE_FOLDER / "fontconfig-rules" if base else None
|
||||
|
||||
|
||||
def _config_text(name: str, rules, host_family: str) -> str:
|
||||
"""The user's ``fonts.conf`` of a launch: its rules and nothing else (the system ``fonts.conf`` includes it)."""
|
||||
parts = ['<?xml version="1.0"?>', '<!DOCTYPE fontconfig SYSTEM "urn:fontconfig:fonts.dtd">', "<fontconfig>"]
|
||||
if name == SYSTEM_UI_LAUNCH:
|
||||
# STRONG, and first: the face comes before ``system-ui`` and before every family the rules of the system add behind it.
|
||||
parts.append(' <match target="pattern">')
|
||||
parts.append(' <test qual="any" name="family"><string>system-ui</string></test>')
|
||||
parts.append(' <edit name="family" mode="prepend_first" binding="strong"><string>%s</string></edit>' % host_family)
|
||||
parts.append(" </match>")
|
||||
for target in ("pattern", "font"):
|
||||
if rules:
|
||||
parts.append(' <match target="%s">' % target)
|
||||
for prop, kind, value in rules:
|
||||
parts.append(' <edit name="%s" mode="assign"><%s>%s</%s></edit>' % (prop, kind, value, kind))
|
||||
parts.append(" </match>")
|
||||
parts.append("</fontconfig>")
|
||||
return "\n".join(parts) + "\n"
|
||||
|
||||
|
||||
def _fc_env(xdg_config_home: Path) -> dict:
|
||||
"""The environment ``fc-match`` runs in: the test's own, with the user's configuration folder of THIS launch, and without the variables the core strips."""
|
||||
env = {k: v for k, v in os.environ.items() if not k.startswith(("FONTCONFIG_", "FC_"))}
|
||||
env["XDG_CONFIG_HOME"] = str(xdg_config_home)
|
||||
return env
|
||||
|
||||
|
||||
def _fc_match(env: dict, pattern: str, fmt: str) -> str:
|
||||
done = subprocess.run(["fc-match", "-f", fmt, pattern], env=env, capture_output=True, text=True, timeout=60)
|
||||
return done.stdout.strip()
|
||||
|
||||
|
||||
def _what_fontconfig_says(xdg_config_home: Path) -> dict:
|
||||
"""What fontconfig itself says in the environment of this launch (the host tool, not the browser): the value of each property, the raw ``fc-match -v``
|
||||
lines of them, and the family it answers to ``system-ui`` (the pattern the engine builds)."""
|
||||
out = {}
|
||||
env = _fc_env(xdg_config_home)
|
||||
try:
|
||||
for key in PROPERTIES:
|
||||
out[key] = _fc_match(env, "sans", "%%{%s}" % key)
|
||||
verbose = subprocess.run(["fc-match", "-v", "sans"], env=env, capture_output=True, text=True, timeout=60).stdout
|
||||
out["raw"] = [line.strip() for line in verbose.splitlines() if line.strip().split(":", 1)[0] in PROPERTIES + ("hinting",)]
|
||||
out["system-ui_engine_pattern_family"] = _fc_match(env, ENGINE_PATTERN, "%{family}")
|
||||
out["system-ui_engine_pattern_asked"] = _fc_match(env, ENGINE_PATTERN, "%{pattern}")[:300]
|
||||
out["sans_family"] = _fc_match(env, "sans", "%{family}")
|
||||
except Exception as exc: # recorded; the precondition below then names it
|
||||
out["error"] = repr(exc)
|
||||
return out
|
||||
|
||||
|
||||
def _rule_in_force(name: str, said: dict, base_said: dict, host_family: str) -> dict:
|
||||
"""The precondition of a launch, decided BEFORE its engine starts: does fontconfig, in the environment of this launch, apply the rule? A launch whose
|
||||
rule is not in force measures nothing (it would equal launch 1 whatever the engine does)."""
|
||||
problems, notes = [], []
|
||||
if "error" in said:
|
||||
problems.append("fc-match could not be run: %s" % said["error"])
|
||||
for prop, want in EXPECTED_FC.get(name, {}).items():
|
||||
got = said.get(prop)
|
||||
if got == want:
|
||||
continue
|
||||
if got and got != base_said.get(prop):
|
||||
notes.append("%s prints %r, not %r, and it is not what launch 1 prints (%r): the form is uncertain, the move is not"
|
||||
% (prop, got, want, base_said.get(prop)))
|
||||
else:
|
||||
problems.append("%s: fc-match prints %r (launch 1 prints %r), the rule wants %r" % (prop, got, base_said.get(prop), want))
|
||||
if name == SYSTEM_UI_LAUNCH:
|
||||
got = said.get("system-ui_engine_pattern_family", "")
|
||||
if not got.startswith(host_family):
|
||||
problems.append("fc-match %s answers %r (launch 1: %r), the rule wants %r"
|
||||
% (ENGINE_PATTERN, got, base_said.get("system-ui_engine_pattern_family"), host_family))
|
||||
if got and got == base_said.get("system-ui_engine_pattern_family"):
|
||||
problems.append("fc-match %s answers %r, the same as with no rule: the rule moved nothing" % (ENGINE_PATTERN, got))
|
||||
return {"ok": not problems, "problems": problems, "notes": notes}
|
||||
|
||||
|
||||
def _engine_environ(binary: str, xdg_config_home: Path) -> dict:
|
||||
"""``XDG_CONFIG_HOME`` and any ``FONTCONFIG_*`` in the environment of every process of the engine (``/proc/<pid>/environ``): the rule reaches the
|
||||
engine only if the first is there with this launch's folder, and the core removes the second."""
|
||||
seen = {"processes": 0, "with_the_config_home": 0, "fontconfig_variables": []}
|
||||
try:
|
||||
real = os.path.realpath(binary)
|
||||
for entry in os.scandir("/proc"):
|
||||
if not entry.name.isdigit():
|
||||
continue
|
||||
try:
|
||||
argv0 = Path(entry.path, "cmdline").read_bytes().split(b"\0")[0].decode("utf-8", "replace")
|
||||
if os.path.realpath(argv0) != real:
|
||||
continue
|
||||
env = dict(item.partition(b"=")[::2] for item in Path(entry.path, "environ").read_bytes().split(b"\0") if item)
|
||||
except OSError:
|
||||
continue
|
||||
seen["processes"] += 1
|
||||
if env.get(b"XDG_CONFIG_HOME", b"").decode("utf-8", "replace") == str(xdg_config_home):
|
||||
seen["with_the_config_home"] += 1
|
||||
seen["fontconfig_variables"] += sorted(k.decode("utf-8", "replace") for k in env if k.startswith((b"FONTCONFIG_", b"FC_")))
|
||||
except Exception as exc:
|
||||
seen["error"] = repr(exc)
|
||||
return seen
|
||||
|
||||
|
||||
def _launch(binary: str, xdg_config_home: Path, url: str) -> dict:
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
result = {"xdg_config_home": str(xdg_config_home)}
|
||||
# The variable of THIS launch, in the environment of the process: the wrapper composes the engine's environment from it. A FONTCONFIG_FILE or
|
||||
# FONTCONFIG_PATH of the runner is taken off: with one of them, the system ``fonts.conf`` would not be read and the user's file would not either.
|
||||
with pytest.MonkeyPatch.context() as patch:
|
||||
patch.setenv("XDG_CONFIG_HOME", str(xdg_config_home))
|
||||
for variable in ("FONTCONFIG_FILE", "FONTCONFIG_PATH"):
|
||||
patch.delenv(variable, raising=False)
|
||||
with InvisiblePlaywright(seed=SEED, binary_path=binary, headless=True) as browser:
|
||||
page = browser.new_context().new_page()
|
||||
page.goto(url, timeout=30_000)
|
||||
result["rows"] = page.evaluate(ROWS_JS, [[[f, t] for f, t, _w in FONTS], SIZES])
|
||||
result["system_ui"] = page.evaluate(SYSTEM_UI_JS)
|
||||
result["engine_environ"] = _engine_environ(binary, xdg_config_home)
|
||||
return result
|
||||
|
||||
|
||||
def _by_row(rows) -> dict:
|
||||
return {(r["canvas"], r["font"], r["size"]): r for r in rows}
|
||||
|
||||
|
||||
def _compare(results: dict, base: str) -> dict:
|
||||
"""{launch: {canvas: [rows that differ from the base launch]}}."""
|
||||
ref = _by_row(results[base]["rows"])
|
||||
out = {}
|
||||
for name, res in results.items():
|
||||
mine = _by_row(res["rows"])
|
||||
out[name] = {canvas: sorted("%s %dpx" % (k[1], k[2]) for k, row in mine.items()
|
||||
if k[0] == canvas and row["sha256"] != ref[k]["sha256"]) for canvas in CANVASES}
|
||||
return out
|
||||
|
||||
|
||||
def _table(results: dict, base: str) -> str:
|
||||
diff = _compare(results, base)
|
||||
lines = ["", "launch x canvas -> vs %s (rows that differ / rows), subpixel pixels in total" % base]
|
||||
for name, res in results.items():
|
||||
cells = []
|
||||
for canvas in CANVASES:
|
||||
total = sum(r["subpixel"] for r in res["rows"] if r["canvas"] == canvas)
|
||||
rows = sum(1 for r in res["rows"] if r["canvas"] == canvas)
|
||||
d = diff[name][canvas]
|
||||
cells.append("%s: %s (%d/%d), subpixel %d" % (canvas, "same" if not d else "DIFFERENT", len(d), rows, total))
|
||||
lines.append(" %-26s %s" % (name, " | ".join(cells)))
|
||||
for name in results:
|
||||
for canvas in CANVASES:
|
||||
if diff[name][canvas]:
|
||||
lines.append(" %s %s differs in: %s" % (name, canvas, ", ".join(diff[name][canvas])))
|
||||
lines.append("system-ui reads:")
|
||||
for name in (base, SYSTEM_UI_LAUNCH):
|
||||
if name in results:
|
||||
lines.append(" %-26s %s" % (name, json.dumps(results[name]["system_ui"], sort_keys=True)))
|
||||
return "\n".join(lines)
|
||||
|
||||
|
||||
@pytest.fixture(scope="module")
|
||||
def launches(firefox_binary, tmp_path_factory):
|
||||
"""Every launch, once per module. -> {name: result}; the record is written before the assertions run."""
|
||||
for tool in ("fc-match",):
|
||||
if shutil.which(tool) is None:
|
||||
pytest.fail("needs %s (apt install fontconfig): without it no rule can be shown to be in force" % tool, pytrace=False)
|
||||
work = tmp_path_factory.mktemp("fcrules")
|
||||
face, host_family = next(((p, f) for p, f in HOST_FACE_CANDIDATES if os.path.exists(p)), (None, None))
|
||||
assert face, "no host face to put first for the system-ui launch: none of %r exists on this runner" % [p for p, _f in HOST_FACE_CANDIDATES]
|
||||
|
||||
server = _Server(("127.0.0.1", 0), _Handler)
|
||||
threading.Thread(target=server.serve_forever, daemon=True).start()
|
||||
url = "http://127.0.0.1:%d/" % server.server_address[1]
|
||||
results, fc = {}, {}
|
||||
try:
|
||||
for name, rules in LAUNCHES:
|
||||
xdg = work / name / "xdg-config"
|
||||
(xdg / "fontconfig").mkdir(parents=True)
|
||||
conf = xdg / "fontconfig" / "fonts.conf"
|
||||
conf.write_text(_config_text(name, rules, host_family), encoding="utf-8")
|
||||
# Before the engine starts: fontconfig in THIS environment. Its answer says whether the launch measures anything.
|
||||
fc[name] = _what_fontconfig_says(xdg)
|
||||
precondition = _rule_in_force(name, fc[name], fc.get(BASE_LAUNCH, fc[name]), host_family)
|
||||
results[name] = _launch(firefox_binary, xdg, url)
|
||||
results[name]["config"] = conf.read_text(encoding="utf-8")
|
||||
results[name]["fc_match"] = fc[name]
|
||||
results[name]["precondition"] = precondition
|
||||
finally:
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
try:
|
||||
record = {
|
||||
"seed": SEED, "host_face": face, "host_family": host_family, "fonts": [f for f, _t, _w in FONTS], "sizes": SIZES,
|
||||
"launches": results, "differences_vs_1": _compare(results, BASE_LAUNCH) if BASE_LAUNCH in results else None,
|
||||
}
|
||||
where = _evidence_dir()
|
||||
if where is not None:
|
||||
where.mkdir(parents=True, exist_ok=True)
|
||||
(where / "result.json").write_text(json.dumps(record, indent=1, sort_keys=True), encoding="utf-8")
|
||||
if BASE_LAUNCH in results:
|
||||
print(_table(results, BASE_LAUNCH))
|
||||
print("XDG_CONFIG_HOME seen in the engine's processes:",
|
||||
{n: (r.get("engine_environ") or {}).get("with_the_config_home") for n, r in results.items()})
|
||||
except Exception as exc: # a record never changes the outcome
|
||||
print("the record could not be written:", repr(exc))
|
||||
return results
|
||||
|
||||
|
||||
def _every_launch_measures_something(launches):
|
||||
"""The first assertion of every test: a launch whose rule fontconfig does not apply, or whose rule did not reach the engine, measures nothing,
|
||||
and the comparison would say "equal"."""
|
||||
assert set(launches) == {n for n, _r in LAUNCHES}, "not every launch ran: %s" % sorted(launches)
|
||||
for name, _rules in LAUNCHES:
|
||||
pre = launches[name]["precondition"]
|
||||
assert pre["ok"], "launch %s measures nothing: fontconfig does not apply its rule: %s (it said: %r)" % (
|
||||
name, "; ".join(pre["problems"]), launches[name]["fc_match"])
|
||||
seen = launches[name]["engine_environ"]
|
||||
assert seen.get("processes"), "launch %s: no process of the engine was seen in /proc (%r): the environment it ran in is not known" % (name, seen)
|
||||
assert seen["with_the_config_home"] > 0, (
|
||||
"launch %s measures nothing: XDG_CONFIG_HOME of the launch did not reach the engine (%r), so its rule could not be read" % (name, seen))
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_every_launch_has_its_rule_in_force_in_fontconfig_itself_and_in_the_engine_s_environment(launches):
|
||||
"""Without this the equalities below would say nothing: a configuration fontconfig ignores is equal to any other."""
|
||||
_every_launch_measures_something(launches)
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_the_fontconfig_rules_of_the_user_do_not_move_a_pixel_of_the_text_a_page_reads(launches):
|
||||
_every_launch_measures_something(launches)
|
||||
# The comparison is not empty: every row drew text.
|
||||
blank = [(n, k) for n, res in launches.items() for k, r in _by_row(res["rows"]).items() if r["ink"] == 0]
|
||||
assert not blank, "rows with no text drawn (a blank canvas equals any other): %r" % blank[:6]
|
||||
diff = _compare(launches, BASE_LAUNCH)
|
||||
moved = {n: d for n, d in diff.items() if n != BASE_LAUNCH and any(d.values())}
|
||||
assert not moved, (
|
||||
"the fontconfig rules of the user change the pixels of the text a page reads (rows that differ from launch 1, by launch and canvas): %s"
|
||||
% json.dumps(moved, sort_keys=True))
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_a_rule_of_the_user_on_system_ui_does_not_choose_the_face_a_page_reads(launches):
|
||||
_every_launch_measures_something(launches)
|
||||
first, other = launches[BASE_LAUNCH]["system_ui"], launches[SYSTEM_UI_LAUNCH]["system_ui"]
|
||||
assert first == other, (
|
||||
"a fontconfig rule on system-ui reaches what a page reads of it: launch 1 read %s, launch %s read %s"
|
||||
% (json.dumps(first, sort_keys=True), SYSTEM_UI_LAUNCH, json.dumps(other, sort_keys=True)))
|
||||
@@ -1,68 +1,33 @@
|
||||
"""The parent reads the bundle of fonts from fontconfig's cache and does not scan it again (e2e, Linux, from firefox-66).
|
||||
"""The engine writes and reads no fontconfig cache (e2e, Linux, from firefox-72; the file keeps the name and the test ids of the warm-cache test it was).
|
||||
|
||||
Why Linux only: fontconfig exists only there. On Windows the parent rebuilds a font from the path a text run carries with DirectWrite,
|
||||
which opens the file by its path and keeps no index of a folder; there is nothing to scan and nothing to cache, and this test has no
|
||||
Windows form (the row of ``ci/required-suites.json`` says so: ``linux_only``).
|
||||
Retired after the release of the 72: ``tests/test_the_host_fontconfig_rules_do_not_reach_the_text_pixels_linux_e2e.py`` (the rules of a user do not reach the pixels
|
||||
of the text) and ``tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py`` (no fontconfig file of the host is opened, the screenshot draws the bundle with the caches poisoned) replace it, and
|
||||
its entry in ``ci/retired-tests.json`` goes to main then. Until then it asserts the same principle on the simplest case, two launches with the same cache folder.
|
||||
|
||||
What the engine does. A screenshot sends each font of a text run to the parent as a path and a face index, and the parent turns it into
|
||||
a font again with fontconfig (``UnscaledFontFontconfig::CreateFromFontDescriptor``). For fontconfig to know the files of the bundle the
|
||||
parent gives it the folder ``<GRE>/fonts`` with ``FcConfigAppFontAddDir`` (``gfxFcPlatformFontList::ActivateBundledFonts``, which the
|
||||
shared font list of the parent calls first). On a COLD cache fontconfig opens and scans every file of the folder (about 121) and writes a
|
||||
cache under ``$XDG_CACHE_HOME/fontconfig``. On a WARM cache it must read that cache (a ``*.cache-*`` file) and NOT open the files again for
|
||||
the scan: it is the difference between a start that reads 121 fonts and a start that reads one file.
|
||||
Why Linux only: fontconfig exists only there. On Windows the parent rebuilds a font from the path a text run carries with DirectWrite, which opens the file by
|
||||
its path and keeps no index of a folder; there is nothing to scan and nothing to cache, and this test has no Windows form (the row of
|
||||
``ci/required-suites.json`` says so: ``linux_only``).
|
||||
|
||||
The measurement. Two launches of the same binary with the same ``XDG_CACHE_HOME``, a new folder of the test: the first is cold, the second
|
||||
warm. Each runs under ``strace -f -ttt`` (the stand-in of ``tests/_strace_stand_in.py``) that traces the opens of the browser. The environment reaches the browser as it does for a user: the test sets
|
||||
``XDG_CACHE_HOME`` in its own environment, and the core composes the engine's environment from it (``build_launch_env``: it removes the
|
||||
host's ``MOZ_*``, ``LANG``, ``TZ`` and the toolkit families, and nothing else); that the variable did arrive is shown by the cache that is
|
||||
written under it.
|
||||
What the engine does. It runs fontconfig on its own empty configuration: no ``fonts.conf``, no rule, no cache folder. It does not show ``<GRE>/fonts`` to
|
||||
fontconfig (the core declares ``gfx.bundled-fonts.activate=0`` on Linux), so nothing scans the folder and nothing writes a cache of it, and a screenshot takes the
|
||||
file and the face of each text run from the bundle's manifest. The engine neither writes nor reads a fontconfig cache, on a cold folder or a warm one.
|
||||
|
||||
Scan or drawing: the criterion. FreeType also opens a file of the bundle (``FT_New_Face`` from the path) when a text run is DRAWN, in the
|
||||
parent for the screenshot and in the content process for the page: those opens are not a scan and they happen in the warm launch too. The
|
||||
scan is made by the parent while it builds the font list, before there is a page. So the test counts only what the PARENT process opens
|
||||
between the start of the browser and the moment the wrapper has returned the launched browser, before any page is opened (``new_page``
|
||||
is not yet called). The point is a position in the strace log (its size when the launch returns), not a time: the log is written line by
|
||||
line, and everything the parent did to build its font list is before it. The opens after it (the page with every family of the
|
||||
screenshot test, and the screenshot) are measured as well and written to the evidence, as ``after_startup``, but the assertion does not
|
||||
read them.
|
||||
The measurement. Two launches of the same binary with the same ``XDG_CACHE_HOME`` and the same ``HOME``, both new folders of the test (the test sets them in
|
||||
its own environment, and the core composes the engine's environment from it; that they arrived is read from ``/proc/<pid>/environ`` of the parent). Each runs
|
||||
under ``strace -f`` (the stand-in of ``tests/_strace_stand_in.py``) and draws a page with every family of the screenshot test and takes a screenshot. The test asserts,
|
||||
for each launch:
|
||||
|
||||
Why "all or none" and not "none that the cold one opened". Even on a warm cache the parent opens a few files of the bundle before the
|
||||
first page, to USE them (the face blob of a font of its own interface is opened and mapped); those files are also in the cold set, so a
|
||||
test that asks for an empty intersection would be red for a good engine. What a scan is, is different: fontconfig scans a folder as a
|
||||
whole (``FcDirCacheScan`` opens every file of it) or reads the cache of the folder and opens none for the scan. So the test asks about
|
||||
the whole folder, as the disk lists it (no number written by hand):
|
||||
* no fontconfig cache file (``<md5>-<arch>.cache-<n>``, and the ``.NEW`` and ``.TMP-*`` it is written through) is under ``XDG_CACHE_HOME`` or ``HOME`` when the
|
||||
launch has ended: nothing was written, so the second launch finds nothing the first left;
|
||||
* no process of the browser OPENED such a file, in any folder, whatever the result of the open (an open of ``<md5>-le64.cache-9`` that is refused is a look for a
|
||||
cache all the same).
|
||||
|
||||
* the validity of the measurement: the cold parent opened EVERY font file of ``<GRE>/fonts`` in the window, and fontconfig wrote its
|
||||
cache under ``$XDG_CACHE_HOME/fontconfig``; otherwise the window does not see the scan and the test says it cannot judge;
|
||||
* the assertion, the only one that judges: in the same window the warm parent does NOT open every font file of the folder, and it
|
||||
opens a ``*.cache-*`` file under ``$XDG_CACHE_HOME/fontconfig``.
|
||||
The launch is valid only when the strace log has lines and the parent's environment carries the two folders: otherwise a clean result would say nothing. An open is
|
||||
counted whatever its result (strace splits a call that another thread interrupts in "PID openat(... <unfinished ...>" and "PID <... openat resumed>) = -1 ENOENT";
|
||||
an unfinished line with no resumed line is counted too, since the look happened).
|
||||
|
||||
The files of the folder that are not fonts (a ``.list``, a README) are left out of the list, explicitly: a font is a file whose name ends
|
||||
in one of ``FONT_EXTENSIONS`` (what fontconfig reads through FreeType); the evidence names the files that were left out. The files the
|
||||
warm parent opened are in the evidence, by name. No threshold: a set that is not the whole folder, and a file that is read.
|
||||
|
||||
Evidence, whatever the verdict: when ``RUNNER_TEMP`` is set the test writes ``result.json`` and, for each launch, the opens of the bundle
|
||||
by the parent with their time, under ``$RUNNER_TEMP/invpw-evidence/fontconfig-cache/``. For the cold and the warm launch (and for a
|
||||
third, "before", see below): the interval in seconds between the first and the last open of a file of ``<GRE>/fonts`` by the parent, how
|
||||
many opens, how many distinct files, the name and size of each file of fontconfig's cache, the ``VmRSS`` of the parent after
|
||||
``about:blank`` and after a page with every family of the screenshot test (drawn and screenshotted).
|
||||
|
||||
The third launch, "before", is evidence only: the engine with ``gfx.bundled-fonts.activate`` = 0 never shows the folder to fontconfig (the
|
||||
pref is Mozilla's, ``mirror: once``, read at start; ``ActivateBundledFonts`` is under ``!= 0``), which is what the parent did before the
|
||||
correction. The core does not declare that pref anywhere, so the caller's ``extra_prefs`` (applied last, ``_apply_caller_overlay``) is
|
||||
the only place that says it. If that launch fails, its error is in the evidence and nothing else changes.
|
||||
|
||||
What is a cache "of the bundle", and what is an open that happened. fontconfig names the cache of a folder by the md5 of the folder's
|
||||
path (``<md5>-le64.cache-9``), so the cache of the bundle is the file whose name starts with the md5 of ``<GRE>/fonts`` (and, in the same
|
||||
launch, with the name fontconfig itself prints for that folder, ``FC_DEBUG=16``); a ``*.cache-*`` file of a system folder
|
||||
(``/usr/share/fonts``...) is a different cache and proves nothing about the bundle. An open counts only when its result is on the log:
|
||||
strace splits a call that another thread interrupts in "PID openat(... <unfinished ...>" and "PID <... openat resumed>) = -1 ENOENT", the
|
||||
result is on the second line, and an unfinished line with no resumed line has no result and is not counted either way.
|
||||
|
||||
The evidence of a launch (when ``RUNNER_TEMP`` is set) also holds what fontconfig says: the browser runs with ``FC_DEBUG=16`` (what it
|
||||
does with caches: the folders it examines, the caches it finds valid, the writes), strace saves the writes to the descriptors 1 and 2
|
||||
(``fc-debug-<launch>.txt``), and ``trace-<launch>.tsv`` has every open of a ``*.cache-*`` file or of a ``CACHEDIR.TAG`` by any process, in any
|
||||
folder, and every line that names the bundle's folder or the cache folder: where fontconfig found a valid cache is on it.
|
||||
Evidence, whatever the verdict: when ``RUNNER_TEMP`` is set the test writes ``result.json`` under ``$RUNNER_TEMP/invpw-evidence/fontconfig-cache/``: for each launch, the
|
||||
environment of the parent, what is under the two folders, and every open of a cache file with the role of its process.
|
||||
|
||||
Run: pytest tests/test_the_parent_reads_the_bundle_from_fontconfig_s_cache_linux_e2e.py -m e2e -v
|
||||
"""
|
||||
@@ -83,6 +48,7 @@ import pytest
|
||||
|
||||
from _waits import wait_until
|
||||
from test_a_screenshot_draws_the_text_of_the_bundled_fonts_as_the_content_does_e2e import EVIDENCE_FOLDER, FAMILIES
|
||||
from test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e import _CACHE_FILE, OPEN_CALLS, paths_of_calls
|
||||
from _strace_stand_in import (
|
||||
_detached, _group_members, _group_of, _kill_group, _LINE, _require_strace_can_trace, _RESUMED, _roles, _stand_in, _wait_for_exit)
|
||||
|
||||
@@ -91,21 +57,11 @@ pytestmark = [
|
||||
pytest.mark.skipif(not sys.platform.startswith("linux"), reason="fontconfig is the Linux font system"),
|
||||
]
|
||||
|
||||
#: Opens, and what is needed to tell the parent from a content process (``_roles`` reads the execve and the clones).
|
||||
TRACE = "execve,clone,clone3,fork,vfork,openat,openat2,write"
|
||||
|
||||
#: What fontconfig prints with ``FC_DEBUG=16`` goes to the descriptor 1 (the core reads it as the browser's output, and keeps 200 lines): the
|
||||
#: strace log also holds the ``write`` calls, and ``_fc_debug_text`` keeps those to the descriptors 1 and 2. NOT ``--trace-fds=1,2``: it
|
||||
#: filters EVERY traced call by descriptor, so the execve, clone and openat lines (which the parent's identity and the opens are read
|
||||
#: from) are gone and the test saw no parent (candidate run 44749623531).
|
||||
FC_DEBUG = "16"
|
||||
#: What is traced: the opens (what the test judges), the writes (``_fc_debug_text`` reads the descriptors 1 and 2), and the execve and clones (the role of a process).
|
||||
TRACE = "execve,clone,clone3,fork,vfork,open,openat,openat2,write"
|
||||
|
||||
SEED = 21
|
||||
|
||||
#: What counts as a font of the bundle in the folder ``<GRE>/fonts``: the extensions of the files fontconfig reads through FreeType. Any
|
||||
#: other file of the folder (a ``.list``, a README) is not a font and is left out of the list, and the evidence says which ones.
|
||||
FONT_EXTENSIONS = (".ttf", ".ttc", ".otf", ".otc", ".pfb", ".pfa", ".pcf", ".pcf.gz", ".bdf", ".woff", ".woff2", ".pfr", ".fon", ".fnt")
|
||||
|
||||
#: ``strace -f -ttt``: "PID EPOCH call(...". ``_LINE`` and ``_roles`` read "PID call(...", so the epoch is taken off first and kept apart.
|
||||
_STAMPED = re.compile(r"^(\d+)\s+(\d+\.\d+)\s+(.*)$")
|
||||
_QUOTED = re.compile(r'"([^"]*)"')
|
||||
@@ -132,13 +88,6 @@ def _evidence_dir():
|
||||
return Path(base) / EVIDENCE_FOLDER / "fontconfig-cache" if base else None
|
||||
|
||||
|
||||
def _vmrss_kb(pid: int) -> int:
|
||||
for line in Path("/proc/%d/status" % pid).read_text().splitlines():
|
||||
if line.startswith("VmRSS:"):
|
||||
return int(line.split()[1])
|
||||
raise AssertionError("no VmRSS in /proc/%d/status" % pid)
|
||||
|
||||
|
||||
def _read(log: Path, real: str, boundary: int = None):
|
||||
"""``(lines, times, role, argv_of, start)`` of a strace log: the lines without their epoch, the epoch of each, the role of a pid,
|
||||
the execve of each, and the index of the first line that is NOT in the window of the start (``boundary`` is the size of the log
|
||||
@@ -242,17 +191,6 @@ def _fc_debug_text(lines, role) -> str:
|
||||
return "\n".join(out)
|
||||
|
||||
|
||||
def _summary(opens):
|
||||
made = [o for o in opens if o["ok"]]
|
||||
stamps = [o["t"] for o in made if o["t"] is not None]
|
||||
return {
|
||||
"opens": len(made),
|
||||
"distinct_files": len({o["path"] for o in made}),
|
||||
"refused_opens": len(opens) - len(made),
|
||||
"first_to_last_s": round(max(stamps) - min(stamps), 6) if stamps else None,
|
||||
}
|
||||
|
||||
|
||||
def _environ_of(pid: int, name: str):
|
||||
"""The value of ``name`` in the environment the process ``pid`` was started with (``/proc/<pid>/environ``); None when it has none or
|
||||
the file cannot be read."""
|
||||
@@ -266,116 +204,48 @@ def _environ_of(pid: int, name: str):
|
||||
return None
|
||||
|
||||
|
||||
def _fontconfig_cache(xdg: Path):
|
||||
folder = xdg / "fontconfig"
|
||||
if not folder.is_dir():
|
||||
return []
|
||||
return sorted(({"name": f.name, "bytes": f.stat().st_size} for f in folder.iterdir() if f.is_file()), key=lambda f: f["name"])
|
||||
def _cache_files_under(*folders: Path) -> list:
|
||||
"""The fontconfig cache files (``*.cache-<n>``, ``.NEW``, ``.TMP-*``) anywhere under the folders, as the disk lists them."""
|
||||
found = []
|
||||
for folder in folders:
|
||||
for root, _dirs, files in os.walk(folder):
|
||||
found.extend(os.path.join(root, name) for name in files if _CACHE_FILE.search(name))
|
||||
return sorted(found)
|
||||
|
||||
|
||||
def _the_folder(gre_fonts: str):
|
||||
"""``(fonts, left_out)``: the names of the files of the folder as the DISK lists them, split by ``FONT_EXTENSIONS``."""
|
||||
names = sorted(e.name for e in os.scandir(gre_fonts) if e.is_file()) if os.path.isdir(gre_fonts) else []
|
||||
fonts = [n for n in names if n.lower().endswith(FONT_EXTENSIONS)]
|
||||
return fonts, [n for n in names if n not in fonts]
|
||||
|
||||
|
||||
def _launch(firefox_binary, work: Path, xdg: Path, extra_prefs=None):
|
||||
"""One launch of the binary under strace, with ``XDG_CACHE_HOME`` = ``xdg`` in the environment of the test. Returns what the log and
|
||||
/proc say; the browser is gone when it returns."""
|
||||
def _launch(firefox_binary, work: Path, xdg: Path, home: Path):
|
||||
"""One launch of the binary under strace, with ``XDG_CACHE_HOME`` = ``xdg`` and ``HOME`` = ``home`` in the environment of the test. Returns what the log, /proc and the
|
||||
disk say; the browser is gone when it returns."""
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
|
||||
work.mkdir(parents=True)
|
||||
log, pidfile = work / "strace.log", work / "stand-in.pid"
|
||||
stand_in = _stand_in(firefox_binary, work / "engine", log, pidfile, syscalls=TRACE, timestamps=True)
|
||||
stand_in = _stand_in(firefox_binary, work / "engine", log, pidfile, syscalls=TRACE)
|
||||
real = os.path.realpath(firefox_binary)
|
||||
gre_fonts = os.path.join(os.path.dirname(real), "fonts")
|
||||
rss, boundary, pid, environ_xdg = {}, None, None, None
|
||||
pid, environ = None, {}
|
||||
try:
|
||||
with InvisiblePlaywright(seed=SEED, binary_path=stand_in, headless=True, extra_prefs=extra_prefs) as browser:
|
||||
# The launch has returned: the parent has built its font list. No page has been opened yet.
|
||||
boundary = log.stat().st_size
|
||||
_lines, _times, _role, argv_of, _start = _read(log, real, boundary)
|
||||
with InvisiblePlaywright(seed=SEED, binary_path=stand_in, headless=True) as browser:
|
||||
_lines, _times, _role, argv_of, _start = _read(log, real)
|
||||
pid = _parent_pid(argv_of, real)
|
||||
environ_xdg = _environ_of(pid, "XDG_CACHE_HOME")
|
||||
environ = {name: _environ_of(pid, name) for name in ("XDG_CACHE_HOME", "HOME")}
|
||||
page = browser.new_page()
|
||||
rss["after_about_blank_kb"] = _vmrss_kb(pid)
|
||||
page.set_content(_page_with_every_family())
|
||||
assert page.evaluate("() => document.body.getBoundingClientRect().width") > 0
|
||||
page.screenshot()
|
||||
rss["after_every_family_kb"] = _vmrss_kb(pid)
|
||||
finally:
|
||||
_kill_group(pidfile)
|
||||
|
||||
lines, times, role, _argv_of, start = _read(log, real, boundary)
|
||||
under = sorted({gre_fonts, os.path.realpath(gre_fonts)})
|
||||
results = _results_of_unfinished(lines)
|
||||
scan = _opens_of_the_parent(lines, times, role, 0, start, under, results)
|
||||
later = _opens_of_the_parent(lines, times, role, start, len(lines), under, results)
|
||||
fc_debug = _fc_debug_text(lines, role)
|
||||
prefixes = _bundle_cache_prefixes(under, fc_debug)
|
||||
fonts, left_out = _the_folder(gre_fonts)
|
||||
opened = sorted({os.path.basename(o["path"]) for o in scan if o["ok"]})
|
||||
cache_dir = str(xdg / "fontconfig")
|
||||
# Evidence for a launch whose cache is missing: every line of the log, by ANY process, that names the bundle's folder, the cache
|
||||
# folder or a ``.uuid``, with the role of the process and the window it is in (the opens above count only the parent's, and only
|
||||
# in the window). The raw lines say who scanned (or did not), and where fontconfig wrote.
|
||||
trace = []
|
||||
for i, line in enumerate(lines):
|
||||
if any(u in line for u in under) or cache_dir in line or "/.uuid" in line:
|
||||
m = _LINE.match(line) or re.match(r"^(\d+)\s", line)
|
||||
who = role(int(m.group(1))) if m else "?"
|
||||
trace.append("%s\t%s\t%s\t%s" % (times[i], "startup" if i < start else "later", who, line[:400]))
|
||||
# The reads of the cache of the BUNDLE (not of a system folder), by the parent in the window: under the cache folder, and anywhere.
|
||||
cache_reads = [o for o in _opens_of_the_parent(lines, times, role, 0, start, [cache_dir], results)
|
||||
if o["ok"] and _is_a_cache_of(o["path"], prefixes)]
|
||||
anywhere = []
|
||||
for i, line in enumerate(lines[:start]):
|
||||
m = _LINE.match(line)
|
||||
if m and m.group(2) in ("openat", "openat2") and role(int(m.group(1))) == "parent":
|
||||
quoted = _QUOTED.findall(m.group(3))
|
||||
if quoted and _is_a_cache_of(quoted[0], prefixes) and (_open_result(lines, i, results) or -1) >= 0:
|
||||
anywhere.append(quoted[0])
|
||||
# Every open of a cache file or of a CACHEDIR.TAG by any process, in any folder, with its result: where fontconfig found a valid cache.
|
||||
cache_opens = []
|
||||
for i, line in enumerate(lines):
|
||||
m = _LINE.match(line)
|
||||
if m and m.group(2) in ("openat", "openat2"):
|
||||
quoted = _QUOTED.findall(m.group(3))
|
||||
if quoted and (".cache-" in quoted[0] or "CACHEDIR.TAG" in quoted[0]):
|
||||
result = _open_result(lines, i, results)
|
||||
cache_opens.append("%s\t%s\t%s\t%s\t%s" % (
|
||||
times[i], "startup" if i < start else "later", role(int(m.group(1))),
|
||||
"no-result" if result is None else ("ok" if result >= 0 else "refused"), quoted[0]))
|
||||
trace = cache_opens + trace
|
||||
lines, _times, role, _argv_of, _start = _read(log, real)
|
||||
opened = [dict(call, role=role(call["pid"])) for call in paths_of_calls(lines, OPEN_CALLS) if _CACHE_FILE.search(os.path.basename(call["path"]))]
|
||||
return {
|
||||
"parent_pid": pid,
|
||||
"parent_environ_xdg_cache_home": environ_xdg,
|
||||
"startup": _summary(scan),
|
||||
"after_startup": _summary(later),
|
||||
"cache_files_read_at_startup": sorted({o["path"] for o in cache_reads}),
|
||||
"bundle_cache_read_anywhere_at_startup": sorted(set(anywhere)),
|
||||
"bundle_cache_names": sorted(prefixes),
|
||||
"bundle_cache_written": [f for f in _fontconfig_cache(xdg) if _is_a_cache_of(f["name"], prefixes)],
|
||||
"fc_debug_about_the_bundle": [l for l in fc_debug.splitlines() if any(u in l for u in under)],
|
||||
"_fc_debug": fc_debug,
|
||||
"fontconfig_cache": _fontconfig_cache(xdg),
|
||||
"vmrss_kb": rss,
|
||||
"bundle_font_files": len(fonts),
|
||||
"files_left_out_as_not_fonts": left_out,
|
||||
"font_files_opened_at_startup": len([n for n in opened if n in fonts]),
|
||||
"font_files_not_opened_at_startup": [n for n in fonts if n not in opened],
|
||||
"files_opened_at_startup": opened,
|
||||
"_scan_opens": scan,
|
||||
"_later_opens": later,
|
||||
"_trace": trace,
|
||||
"parent_environ": environ,
|
||||
"log_lines": len(lines),
|
||||
"cache_files_under_the_two_folders": _cache_files_under(xdg, home),
|
||||
"cache_file_opens": opened,
|
||||
}
|
||||
|
||||
|
||||
def _public(measure: dict) -> dict:
|
||||
return {k: v for k, v in measure.items() if not k.startswith("_")}
|
||||
|
||||
|
||||
@pytest.mark.timeout(120, method="thread")
|
||||
def test_the_stand_in_stays_in_the_engine_s_place_and_its_group_is_killed_whole(tmp_path):
|
||||
"""The tool, without a browser. A fake engine (a script that starts a child and waits for it) is launched through the stand-in
|
||||
@@ -421,71 +291,46 @@ def test_the_stand_in_stays_in_the_engine_s_place_and_its_group_is_killed_whole(
|
||||
|
||||
|
||||
@pytest.mark.timeout(900, method="thread")
|
||||
def test_the_warm_parent_reads_the_bundle_from_fontconfig_cache_and_does_not_scan_it(firefox_binary, engine_at_least, tmp_path, monkeypatch):
|
||||
engine_at_least("firefox-66")
|
||||
def test_the_warm_parent_reads_the_bundle_from_fontconfig_cache_and_does_not_scan_it(firefox_binary, tmp_path, monkeypatch):
|
||||
"""The id is the one of the warm-cache test this file was; what it asserts is the 72's behaviour (see the docstring of the module)."""
|
||||
if shutil.which("strace") is None:
|
||||
pytest.fail("needs strace (apt install strace): without it nothing is measured", pytrace=False)
|
||||
_require_strace_can_trace(tmp_path)
|
||||
|
||||
xdg = tmp_path / "xdg-cache"
|
||||
xdg, home = tmp_path / "xdg-cache", tmp_path / "home"
|
||||
xdg.mkdir()
|
||||
home.mkdir()
|
||||
monkeypatch.setenv("XDG_CACHE_HOME", str(xdg))
|
||||
monkeypatch.setenv("FC_DEBUG", FC_DEBUG) # it only prints; the core passes it to the browser as it passes XDG_CACHE_HOME
|
||||
monkeypatch.setenv("HOME", str(home))
|
||||
for variable in ("FONTCONFIG_FILE", "FONTCONFIG_PATH"):
|
||||
monkeypatch.delenv(variable, raising=False)
|
||||
|
||||
cold = _launch(firefox_binary, tmp_path / "cold", xdg)
|
||||
cold_cache = cold["fontconfig_cache"]
|
||||
warm = _launch(firefox_binary, tmp_path / "warm", xdg)
|
||||
first = _launch(firefox_binary, tmp_path / "first", xdg, home)
|
||||
second = _launch(firefox_binary, tmp_path / "second", xdg, home)
|
||||
launches = {"first": first, "second": second}
|
||||
|
||||
# "Before": the folder is never shown to fontconfig. Its own cache folder, so that it is not warmed by the others.
|
||||
before_xdg = tmp_path / "xdg-cache-before"
|
||||
before_xdg.mkdir()
|
||||
monkeypatch.setenv("XDG_CACHE_HOME", str(before_xdg))
|
||||
try:
|
||||
before = _launch(firefox_binary, tmp_path / "before", before_xdg, extra_prefs={"gfx.bundled-fonts.activate": 0})
|
||||
except Exception as err: # evidence only: a launch that fails is written down, it does not change the verdict
|
||||
before = {"error": "%s: %s" % (type(err).__name__, str(err)[:600])}
|
||||
|
||||
result = {
|
||||
"test": "the-parent-reads-the-bundle-from-fontconfig-cache",
|
||||
"platform": sys.platform,
|
||||
"seed": SEED,
|
||||
"xdg_cache_home": str(xdg),
|
||||
"criterion": ("window = what the PARENT opens before any page is opened (the strace log up to its size when the launch returned; "
|
||||
"the opens after it are drawing and are in after_startup). Valid: the cold parent opened every font file of "
|
||||
"<GRE>/fonts and fontconfig wrote its cache. Verdict: the warm parent does not open every font file of the folder "
|
||||
"and opens a *.cache-* file. Font files = the folder as the disk lists it, by FONT_EXTENSIONS"),
|
||||
"cold": _public(cold),
|
||||
"warm": _public(warm),
|
||||
"before_gfx_bundled_fonts_activate_0": _public(before) if "error" not in before else before,
|
||||
}
|
||||
where = _evidence_dir()
|
||||
if where is not None:
|
||||
where.mkdir(parents=True, exist_ok=True)
|
||||
(where / "result.json").write_text(json.dumps(result, indent=1, sort_keys=True) + "\n", encoding="utf-8")
|
||||
for name, measure in (("cold", cold), ("warm", warm), ("before", before)):
|
||||
if "_scan_opens" in measure:
|
||||
rows = ["%s\t%s\t%s" % (o["t"], "ok" if o["ok"] else "refused", o["path"])
|
||||
for o in measure["_scan_opens"] + measure["_later_opens"]]
|
||||
(where / ("bundle-opens-%s.tsv" % name)).write_text("\n".join(rows) + "\n", encoding="utf-8")
|
||||
(where / ("trace-%s.tsv" % name)).write_text("\n".join(measure["_trace"]) + "\n", encoding="utf-8")
|
||||
(where / ("fc-debug-%s.txt" % name)).write_text(measure["_fc_debug"] + "\n", encoding="utf-8")
|
||||
try:
|
||||
where.mkdir(parents=True, exist_ok=True)
|
||||
(where / "result.json").write_text(json.dumps(
|
||||
{"test": "the-engine-writes-and-reads-no-fontconfig-cache", "platform": sys.platform, "seed": SEED,
|
||||
"xdg_cache_home": str(xdg), "home": str(home), "launches": launches}, indent=1, sort_keys=True) + "\n", encoding="utf-8")
|
||||
except Exception as exc: # a record never changes the outcome
|
||||
print("the record could not be written:", repr(exc))
|
||||
|
||||
# The measurement is valid or the test says it cannot judge.
|
||||
assert cold["bundle_cache_written"], (
|
||||
"the cold launch wrote no cache of the bundle under XDG_CACHE_HOME=%s (there: %s; the names of a cache of the bundle: %s). "
|
||||
"XDG_CACHE_HOME in the parent's environment: %s. Cache of the bundle opened by the parent before a page, in any folder: %s. "
|
||||
"What fontconfig printed about the folder of the bundle (FC_DEBUG=16): %s. The window: %s. Nothing for a warm launch to read."
|
||||
% (xdg, [f["name"] for f in cold_cache] or "nothing", cold["bundle_cache_names"], cold["parent_environ_xdg_cache_home"],
|
||||
cold["bundle_cache_read_anywhere_at_startup"] or "none", cold["fc_debug_about_the_bundle"] or "nothing (or FC_DEBUG not saved)",
|
||||
cold["startup"]))
|
||||
assert not cold["font_files_not_opened_at_startup"] and cold["bundle_font_files"], (
|
||||
"the parent of the cold launch did not open every font file of <GRE>/fonts (%d of %d) before a page was opened: the window does "
|
||||
"not see the scan; the test cannot judge. Not opened: %s"
|
||||
% (cold["font_files_opened_at_startup"], cold["bundle_font_files"], cold["font_files_not_opened_at_startup"][:5]))
|
||||
|
||||
scanned_again = not warm["font_files_not_opened_at_startup"]
|
||||
assert not scanned_again and warm["cache_files_read_at_startup"], (
|
||||
"the warm parent %s. Cold: %s. Warm: %s. Cache under %s: cold %s, warm %s."
|
||||
% ("opened every one of the %d font files of <GRE>/fonts before a page: it scanned the folder again"
|
||||
% warm["bundle_font_files"] if scanned_again else "read no *.cache-* file of fontconfig at its start",
|
||||
result["cold"]["startup"], result["warm"]["startup"], xdg / "fontconfig", cold_cache, warm["fontconfig_cache"]))
|
||||
# The measurement is valid or the test says it cannot judge: the browser was traced, and the two folders reached its parent.
|
||||
for name, launch in launches.items():
|
||||
assert launch["log_lines"] > 0, "%s launch: strace wrote nothing, the browser was not traced" % name
|
||||
assert launch["parent_environ"] == {"XDG_CACHE_HOME": str(xdg), "HOME": str(home)}, (
|
||||
"%s launch: the parent's environment carries %r, not the folders of the test (XDG_CACHE_HOME=%s, HOME=%s): a clean result would say nothing"
|
||||
% (name, launch["parent_environ"], xdg, home))
|
||||
# The assertions: nothing written, nothing opened, on either launch.
|
||||
for name, launch in launches.items():
|
||||
assert not launch["cache_files_under_the_two_folders"], (
|
||||
"%s launch: fontconfig cache files were written under XDG_CACHE_HOME or HOME: %s"
|
||||
% (name, launch["cache_files_under_the_two_folders"][:6]))
|
||||
assert not launch["cache_file_opens"], (
|
||||
"%s launch: %d open(s) of a fontconfig cache file by the browser, by role %s: %s"
|
||||
% (name, len(launch["cache_file_opens"]), sorted({o["role"] for o in launch["cache_file_opens"]}),
|
||||
[(o["role"], o["call"], o["path"], o["result"]) for o in launch["cache_file_opens"][:6]]))
|
||||
@@ -0,0 +1,75 @@
|
||||
"""The wrapper's own list of known Mozilla defects (ci/mozilla-defects.json) is a list the core's matcher accepts, and it names the crash the A/A control of the A/B oracle met.
|
||||
|
||||
The matcher is the copy of the core's main beside the evidence (tests/data/known_mozilla_defects/, with its sha256 in `sources.json`); the tests do not use the network. The record
|
||||
of the crash is built from the real gdb text of the core that run 46539190316 left: the `FSBroker` thread of a `-backgroundtask` process at its exit.
|
||||
"""
|
||||
from __future__ import annotations
|
||||
|
||||
import importlib.util
|
||||
import json
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "scripts"))
|
||||
import ci_crash_evidence as crash # noqa: E402
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
ROOT = Path(__file__).resolve().parents[1]
|
||||
DATA = Path(__file__).resolve().parent / "data" / "known_mozilla_defects"
|
||||
CORE = "core.FSBroker14298.14187.1796087906"
|
||||
|
||||
|
||||
@pytest.fixture()
|
||||
def matcher(tmp_path):
|
||||
path = tmp_path / "ci_mozilla_defects.py"
|
||||
path.write_bytes((DATA / "ci_mozilla_defects.py.txt").read_bytes())
|
||||
spec = importlib.util.spec_from_file_location("ci_mozilla_defects_copy", str(path))
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
spec.loader.exec_module(module)
|
||||
module.path = path
|
||||
return module
|
||||
|
||||
|
||||
def the_crash() -> dict:
|
||||
return crash.crash_record((DATA / "gdb-core.FSBroker14298.14187.1796087906.txt").read_text(encoding="utf-8"), CORE, None, 1796087900.0)
|
||||
|
||||
|
||||
def test_the_list_is_a_list_the_matchers_check_accepts_for_the_engine_it_was_seen_on(matcher):
|
||||
rows = matcher.load(ROOT / "ci" / "mozilla-defects.json")
|
||||
assert matcher.problems(rows, "159.0") == [] and matcher.problems(rows, "159.0.1") == []
|
||||
assert matcher.problems(rows, "160.0"), "the port that moves the engine re-justifies the row or drops it"
|
||||
|
||||
|
||||
def test_the_list_holds_d31_and_names_no_frame_because_the_top_frames_depend_on_the_runner(matcher):
|
||||
rows = matcher.load(ROOT / "ci" / "mozilla-defects.json")
|
||||
assert [row["id"] for row in rows] == ["D31"]
|
||||
signature = rows[0]["signature"]
|
||||
assert signature == {"process": "backgroundtask", "phase": "exit", "thread": "FSBroker",
|
||||
"reason": "MOZ_CRASH(mozilla::detail::MutexImpl::mutexLock: pthread_mutex_lock failed)"}
|
||||
assert rows[0]["firefox"] == {"from": "159.0", "to": "159.*"} and rows[0]["seen"].endswith("/actions/runs/46539190316/job/142310624770")
|
||||
|
||||
|
||||
def test_the_crash_of_the_real_core_matches_d31_and_no_other_core_does(matcher):
|
||||
rows = matcher.load(ROOT / "ci" / "mozilla-defects.json")
|
||||
assert matcher.match(rows, "159.0", the_crash())["id"] == "D31"
|
||||
for change in ({"thread": "Socket Thread"}, {"phase": "run"}, {"process": "gpu"}, {"reason": "MOZ_CRASH(x)"}):
|
||||
assert matcher.match(rows, "159.0", dict(the_crash(), **change)) is None
|
||||
|
||||
|
||||
def test_the_a_a_judges_the_core_of_d31_with_the_list_of_the_wrapper_and_is_not_red(matcher, tmp_path, monkeypatch):
|
||||
engine = tmp_path / "engine"
|
||||
engine.mkdir()
|
||||
(engine / "application.ini").write_text("[App]\nVersion=159.0\n", encoding="utf-8")
|
||||
monkeypatch.setenv(crash.MATCHER_ENV, str(matcher.path))
|
||||
launch = {"n": 9, "label": {"seed": 63, "dpr": 1.5, "launch": "ab-visit"}, "returncode": 0, "cores": [CORE, CORE], "dmp": [],
|
||||
"crash_records": [{"core": CORE, "record": the_crash()}]}
|
||||
notes: list = []
|
||||
assert crash.exit_problems([launch], "firefox-70-again", False, notes=notes, measurements_complete=True, binary=str(engine / "firefox")) == []
|
||||
assert len(notes) == 1 and notes[0].startswith("known Mozilla defect D31 (not filed): ")
|
||||
assert crash.DEFECTS_LIST == ROOT / "ci" / "mozilla-defects.json"
|
||||
lines = crash.exit_problems([launch], "firefox-70-again", False, notes=[], measurements_complete=False, missing=["no dump of dpr1.0_seed64"], binary=str(engine / "firefox"))
|
||||
assert lines and "the crash matched D31" in "\n".join(lines) and "no dump of dpr1.0_seed64" in "\n".join(lines)
|
||||
assert json.loads((ROOT / "ci" / "mozilla-defects.json").read_text(encoding="utf-8"))[0]["id"] == "D31"
|
||||
@@ -77,6 +77,14 @@ NUMERIC_JS = """() => {
|
||||
r[name] = {value: view ? Array.from(v) : v,
|
||||
type: v === null ? "null" : (view ? v.constructor.name : typeof v), error};
|
||||
}
|
||||
// The evaluate world has constructors of its own: a bare `Float32Array` here is that world's, and the
|
||||
// page's typed array (ours or Mozilla's) has the page's prototype, so `instanceof Float32Array` is false
|
||||
// for every one of them. The page's own class is `window.Float32Array`.
|
||||
const PageFloat32Array = window.Float32Array;
|
||||
// DEPTH_RANGE is not overridden by the engine, so it is the control: true on both contexts.
|
||||
r.float32 = {depth_range_control: gl.getParameter(gl.DEPTH_RANGE) instanceof PageFloat32Array,
|
||||
line_width: gl.getParameter(gl.ALIASED_LINE_WIDTH_RANGE) instanceof PageFloat32Array,
|
||||
point_size: gl.getParameter(gl.ALIASED_POINT_SIZE_RANGE) instanceof PageFloat32Array};
|
||||
out[kind] = r;
|
||||
}
|
||||
return out;
|
||||
@@ -209,6 +217,42 @@ STENCIL_JS = """() => {
|
||||
}"""
|
||||
|
||||
|
||||
#: What a page that writes a mask wider than the stencil bits reads back, one fresh WebGL1 context
|
||||
#: per case (the context's own state is the thing read, so no case sees another's writes).
|
||||
STENCIL_WIDE_JS = """() => {
|
||||
const PNAMES = {STENCIL_VALUE_MASK: 0x0B93, STENCIL_WRITEMASK: 0x0B98,
|
||||
STENCIL_BACK_VALUE_MASK: 0x8CA4, STENCIL_BACK_WRITEMASK: 0x8CA5};
|
||||
const read = gl => {
|
||||
const r = {};
|
||||
for (const [name, pname] of Object.entries(PNAMES)) r[name] = gl.getParameter(pname);
|
||||
r.error = gl.getError();
|
||||
return r;
|
||||
};
|
||||
const fresh = () => document.createElement("canvas").getContext("webgl");
|
||||
const out = {};
|
||||
let gl = fresh();
|
||||
if (!gl) return null;
|
||||
gl.getError();
|
||||
gl.stencilMask(0x1ff);
|
||||
out.mask = read(gl);
|
||||
gl.stencilFunc(gl.ALWAYS, 0, 0x1ff);
|
||||
out.mask_then_func = read(gl);
|
||||
gl = fresh();
|
||||
gl.getError();
|
||||
gl.stencilMaskSeparate(gl.BACK, 0x2ff);
|
||||
out.mask_back = read(gl);
|
||||
gl = fresh();
|
||||
gl.getError();
|
||||
gl.stencilFuncSeparate(gl.BACK, gl.ALWAYS, 0, 0x3ff);
|
||||
out.func_back = read(gl);
|
||||
gl = fresh();
|
||||
gl.getError();
|
||||
gl.stencilMask(-1);
|
||||
out.mask_minus_one = read(gl);
|
||||
return out;
|
||||
}"""
|
||||
|
||||
|
||||
def _read(firefox_binary, prefs, js):
|
||||
"""One short-lived product session with ``prefs`` overlaid, and what the page answers to ``js``."""
|
||||
from invisible_playwright import InvisiblePlaywright
|
||||
@@ -242,6 +286,16 @@ def test_declared_numeric_parameters_replace_the_hosts_and_webgl2_only_names_sta
|
||||
}
|
||||
want_webgl2_only = {"MAX_3D_TEXTURE_SIZE": 4321, "MAX_ARRAY_TEXTURE_LAYERS": 777}
|
||||
|
||||
# The control first: DEPTH_RANGE is not overridden by the engine, so it is a Float32Array of the page's realm.
|
||||
for kind in ("webgl", "webgl2"):
|
||||
assert declared[kind]["float32"]["depth_range_control"] is True, (
|
||||
"%s: DEPTH_RANGE, which nothing overrides, is not an instance of the page's Float32Array: "
|
||||
"the check is not in the page's realm: %r" % (kind, declared[kind]["float32"]))
|
||||
# The two ranges are Float32Array of the page's own realm, as on retail (not only an array-like of that name).
|
||||
for kind in ("webgl", "webgl2"):
|
||||
got32 = declared[kind]["float32"]
|
||||
assert (got32["line_width"], got32["point_size"]) == (True, True), (kind, got32)
|
||||
|
||||
for kind in ("webgl", "webgl2"):
|
||||
for name, (value, type_) in want.items():
|
||||
got = declared[kind][name]
|
||||
@@ -359,3 +413,28 @@ def test_the_stencil_masks_start_at_all_ones(firefox_binary):
|
||||
# bits (255 on Mesa), and a page that writes 255 reads 255 back, so the read is live and
|
||||
# all ones is not a constant of the page's reading.
|
||||
assert run["written"] == {n: 255 for n in names}, (key, run["written"])
|
||||
|
||||
|
||||
def test_a_stencil_mask_wider_than_the_stencil_bits_reads_back_whole(firefox_binary):
|
||||
"""Retail Firefox 159 on Windows (WebGL1): the masks are 32-bit state, never cut to STENCIL_BITS.
|
||||
|
||||
The values are the ones the retail captures read on a fresh WebGL1 context: after
|
||||
``stencilMask(0x1ff)`` the write masks are 511 and the value masks stay all ones; a
|
||||
``stencilFunc`` with mask 0x1ff then moves the value masks to 511 too; ``stencilMaskSeparate``
|
||||
and ``stencilFuncSeparate`` on BACK move only the back write mask (0x2ff = 767) or only the
|
||||
back value mask (0x3ff = 1023); ``stencilMask(-1)`` leaves all ones. No call raises an error.
|
||||
"""
|
||||
got = _read(firefox_binary, {}, STENCIL_WIDE_JS)
|
||||
assert got is not None, "no webgl context at all"
|
||||
ones = 4294967295
|
||||
names = ("STENCIL_VALUE_MASK", "STENCIL_WRITEMASK",
|
||||
"STENCIL_BACK_VALUE_MASK", "STENCIL_BACK_WRITEMASK")
|
||||
|
||||
def masks(*values):
|
||||
return dict(zip(names, values), error=0)
|
||||
|
||||
assert got["mask"] == masks(ones, 511, ones, 511), got["mask"]
|
||||
assert got["mask_then_func"] == masks(511, 511, 511, 511), got["mask_then_func"]
|
||||
assert got["mask_back"] == masks(ones, ones, ones, 767), got["mask_back"]
|
||||
assert got["func_back"] == masks(ones, ones, 1023, ones), got["func_back"]
|
||||
assert got["mask_minus_one"] == masks(ones, ones, ones, ones), got["mask_minus_one"]
|
||||
@@ -0,0 +1,133 @@
|
||||
"""The criterion of the fontconfig e2e: which opens are a look at the host's fontconfig, and when the poisoned cache is in force, on fake strace lines.
|
||||
|
||||
The e2e (tests/test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py) asks that no process of the browser opens a path
|
||||
under /etc/fonts, a ``fonts.conf`` or a ``*.cache-*`` file, and that the screenshot draws the bundle with the host's caches poisoned. Its verdict is only as good as
|
||||
what it counts as an open and as a poison that is really in force; both are pure functions of the log and of what ``fc-list`` said, tried here with no browser:
|
||||
an open that is refused or unfinished still counts, a relative path takes the folder of its descriptor, a stat is evidence and not an open, and a cache that still lists
|
||||
the face (or lists nothing) is no poison.
|
||||
"""
|
||||
import importlib.util
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
import pytest
|
||||
|
||||
pytestmark = pytest.mark.unit
|
||||
|
||||
TESTS = Path(__file__).resolve().parents[1]
|
||||
E2E = TESTS / "test_no_fontconfig_file_of_the_host_is_opened_and_the_screenshot_draws_the_bundle_linux_e2e.py"
|
||||
BINARY = "/engine/firefox"
|
||||
BUNDLE = "/opt/invisible-playwright/firefox-72_160.0_20261201000000/fonts"
|
||||
MD5 = "0123456789abcdef0123456789abcdef"
|
||||
|
||||
|
||||
def _module():
|
||||
sys.path.insert(0, str(TESTS))
|
||||
try:
|
||||
spec = importlib.util.spec_from_file_location("fontconfig_host_files_e2e", E2E)
|
||||
module = importlib.util.module_from_spec(spec)
|
||||
sys.modules["fontconfig_host_files_e2e"] = module
|
||||
spec.loader.exec_module(module)
|
||||
finally:
|
||||
sys.path.remove(str(TESTS))
|
||||
return module
|
||||
|
||||
|
||||
def _lines(*calls):
|
||||
"""A strace log of a parent (pid 100) that starts a content process (pid 200), with the calls, as the test reads it (``-f -y``)."""
|
||||
return ['100 execve("%s", ["%s"], 0x0) = 0' % (BINARY, BINARY),
|
||||
'100 clone3({flags=CLONE_VM}, 88) = 200',
|
||||
'200 execve("%s", ["%s", "-contentproc"], 0x0) = 0' % (BINARY, BINARY)] + list(calls)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
"/etc/fonts/fonts.conf", "/etc/fonts/conf.d/10-hinting-slight.conf", "/etc/fonts", "/etc/fonts/../fonts/conf.d",
|
||||
"/tmp/hd/.config/fontconfig/fonts.conf", BUNDLE + "/fonts.conf", "/fonts.conf",
|
||||
"/var/cache/fontconfig/" + MD5 + "-le64.cache-9", "/tmp/hd/.fontconfig/" + MD5 + "-le64.cache-9",
|
||||
"/tmp/hd/.cache/fontconfig/" + MD5 + "-le64.cache-9.NEW", "/tmp/hd/.cache/fontconfig/" + MD5 + "-le64.cache-9.TMP-YhscHU",
|
||||
])
|
||||
def test_a_path_of_the_host_s_fontconfig_is_named(path):
|
||||
assert _module().is_a_fontconfig_file_of_the_host(path) is True
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
BUNDLE + "/arial.ttf", BUNDLE + "/msgothic5_32.ttc", "/usr/share/fonts/truetype/dejavu/DejaVuSans.ttf", "/etc/fontsrc", "/etc/fonts.conf.bak",
|
||||
"/tmp/hd/.cache/fontconfig", "/tmp/hd/.cache/mozilla/startupCache/startupCache.8.little", "/proc/self/maps",
|
||||
])
|
||||
def test_a_path_that_is_not_the_host_s_fontconfig_is_left_alone(path):
|
||||
assert _module().is_a_fontconfig_file_of_the_host(path) is False
|
||||
|
||||
|
||||
def test_an_open_counts_whatever_its_result_and_an_unfinished_one_has_the_result_of_its_resumed_line():
|
||||
module = _module()
|
||||
lines = _lines(
|
||||
'100 openat(AT_FDCWD</>, "/etc/fonts/fonts.conf", O_RDONLY <unfinished ...>',
|
||||
'101 getpid() = 101',
|
||||
'100 <... openat resumed>) = -1 ENOENT (No such file or directory)',
|
||||
'100 openat(AT_FDCWD</>, "/etc/fonts/conf.d", O_RDONLY|O_DIRECTORY) = 7</etc/fonts/conf.d>',
|
||||
'100 openat(AT_FDCWD</>, "/etc/fonts/other.conf", O_RDONLY <unfinished ...>')
|
||||
opens = module.paths_of_calls(lines, module.OPEN_CALLS)
|
||||
assert [(o["path"], o["result"]) for o in opens] == [("/etc/fonts/fonts.conf", -1), ("/etc/fonts/conf.d", 7), ("/etc/fonts/other.conf", None)]
|
||||
|
||||
|
||||
def test_a_relative_path_takes_the_folder_strace_prints_for_its_descriptor():
|
||||
module = _module()
|
||||
lines = _lines('100 openat(5</etc/fonts/conf.d>, "10-hinting-slight.conf", O_RDONLY) = 6</etc/fonts/conf.d/10-hinting-slight.conf>',
|
||||
'100 openat(AT_FDCWD</tmp/hd>, "x/y.cache-9", O_RDONLY) = 8',
|
||||
'100 open("/etc/fonts/fonts.conf", O_RDONLY) = 9')
|
||||
assert [o["path"] for o in module.paths_of_calls(lines, module.OPEN_CALLS)] == [
|
||||
"/etc/fonts/conf.d/10-hinting-slight.conf", "/tmp/hd/x/y.cache-9", "/etc/fonts/fonts.conf"]
|
||||
|
||||
|
||||
def test_the_opens_of_every_process_are_judged_with_the_role_of_each():
|
||||
lines = _lines(
|
||||
'100 openat(AT_FDCWD</>, "/etc/fonts/fonts.conf", O_RDONLY) = 5',
|
||||
'200 openat(AT_FDCWD</>, "/var/cache/fontconfig/%s-le64.cache-9", O_RDONLY) = -1 ENOENT (No such file or directory)' % MD5,
|
||||
'300 openat(AT_FDCWD</>, "/tmp/hd/.fontconfig/%s-le64.cache-9", O_RDONLY) = 6' % MD5,
|
||||
'100 openat(AT_FDCWD</>, "%s/arial.ttf", O_RDONLY) = 7' % BUNDLE)
|
||||
looks = _module().host_fontconfig_looks(lines, BINARY)
|
||||
assert [(o["role"], o["path"].rsplit("/", 1)[1]) for o in looks["opens"]] == [
|
||||
("parent", "fonts.conf"), ("content", MD5 + "-le64.cache-9"), ("other", MD5 + "-le64.cache-9")]
|
||||
assert looks["other"] == []
|
||||
|
||||
|
||||
def test_a_stat_is_evidence_and_not_an_open_and_a_quiet_log_has_no_look():
|
||||
module = _module()
|
||||
lines = _lines('100 newfstatat(AT_FDCWD</>, "/etc/fonts/fonts.conf", {st_mode=S_IFREG|0644}, 0) = 0',
|
||||
'100 access("/etc/fonts/fonts.conf", R_OK) = 0',
|
||||
'100 readlink("/etc/fonts/conf.d/x.conf", 0x7ff, 4096) = -1 EINVAL (Invalid argument)')
|
||||
looks = module.host_fontconfig_looks(lines, BINARY)
|
||||
assert looks["opens"] == [] and [o["call"] for o in looks["other"]] == ["newfstatat", "access", "readlink"]
|
||||
assert module.host_fontconfig_looks(_lines('100 openat(AT_FDCWD</>, "%s/arial.ttf", O_RDONLY) = 7' % BUNDLE), BINARY) == {"opens": [], "other": []}
|
||||
|
||||
|
||||
def test_the_poison_is_written_for_the_real_folder_from_the_copy_into_one_cache_folder():
|
||||
module = _module()
|
||||
text = module.poison_config(BUNDLE, "/tmp/copy", "/tmp/hd/.fontconfig")
|
||||
assert '<remap-dir as-path="%s">/tmp/copy</remap-dir>' % BUNDLE in text and "<cachedir>/tmp/hd/.fontconfig</cachedir>" in text
|
||||
assert text.count("<dir>") == 0 and text.count("<cachedir>") == 1
|
||||
reader = module.reader_config(BUNDLE, "/tmp/hd/.fontconfig")
|
||||
assert "<dir>%s</dir>" % BUNDLE in reader and "<cachedir>/tmp/hd/.fontconfig</cachedir>" in reader
|
||||
|
||||
|
||||
def _poison(**over):
|
||||
cache = {"cache_folder": "/h/.fontconfig", "cache_files": [MD5 + "-le64.cache-9"],
|
||||
"listed_files": [BUNDLE + "/arial.ttf", BUNDLE + "/simsun.ttc"]}
|
||||
one = dict(cache, **over)
|
||||
return {"real_folder": BUNDLE, "md5_of_the_real_folder": MD5, "caches": {"home": dict(one), "xdg": dict(one)}}
|
||||
|
||||
|
||||
def test_a_poison_that_is_in_force_has_a_cache_for_the_real_folder_that_lacks_the_face():
|
||||
assert _module()._poison_problems(_poison()) == []
|
||||
|
||||
|
||||
@pytest.mark.parametrize("over, why", [
|
||||
({"listed_files": [BUNDLE + "/arial.ttf", BUNDLE + "/msgothic5_32.ttc"]}, "lists msgothic5_32.ttc"),
|
||||
({"listed_files": []}, "lists no font"),
|
||||
({"listed_files": ["/tmp/copy/arial.ttf"]}, "outside the real folder"),
|
||||
({"cache_files": ["ffffffffffffffffffffffffffffffff-le64.cache-9"]}, "no cache named for the real folder"),
|
||||
({"cache_files": []}, "no cache named for the real folder"),
|
||||
])
|
||||
def test_a_cache_that_is_no_poison_is_named_with_its_reason(over, why):
|
||||
problems = _module()._poison_problems(_poison(**over))
|
||||
assert len(problems) == 2 and all(why in p for p in problems)
|
||||
Reference in new issue
Block a user