summaryrefslogtreecommitdiff
path: root/test/fiddle
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/fiddle] Use test-unit gem (https://github.com/ruby/fiddle/pull/69)Hiroshi SHIBATA2021-09-057-33/+79
| | | | | | https://github.com/ruby/fiddle/commit/e08c4c635e Co-authored-by: Sutou Kouhei <kou@clear-code.com>
* [ruby/fiddle] Simplify libc and libm path logics ↵Nobuyoshi Nakada2021-08-241-6/+5
| | | | | | | | | | | | (https://github.com/ruby/fiddle/pull/91) * Simplify libc_so and libm_so If nil, no need to set to nil. * Get rid of repeating inversions https://github.com/ruby/fiddle/commit/4323e689d8
* [ruby/fiddle] Improve "offsetof" calculations ↵Aaron Patterson2021-08-241-0/+33
| | | | | | | | | (https://github.com/ruby/fiddle/pull/90) I need to get the offset of members inside sub structures. This patch adds sub-structure offset support for structs. https://github.com/ruby/fiddle/commit/cf78eddbb6
* [ruby/fiddle] Handle#file_name results in very platform dependentNobuyoshi Nakada2021-07-151-8/+14
|
* [ruby/fiddle] Module file name may be the realpathNobuyoshi Nakada2021-07-151-1/+1
| | | | Even when the path which was used to dlopen may be a symlink.
* [ruby/fiddle] fixed the test on case-insensitive filesystemNobuyoshi Nakada2021-07-141-3/+9
|
* [ruby/fiddle] Add Fiddle::Handle#file_name ↵Kenta Murata2021-07-141-0/+6
| | | | | | (https://github.com/ruby/fiddle/pull/88) https://github.com/ruby/fiddle/commit/4ee1c6fc4b
* [ruby/fiddle] Return the module handle value in Fiddle::Handle#to_i and add ↵Kenta Murata2021-07-141-0/+6
| | | | | | FIddle::Handle#to_ptr (https://github.com/ruby/fiddle/pull/87) https://github.com/ruby/fiddle/commit/170111a0cb
* [ruby/fiddle] Add "offsetof" to Struct classes ↵Aaron Patterson2021-07-131-0/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | (https://github.com/ruby/fiddle/pull/83) * Add "offsetof" to Struct classes I need to get the offset of a member inside a struct without allocating the struct. This patch adds an "offsetof" class method to structs that are generated. The usage is like this: ```ruby MyStruct = struct [ "int64_t i", "char c", ] MyStruct.offsetof("i") # => 0 MyStruct.offsetof("c") # => 8 ``` * Update test/fiddle/test_c_struct_builder.rb Co-authored-by: Sutou Kouhei <kou@cozmixng.org> https://github.com/ruby/fiddle/commit/4e3b60c5b6 Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
* [ruby/fiddle] Add MemoryView.export and MemoryView#release ↵Sutou Kouhei2021-07-131-0/+16
| | | | | | | | | | | | | (https://github.com/ruby/fiddle/pull/80) fix https://github.com/ruby/fiddle/pull/79 Users can release memory views explicitly before process exit. Reported by xtkoba. Thanks!!! https://github.com/ruby/fiddle/commit/1de64b7e76
* [ruby/fiddle] Add Fiddle::MemoryView#to_s ↵Sutou Kouhei2021-07-131-0/+10
| | | | | | | (https://github.com/ruby/fiddle/pull/78) Fix https://github.com/ruby/fiddle/pull/74 Reported by dsisnero. Thanks!!!
* [ruby/fiddle] test: fix SetLastError's input typeSutou Kouhei2021-07-131-1/+1
| | | | | https://github.com/ruby/fiddle/commit/ca5e6a0404
* [ruby/fiddle] test: use double quote for string literalSutou Kouhei2021-07-131-2/+2
| | | | | https://github.com/ruby/fiddle/commit/fab7eab95b
* [ruby/fiddle] test: add a test for win32_last_socket_errorSutou Kouhei2021-07-131-1/+15
| | | | | https://github.com/ruby/fiddle/commit/c86cec03cd
* [ruby/fiddle] test: add missing receiverSutou Kouhei2021-07-131-1/+1
| | | | | https://github.com/ruby/fiddle/commit/1da3b4af16
* [ruby/fiddle] windows: use GetLastError() for win32_last_errorSutou Kouhei2021-07-131-0/+14
| | | | | | | | | Ruby: [Bug #11579] Patch by cremno phobia. Thanks!!! https://github.com/ruby/fiddle/commit/760a8f9b14
* Skip fiddle tests if fiddle is not avaiableNobuyoshi Nakada2021-07-102-0/+3
|
* [ruby/fiddle] Do not use a libdir for glibc, it breaks Linux PPC64 (#70)Jeremy Evans2021-05-181-2/+2
| | | | | | Fixes [Bug #12666] https://github.com/ruby/fiddle/commit/a267a40be7
* [ruby/fiddle] Add support for "const" in typeSutou Kouhei2021-05-181-6/+50
| | | | | | | | GitHub: fix #68 Reported by kojix2. Thanks!!! https://github.com/ruby/fiddle/commit/d7322c234a
* [ruby/fiddle] closure: add support for const char *Sutou Kouhei2021-05-181-0/+13
| | | | | | | | GitHub: fix GH-62 Reported by Cody Krieger. Thanks!!! https://github.com/ruby/fiddle/commit/284b820f2d
* [ruby/fiddle] closure: accept symbol as typeSutou Kouhei2021-05-181-0/+12
| | | | https://github.com/ruby/fiddle/commit/dc2da6633e
* Oops! Add another test and fix to_proc implementationAaron Patterson2021-02-261-0/+11
|
* Fiddle::Function responds to to_procAaron Patterson2021-02-261-0/+13
| | | | | | | | | | This lets us cast a Fiddle::Function to a block, allowing is to write things like: ```ruby f = Fiddle::Function.new(@libc['strcpy'], [TYPE_VOIDP, TYPE_VOIDP], TYPE_VOIDP) define_method :strcpy, &f ```
* [memory_view][fiddle] Rename len to byte_size in rb_memory_view_tKenta Murata2020-12-231-5/+5
|
* TEST: multiarch support for HaikuZoltán Mizsei2020-12-151-0/+12
|
* Strip trailing spaces [ci skip]Nobuyoshi Nakada2020-12-111-1/+1
|
* Import fiddle-1.0.4 (#3860)Kenta Murata2020-12-117-89/+707
| | | | | | | | I don't use tool/sync_default_gem.rb because the last sync was incomplete. Co-authored-by: Hiroshi SHIBATA <hsbt@ruby-lang.org> Co-authored-by: Alan Wu <XrXr@users.noreply.github.com> Co-authored-by: sinisterchipmunk <sinisterchipmunk@gmail.com> Co-authored-by: Sutou Kouhei <kou@clear-code.com>
* Revert "test/fiddle/helper.rb: remove duplication (#3863)" (#3865)Kenta Murata2020-12-081-1/+5
| | | | | | This reverts commit bd47a8d660ab33a20c5e28d0effcc29105c434e4. `libc_so` and `libm_so` are `nil` at line 124 because Big Sur doesn't have `/usr/lib/libSystem.B.dylib`. The reassignment at line 127 is necessary in this case.
* test/fiddle/helper.rb: remove duplication (#3863)Kenta Murata2020-12-081-5/+1
|
* [ruby/fiddle] test: suppress shadowing outer local variable warningSutou Kouhei2020-11-181-2/+2
| | | | https://github.com/ruby/fiddle/commit/cf168680a2
* [ruby/fiddle] Add a "pinning" reference (#44)Aaron Patterson2020-11-181-0/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Add a "pinning" reference A `Fiddle::Pinned` objects will prevent the objects they point to from moving. This is useful in the case where you need to pass a reference to a C extension that keeps the address in a global and needs the address to be stable. For example: ```ruby class Foo A = "hi" # this is an embedded string some_c_function A # A might move! end ``` If `A` moves, then the underlying string buffer may also move. `Fiddle::Pinned` will prevent the object from moving: ```ruby class Foo A = "hi" # this is an embedded string A_pinner = Fiddle::Pinned.new(A) # :nodoc: some_c_function A # A can't move because of `Fiddle::Pinned` end ``` This is a similar strategy to what Graal uses: https://www.graalvm.org/sdk/javadoc/org/graalvm/nativeimage/PinnedObject.html#getObject-- * rename global to match exception name * Introduce generic Fiddle::Error and rearrange error classes Fiddle::Error is the generic exception base class for Fiddle exceptions. This commit introduces the class and rearranges Fiddle exceptions to inherit from it. https://github.com/ruby/fiddle/commit/ac52d00223
* [ruby/fiddle] Add support for specifying types by name as String or SymbolSutou Kouhei2020-11-181-13/+13
| | | | | | For example, :voidp equals to Fiddle::TYPE_VOID_P. https://github.com/ruby/fiddle/commit/3b4de54899
* [ruby/fiddle] Add TYPE_CONST_STRING and SIZEOF_CONST_STRING for "const char *"Sutou Kouhei2020-11-182-9/+27
| | | | | | | | Add rb_fiddle_ prefix to conversion functions.h to keep backward compatibility but value_to_generic() isn't safe for TYPE_CONST_STRING and not String src. Use rb_fiddle_value_to_generic() instead. https://github.com/ruby/fiddle/commit/0ffcaa39e5
* Workaroud for macOS Big Sur(11.0)Hiroshi SHIBATA2020-09-081-0/+5
|
* libSystem.dylib is also symlink. Use libSystem.B.dylibHiroshi SHIBATA2020-09-081-1/+1
|
* Use libSystem.dylib instead of libm.dylib and libc.dylibHiroshi SHIBATA2020-09-081-2/+1
| | | | Because macOS 11.0(Big Sur) was removed libc and libm from `/usr/lib`.
* Apply timeout-scale to test_nogvl_poll.Jun Aruga2020-07-301-1/+2
|
* [ruby/fiddle] support for very old libffiNobuyoshi Nakada2020-06-281-0/+3
| | | | | Define `Fiddle::TYPE_VARIADIC` only when `ffi_prep_cif_var` is available, otherwise skip the test for it.
* [ruby/fiddle] Support MSWIN (#43)Sutou Kouhei2020-06-271-1/+6
| | | | https://github.com/ruby/fiddle/commit/f16e7ff6e0
* [ruby/fiddle] test windows: use _snprintfSutou Kouhei2020-06-271-1/+6
| | | | https://github.com/ruby/fiddle/commit/aa261bdb9f
* [ruby/fiddle] Add support for variadic argumentsSutou Kouhei2020-06-272-1/+32
| | | | | | | | GitHub: fix GH-39 Reported by kojix2. Thanks!!! https://github.com/ruby/fiddle/commit/6c4cb904dc
* [ruby/fiddle] Fixed typosNobuyoshi Nakada2020-06-261-0/+19
| | | | | | https://github.com/ruby/fiddle/commit/a09e66adf4 https://github.com/ruby/fiddle/commit/6cab9b45d6 https://github.com/ruby/fiddle/commit/ab72b19bed
* [ruby/fiddle] Improve documentation on how to correctly free memory and free ↵Chris Seaton2020-05-234-47/+94
| | | | | | memory in tests (#33) https://github.com/ruby/fiddle/commit/e59cfd708a
* [ruby/fiddle] Fix assignment to array within struct (#26)sinisterchipmunk2020-05-231-0/+14
| | | | | | * Allow access to a struct's underlying memory with `struct[offset, length]`. https://github.com/ruby/fiddle/commit/24083690a6
* [ruby/fiddle] Make array access override compatible with base class (#25)sinisterchipmunk2020-05-231-0/+22
| | | | | | | | | | | * Allow access to a struct's underlying memory with `struct[offset, length]`. * Make accessing a struct's underlying memory more convenient. * refactor memory access unit tests for improved clarity https://github.com/ruby/fiddle/commit/c082c81bb5
* `Dir.glob` always returns an arrayNobuyoshi Nakada2020-04-011-10/+5
| | | | | It is not needed to test itself, but the element should be tested instead.
* Fix helper to not assume glibcPaul Jordan2020-04-011-3/+16
|
* Fixed never-defined symbol nameNobuyoshi Nakada2020-03-041-1/+1
|
* pass appropriate libc path卜部昌平2020-01-241-0/+4
| | | | | | The same as https://github.com/ruby/ruby/pull/2686, but for musl libc. Musl is not named as libc.so.6 so the `ldd` hack implemented some lines below does not work.
* Fix "cannot find the function: strcpy()" error on arm32 on Travis CI. (#2686)Jun Aruga2019-12-051-1/+13
| | | | | | | | | | | This issue happened when `libc.so` and `libm.so` path were not found and `ldd ruby` command also failed to print the shared dependencies in `test/fiddle/helper.rb`. See https://travis-ci.org/ruby/ruby/jobs/611483288#L3018 /home/travis/build/ruby/ruby/build/.ext/common/fiddle/import.rb:299:in `import_function': cannot find the function: strcpy() (Fiddle::DLError) * Set libc6:armhf as a installing dependency explicitly. * Remove arm32 from allow_failures.