diff options
| author | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 10:32:42 +0000 |
|---|---|---|
| committer | yugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-12-30 10:32:42 +0000 |
| commit | d04f2fc7a28c67d3016ba49c18437f6744b8998c (patch) | |
| tree | b6dfbb5e9b686bd9375a1ef7684fda2d4a1b76ba /ext/dl/test | |
| parent | 28840d0c957d1df55f23002f29e54ca1cfc367b6 (diff) | |
merges r21177 and r21182 from trunk into ruby_1_9_1.
* ext/dl/test/test_base.rb: add x86_64-linux's case again. #932
--
* ext/dl/test/test_base.rb: add libc search logic.
this patch is written by Takehiro Kubo.
[ruby-core:20963] [Bug #932]
* ext/dl/dl.h: Add ",..." as the last argument.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/lib/dl/stack.rb: add add_padding() to calculate
alignment. this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/test/test_func.rb: atof()'s return value is double.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
* ext/dl/test/test_import.rb:
- atof()'s return value is double.
- The types of qsort's second and third argument are size_t.
- fprintf()'s return value is int.
this patch is written by Takehiro Kubo.
Bug #633 [ruby-core:19289]
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@21195 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'ext/dl/test')
| -rw-r--r-- | ext/dl/test/test_base.rb | 16 | ||||
| -rw-r--r-- | ext/dl/test/test_func.rb | 2 | ||||
| -rw-r--r-- | ext/dl/test/test_import.rb | 4 |
3 files changed, 17 insertions, 5 deletions
diff --git a/ext/dl/test/test_base.rb b/ext/dl/test/test_base.rb index e8c50397e..11243dfeb 100644 --- a/ext/dl/test/test_base.rb +++ b/ext/dl/test/test_base.rb @@ -5,9 +5,21 @@ case RUBY_PLATFORM when /cygwin/ LIBC_SO = "cygwin1.dll" LIBM_SO = "cygwin1.dll" +when /x86_64-linux/ + LIBC_SO = "/lib64/libc.so.6" + LIBM_SO = "/lib64/libm.so.6" when /linux/ - LIBC_SO = "/lib/libc.so.6" - LIBM_SO = "/lib/libm.so.6" + libdir = '/lib' + case [0].pack('L!').size + when 4 + # 32-bit ruby + libdir = '/lib32' if File.directory? '/lib32' + when 8 + # 64-bit ruby + libdir = '/lib64' if File.directory? '/lib64' + end + LIBC_SO = File.join(libdir, "libc.so.6") + LIBM_SO = File.join(libdir, "libm.so.6") when /mingw/, /mswin32/ LIBC_SO = "msvcrt.dll" LIBM_SO = "msvcrt.dll" diff --git a/ext/dl/test/test_func.rb b/ext/dl/test/test_func.rb index 887d38df9..be937719d 100644 --- a/ext/dl/test/test_func.rb +++ b/ext/dl/test/test_func.rb @@ -24,7 +24,7 @@ module DL end def test_atof() - f = Function.new(CFunc.new(@libc['atof'], TYPE_FLOAT, 'atof'), + f = Function.new(CFunc.new(@libc['atof'], TYPE_DOUBLE, 'atof'), [TYPE_VOIDP]) r = f.call("12.34") assert_match(12.00..13.00, r) diff --git a/ext/dl/test/test_import.rb b/ext/dl/test/test_import.rb index 90f21dc65..6d493a6d2 100644 --- a/ext/dl/test/test_import.rb +++ b/ext/dl/test/test_import.rb @@ -11,10 +11,10 @@ module DL extern "void *strcpy(char*, char*)" extern "int isdigit(int)" - extern "float atof(string)" + extern "double atof(string)" extern "unsigned long strtoul(char*, char **, int)" extern "int qsort(void*, int, int, void*)" - extern "void fprintf(FILE*, char*)" + extern "int fprintf(FILE*, char*)" extern "int gettimeofday(timeval*, timezone*)" rescue nil QsortCallback = bind("void *qsort_callback(void*, void*)", :temp) |
