From 58ca0a1e8b26a5a1b3c820e321c007febf9627b2 Mon Sep 17 00:00:00 2001 From: Johan Holmberg Date: Sat, 26 Nov 2016 23:12:07 +0100 Subject: [PATCH] enable testing running cmdtest with jruby or some other "non-standard" Ruby. The environment variable CMDTEST_RUBY is used to select which Ruby to use. --- t/selftest_utils.rb | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/t/selftest_utils.rb b/t/selftest_utils.rb index 421640d..d654625 100644 --- a/t/selftest_utils.rb +++ b/t/selftest_utils.rb @@ -41,9 +41,13 @@ module SelftestUtils return Cmdtest::Util::quote_path(str) end + def ruby + ENV["CMDTEST_RUBY"] || "ruby" + end + def cmd_cmdtest(*args) cmdtest = "#{TOP}/bin/cmdtest.rb" - command = "ruby %s --quiet --no-diff" % _quote(cmdtest) + command = "#{ruby} %s --quiet --no-diff" % _quote(cmdtest) cmd(command, *args) do comment "running local cmdtest" yield @@ -52,7 +56,7 @@ module SelftestUtils def cmd_cmdtest_diff(*args) cmdtest = "#{TOP}/bin/cmdtest.rb" - command = "ruby %s --quiet --diff" % _quote(cmdtest) + command = "#{ruby} %s --quiet --diff" % _quote(cmdtest) cmd(command, *args) do comment "running local cmdtest --diff" yield @@ -61,7 +65,7 @@ module SelftestUtils def cmd_cmdtest_no_diff(*args) cmdtest = "#{TOP}/bin/cmdtest.rb" - command = "ruby %s --quiet --no-diff" % _quote(cmdtest) + command = "#{ruby} %s --quiet --no-diff" % _quote(cmdtest) cmd(command, *args) do comment "running local cmdtest --no-diff" yield @@ -70,7 +74,7 @@ module SelftestUtils def cmd_cmdtest_verbose(*args) cmdtest = "#{TOP}/bin/cmdtest.rb" - command = "ruby %s %s" % [ + command = "#{ruby} %s %s" % [ _quote(cmdtest), args.join(" "), ]