From 263b3ba65b87abd1d044b8242fbdce4280ed2a69 Mon Sep 17 00:00:00 2001 From: ono-max Date: Fri, 1 Apr 2022 15:54:39 +0900 Subject: [PATCH] Print information that protocol tests are skipped only once --- test/support/cdp_utils.rb | 7 ++----- test/support/dap_utils.rb | 4 +--- test/support/protocol_utils.rb | 6 +++++- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/test/support/cdp_utils.rb b/test/support/cdp_utils.rb index cb9b8650c..fcdd9f1a3 100644 --- a/test/support/cdp_utils.rb +++ b/test/support/cdp_utils.rb @@ -31,12 +31,7 @@ def setup_chrome_debuggee MSG end - pt = ENV['RUBY_DEBUG_PROTOCOL_TEST'] - PROTOCOL_TEST = pt == 'true' || pt == '1' - def connect_to_cdp_server - omit 'Tests for CDP were skipped. You can enable them with RUBY_DEBUG_PROTOCOL_TEST=1.' unless PROTOCOL_TEST - ENV['RUBY_DEBUG_TEST_MODE'] = 'true' sock = Socket.tcp HOST, @remote_info.port @@ -69,6 +64,8 @@ def connect_to_cdp_server HOST = '127.0.0.1' def run_cdp_scenario program, &msgs + return unless Protocol_TestUtils::PROTOCOL_TEST + ENV['RUBY_DEBUG_TEST_UI'] = 'chrome' program = program.delete_suffix "\n" diff --git a/test/support/dap_utils.rb b/test/support/dap_utils.rb index cebe5bc15..22a428cf7 100644 --- a/test/support/dap_utils.rb +++ b/test/support/dap_utils.rb @@ -97,11 +97,9 @@ def connect_to_dap_server test_info end TIMEOUT_SEC = (ENV['RUBY_DEBUG_TIMEOUT_SEC'] || 10).to_i - dt = ENV['RUBY_DEBUG_PROTOCOL_TEST'] - DAP_TEST = dt == 'true' || dt == '1' def run_dap_scenario program, &msgs - omit 'Tests for DAP were skipped. You can enable them with RUBY_DEBUG_PROTOCOL_TEST=1.' unless DAP_TEST + return unless Protocol_TestUtils::PROTOCOL_TEST begin write_temp_file(strip_line_num(program)) diff --git a/test/support/protocol_utils.rb b/test/support/protocol_utils.rb index cd860f7c9..c2cc0f0f9 100644 --- a/test/support/protocol_utils.rb +++ b/test/support/protocol_utils.rb @@ -37,10 +37,14 @@ class Detach < StandardError pt = ENV['RUBY_DEBUG_PROTOCOL_TEST'] PROTOCOL_TEST = pt == 'true' || pt == '1' + unless PROTOCOL_TEST + warn 'Tests for CDP and DAP were skipped. You can enable them with RUBY_DEBUG_PROTOCOL_TEST=1.' + end + # API def run_protocol_scenario program, dap: true, cdp: true, &scenario - omit 'Tests for CDP and DAP were skipped. You can enable them with RUBY_DEBUG_PROTOCOL_TEST=1.' unless PROTOCOL_TEST + return unless PROTOCOL_TEST write_temp_file(strip_line_num(program)) execute_dap_scenario scenario if dap