diff options
author | tduehr <tduehr@gmail.com> | 2014-07-01 12:35:45 -0500 |
---|---|---|
committer | tduehr <tduehr@gmail.com> | 2014-07-01 12:35:45 -0500 |
commit | 39febea8d7ed13e1ebc8747fd6fae09f475e6c17 (patch) | |
tree | ad9afc074ee3b83b087e1e2dc66a80bc568f732a | |
parent | e07799acbff814fab5b3c523c18663420eda512b (diff) | |
download | ffi-39febea8d7ed13e1ebc8747fd6fae09f475e6c17.tar.gz |
fix tests for netbsd
-rw-r--r-- | bench/bench_buffer.rb | 21 | ||||
-rw-r--r-- | bench/bench_struct.rb | 21 | ||||
-rw-r--r-- | spec/ffi/pointer_spec.rb | 7 | ||||
-rw-r--r-- | spec/ffi/struct_spec.rb | 14 | ||||
-rw-r--r-- | spec/ffi/typedef_spec.rb | 7 |
5 files changed, 60 insertions, 10 deletions
diff --git a/bench/bench_buffer.rb b/bench/bench_buffer.rb index e5f48ff..947fe10 100644 --- a/bench/bench_buffer.rb +++ b/bench/bench_buffer.rb @@ -9,9 +9,24 @@ module BufferBench extend FFI::Library ffi_lib LIBTEST_PATH attach_function :bench_s32_v, [ :int ], :void - attach_function :bench_buffer_in, :ptr_ret_int32_t, [ :buffer_in, :int ], :void - attach_function :bench_buffer_out, :ptr_ret_int32_t, [ :buffer_out, :int ], :void - attach_function :bench_buffer_inout, :ptr_ret_int32_t, [ :buffer_inout, :int ], :void + begin + attach_function :bench_buffer_in, :ptr_ret_int32_t, [ :buffer_in, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_buffer_in, :ptr_ret___int32_t, [ :buffer_in, :int ], :void + end + begin + attach_function :bench_buffer_inout, :ptr_ret_int32_t, [ :buffer_inout, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_buffer_inout, :ptr_ret___int32_t, [ :buffer_inout, :int ], :void + end + begin + attach_function :bench_buffer_out, :ptr_ret_int32_t, [ :buffer_out, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_buffer_out, :ptr_ret___int32_t, [ :buffer_out, :int ], :void + end end class IntStruct < FFI::Struct layout :i, :int diff --git a/bench/bench_struct.rb b/bench/bench_struct.rb index 4506afe..47aac76 100644 --- a/bench/bench_struct.rb +++ b/bench/bench_struct.rb @@ -8,9 +8,24 @@ module StructBench extend FFI::Library ffi_lib LIBTEST_PATH attach_function :bench_s32_v, [ :int ], :void - attach_function :bench_struct_in, :ptr_ret_int32_t, [ :buffer_in, :int ], :void - attach_function :bench_struct_out, :ptr_ret_int32_t, [ :buffer_out, :int ], :void - attach_function :bench_struct_inout, :ptr_ret_int32_t, [ :buffer_inout, :int ], :void + begin + attach_function :bench_struct_in, :ptr_ret_int32_t, [ :buffer_in, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_struct_in, :ptr_ret___int32_t, [ :buffer_in, :int ], :void + end + begin + attach_function :bench_struct_out, :ptr_ret_int32_t, [ :buffer_out, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_struct_out, :ptr_ret___int32_t, [ :buffer_out, :int ], :void + end + begin + attach_function :bench_struct_inout, :ptr_ret_int32_t, [ :buffer_inout, :int ], :void + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :bench_struct_inout, :ptr_ret___int32_t, [ :buffer_inout, :int ], :void + end end class TestStruct < FFI::Struct layout :i, :int, :p, :pointer diff --git a/spec/ffi/pointer_spec.rb b/spec/ffi/pointer_spec.rb index 10f7e2e..49968a5 100644 --- a/spec/ffi/pointer_spec.rb +++ b/spec/ffi/pointer_spec.rb @@ -10,7 +10,12 @@ require 'delegate' module PointerTestLib extend FFI::Library ffi_lib TestLibrary::PATH - attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], :pointer attach_function :ptr_set_pointer, [ :pointer, :int, :pointer ], :void attach_function :ptr_ret_pointer, [ :pointer, :int ], :pointer diff --git a/spec/ffi/struct_spec.rb b/spec/ffi/struct_spec.rb index 233cf09..aa4fa40 100644 --- a/spec/ffi/struct_spec.rb +++ b/spec/ffi/struct_spec.rb @@ -20,7 +20,12 @@ describe "Struct tests" do extend FFI::Library ffi_lib TestLibrary::PATH attach_function :ptr_ret_pointer, [ :pointer, :int], :string - attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end attach_function :ptr_from_address, [ :ulong ], :pointer attach_function :string_equals, [ :string, :string ], :int [ 's8', 's16', 's32', 's64', 'f32', 'f64', 'long' ].each do |t| @@ -401,7 +406,12 @@ describe FFI::Struct, ".layout" do module LibTest extend FFI::Library ffi_lib TestLibrary::PATH - attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end end end diff --git a/spec/ffi/typedef_spec.rb b/spec/ffi/typedef_spec.rb index f1bcc69..6595d90 100644 --- a/spec/ffi/typedef_spec.rb +++ b/spec/ffi/typedef_spec.rb @@ -62,7 +62,12 @@ describe "Custom type definitions" do typedef :int, :bar ffi_lib TestLibrary::PATH - attach_function :ptr_ret_int32_t, [ :string, :foo ], :bar + begin + attach_function :ptr_ret_int32_t, [ :string, :foo ], :bar + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :string, :foo ], :bar + end end end.should_not raise_error end |