about summary refs log tree commit homepage
path: root/test/test_mwrap.rb
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2018-07-14 08:23:23 +0000
committerEric Wong <e@80x24.org>2018-07-16 19:34:32 +0000
commit1a589f1813ec1b46f6701ab40b2fe2605ae426c5 (patch)
tree02cbdf4f6739cbd52371bafce957ec1743f4a1ec /test/test_mwrap.rb
parentc645b7d135e6de341f5452aeb3771e2b6779dc80 (diff)
downloadmwrap-1a589f1813ec1b46f6701ab40b2fe2605ae426c5.tar.gz
cmake (as run by the Ruby test suite for RubyGems) uses libjson
and libtasn1, which respectively call malloc (via `new') and
free before our constructor can even fire.  Apparently, C++
variable initialization may call "new" outside of any functions;
and those run before any functions with the GCC constructor
attribute.

Disclaimer: I don't know C++
Diffstat (limited to 'test/test_mwrap.rb')
-rw-r--r--test/test_mwrap.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/test_mwrap.rb b/test/test_mwrap.rb
index d76e4da..d0af0f7 100644
--- a/test/test_mwrap.rb
+++ b/test/test_mwrap.rb
@@ -61,6 +61,22 @@ class TestMwrap < Test::Unit::TestCase
     end
   end
 
+  def test_cmake
+    begin
+      exp = `cmake -h`
+    rescue Errno::ENOENT
+      warn 'cmake missing'
+      return
+    end
+    assert_not_predicate exp.strip, :empty?
+    env = @@env.merge('MWRAP' => 'dump_fd:1')
+    out = IO.popen(env, %w(cmake -h), &:read)
+    assert out.start_with?(exp), 'original help exists'
+    assert_not_equal exp, out, 'includes dump output'
+    dump = out.delete_prefix(exp)
+    assert_match(/\b0x[a-f0-9]+\b/s, dump, 'dump output has addresses')
+  end
+
   def test_clear
     cmd = @@cmd + %w(
       -e ("0"*10000).clear