dumping ground for random patches and texts
 help / color / mirror / Atom feed
From: Eric Wong <e@80x24.org>
To: e@80x24.org, spew@80x24.org
Subject: [WIP 1/3] test/dtrace/helper: fix check for miniruby
Date: Tue,  5 Jun 2018 03:29:19 +0000	[thread overview]
Message-ID: <20180605032921.32337-1-e@80x24.org> (raw)

RbConfig::TOPDIR points to my installation prefix on my FreeBSD
and GNU/Linux systems, so there's no way miniruby exists, there.
In case we don't have miniruby, --disable=gems anyways to reduce
dtrace overhead.
---
 test/dtrace/helper.rb | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/test/dtrace/helper.rb b/test/dtrace/helper.rb
index 5828bcd5ba..de971a3b09 100644
--- a/test/dtrace/helper.rb
+++ b/test/dtrace/helper.rb
@@ -46,8 +46,9 @@ class TestCase < Test::Unit::TestCase
       IO.popen(cmd, err: [:child, :out], &:readlines)
     end
 
-    miniruby = "#{RbConfig::TOPDIR}/miniruby#{RbConfig::CONFIG["EXEEXT"]}"
-    RUBYBIN =  File.exist?(miniruby) ? miniruby : EnvUtil.rubybin
+    miniruby = "miniruby#{RbConfig::CONFIG["EXEEXT"]}"
+    miniruby = File.join(File.dirname(EnvUtil.rubybin), miniruby)
+    RUBYBIN = File.exist?(miniruby) ? miniruby : EnvUtil.rubybin
 
     def trap_probe d_program, ruby_program
       d = Tempfile.new(%w'probe .d')
@@ -60,8 +61,8 @@ def trap_probe d_program, ruby_program
 
       d_path  = d.path
       rb_path = rb.path
-
-      cmd = [*DTRACE_CMD, "-q", "-s", d_path, "-c", "#{RUBYBIN} -I#{INCLUDE} #{rb_path}"]
+      cmd = "#{RUBYBIN} --disable=gems -I#{INCLUDE} #{rb_path}"
+      cmd = [*DTRACE_CMD, "-q", "-s", d_path, "-c", cmd ]
       if sudo = @@sudo
         [RbConfig::CONFIG["LIBPATHENV"], "RUBY", "RUBYOPT"].each do |name|
           if name and val = ENV[name]
-- 
EW


             reply	other threads:[~2018-06-05  3:29 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-05  3:29 Eric Wong [this message]
2018-06-05  3:29 ` [WIP 2/3] test/dtrace/test_array_create.rb: check line number Eric Wong
2018-06-05  3:29 ` [WIP 3/3] test/dtrace/test_method_cache.rb: avoid spewing too much Eric Wong
2018-06-05  3:37 ` [WIP 4/3] test/dtrace: enable Tracepoint for function calls EW

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180605032921.32337-1-e@80x24.org \
    --to=e@80x24.org \
    --cc=spew@80x24.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).