From 2d5cc3a826b369bfb0674683d24b1747d835246a Mon Sep 17 00:00:00 2001 From: Chris Seaton Date: Mon, 25 Apr 2016 01:35:45 +0100 Subject: [PATCH] [Truffle] Add C extension test that creates a module - simple API call. --- test/truffle/cexts/module/.jruby-cext-build.yml | 2 ++ test/truffle/cexts/module/bin/module | 5 +++++ test/truffle/cexts/module/expected.txt | 1 + test/truffle/cexts/module/ext/module/extconf.rb | 2 ++ test/truffle/cexts/module/ext/module/module.c | 7 +++++++ test/truffle/cexts/module/lib/module.rb | 1 + test/truffle/cexts/module/lib/module/.keep | 0 7 files changed, 18 insertions(+) create mode 100644 test/truffle/cexts/module/.jruby-cext-build.yml create mode 100644 test/truffle/cexts/module/bin/module create mode 100644 test/truffle/cexts/module/expected.txt create mode 100644 test/truffle/cexts/module/ext/module/extconf.rb create mode 100644 test/truffle/cexts/module/ext/module/module.c create mode 100644 test/truffle/cexts/module/lib/module.rb create mode 100644 test/truffle/cexts/module/lib/module/.keep diff --git a/test/truffle/cexts/module/.jruby-cext-build.yml b/test/truffle/cexts/module/.jruby-cext-build.yml new file mode 100644 index 00000000000..0dc7c4ee6d6 --- /dev/null +++ b/test/truffle/cexts/module/.jruby-cext-build.yml @@ -0,0 +1,2 @@ +src: ext/module/*.c +out: lib/module/module.su diff --git a/test/truffle/cexts/module/bin/module b/test/truffle/cexts/module/bin/module new file mode 100644 index 00000000000..167e70831fa --- /dev/null +++ b/test/truffle/cexts/module/bin/module @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +require 'module' + +puts defined?(ModuleExtension) diff --git a/test/truffle/cexts/module/expected.txt b/test/truffle/cexts/module/expected.txt new file mode 100644 index 00000000000..5bc5be0c0cf --- /dev/null +++ b/test/truffle/cexts/module/expected.txt @@ -0,0 +1 @@ +constant diff --git a/test/truffle/cexts/module/ext/module/extconf.rb b/test/truffle/cexts/module/ext/module/extconf.rb new file mode 100644 index 00000000000..f29b78c18ff --- /dev/null +++ b/test/truffle/cexts/module/ext/module/extconf.rb @@ -0,0 +1,2 @@ +require 'mkmf' +create_makefile('module') diff --git a/test/truffle/cexts/module/ext/module/module.c b/test/truffle/cexts/module/ext/module/module.c new file mode 100644 index 00000000000..27eeb05a995 --- /dev/null +++ b/test/truffle/cexts/module/ext/module/module.c @@ -0,0 +1,7 @@ +#include + +#include + +void Init_module() { + rb_define_module("ModuleExtension"); +} diff --git a/test/truffle/cexts/module/lib/module.rb b/test/truffle/cexts/module/lib/module.rb new file mode 100644 index 00000000000..86fa7357108 --- /dev/null +++ b/test/truffle/cexts/module/lib/module.rb @@ -0,0 +1 @@ +require 'module/module' diff --git a/test/truffle/cexts/module/lib/module/.keep b/test/truffle/cexts/module/lib/module/.keep new file mode 100644 index 00000000000..e69de29bb2d