Conversation
0de88c5 to
fb9cc7f
Compare
|
I've disabled these new tests on Windows platforms, the CGI structure needs an executable file and the usual |
test/test_cgi_server.rb
Outdated
| end | ||
|
|
||
| def test_client_server | ||
| omit("The CGI file does not work on Windows") if RUBY_PLATFORM =~ /(mswin|mingw)/ |
There was a problem hiding this comment.
We can use Gem.win_platform?:
| omit("The CGI file does not work on Windows") if RUBY_PLATFORM =~ /(mswin|mingw)/ | |
| omit("The CGI file does not work on Windows") if Gem.win_platform? |
test/test_cgi_server.rb
Outdated
| tempfile.close | ||
| File.chmod(0755, tempfile.path) | ||
|
|
||
| [false].each do |use_ssl| |
There was a problem hiding this comment.
| [false].each do |use_ssl| | |
| use_ssl = false |
test/test_cgi_server.rb
Outdated
|
|
||
| [false].each do |use_ssl| | ||
| option = setup_http_server_option(use_ssl) | ||
| with_server(option, WEBrick::HTTPServlet::CGIHandler, tempfile.path) {|addr| |
There was a problem hiding this comment.
| with_server(option, WEBrick::HTTPServlet::CGIHandler, tempfile.path) {|addr| | |
| with_server(option, WEBrick::HTTPServlet::CGIHandler, tempfile.path) do |addr| |
test/test_cgi_server.rb
Outdated
|
|
||
| def cgi_bin_script | ||
| <<~RUBY | ||
| #!/usr/bin/env ruby |
There was a problem hiding this comment.
| #!/usr/bin/env ruby | |
| #!#{Gem.ruby} |
test/test_cgi_server.rb
Outdated
| end | ||
|
|
||
| s.set_default_handler do |name, *args| | ||
| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + |
There was a problem hiding this comment.
| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + | |
| raise XMLRPC::FaultException.new(-99, "Method \#{name} missing" + |
test/test_cgi_server.rb
Outdated
|
|
||
| s = XMLRPC::CGIServer.new | ||
|
|
||
| s.add_handler("test.add") do |a,b| |
There was a problem hiding this comment.
| s.add_handler("test.add") do |a,b| | |
| s.add_handler("test.add") do |a, b| |
test/test_cgi_server.rb
Outdated
| a + b | ||
| end | ||
|
|
||
| s.add_handler("test.div") do |a,b| |
There was a problem hiding this comment.
| s.add_handler("test.div") do |a,b| | |
| s.add_handler("test.div") do |a, b| |
test/test_cgi_server.rb
Outdated
| assert_equal param, 2 | ||
|
|
||
| # introspection | ||
| assert_equal ["test.add", "test.div", "system.listMethods", "system.methodSignature", "system.methodHelp"], @s.call("system.listMethods") |
There was a problem hiding this comment.
Could you avoid omitting parenthesis for assertions?
See also: https://bugs.ruby-lang.org/issues/20922
Could you align long expected and actual for readability?
| assert_equal ["test.add", "test.div", "system.listMethods", "system.methodSignature", "system.methodHelp"], @s.call("system.listMethods") | |
| assert_equal(["test.add", "test.div", "system.listMethods", "system.methodSignature", "system.methodHelp"], | |
| @s.call("system.listMethods")) |
These remarks originate from the review of the tests of the CGI server, but since most of that code was copied from this file, clean this up here as well. If we ever want to use shared logic for these files, it's preferable to keep the differences to a minimum.
The do not work out of the box, I'm sure this can be fixed but I have no idea how to do that.
|
I think I've fixed all review comments now. Since the code started out as a copy-paste of the Webrick tests, they layout/paren fixes have been fixed in that file as well. This keeps the differences between these two files to a minimum. |
|
The issues with macos head/ubuntu head are related to the removal of the CGI gem from Ruby 3.5. This looks to be fixed upstream in rack/rack#2327, but is not yet released. These should not occur when running the CI on master as well. |
|
Let's work on CGI gem + Ruby 3.5 in a separated PR. |
That should be fixed with the next release of Rack. If you use |
|
OK. Rack 3.1.15 was related on 2025-05-18 and CI works again. |
The implementation is mostly a copy-paste from the webrick server test, including the code style.
Because this needs a CGI server, it still has a dependency on webrick to run that server. This setup is a bit slow, on my system the overall execution time of the tests jumps from 1 second to 7 seconds.