summaryrefslogtreecommitdiff
path: root/test/fiddle
Commit message (Collapse)AuthorAgeFilesLines
...
* 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.
* More fixes for $SAFE/taint post mergingJeremy Evans2019-11-182-35/+0
|
* Deprecate taint/trust and related methods, and make the methods no-opsJeremy Evans2019-11-182-0/+35
| | | | | | This removes the related tests, and puts the related specs behind version guards. This affects all code in lib, including some libraries that may want to support older versions of Ruby.
* Revert "[ruby/fiddle] Fix a failing test (#13)"Hiroshi SHIBATA2019-10-241-11/+0
| | | | This reverts commit 5ebb0d50f6560b35bc03deb79341a115c5f782ee.
* Revert "[ruby/fiddle] test: use env Hash"Hiroshi SHIBATA2019-10-241-13/+10
| | | | This reverts commit 4d844cbaed518743776594fa5ae33b86fe176ad1.
* [ruby/fiddle] Remove taint support (#21)Jeremy Evans2019-10-244-37/+1
| | | | | | | Ruby 2.7 deprecates taint and it no longer has an effect. The lack of taint support should not cause a problem in previous Ruby versions. https://github.com/ruby/fiddle/commit/18d6fb6915
* [ruby/fiddle] Use RbConfig::SIZEOF (#19)Nobuyoshi Nakada2019-10-241-2/+2
| | | | https://github.com/ruby/fiddle/commit/ea06b28db8
* [ruby/fiddle] test: use env HashSutou Kouhei2019-10-241-10/+13
| | | | https://github.com/ruby/fiddle/commit/a01a962342
* [ruby/fiddle] Fix a failing test (#13)Kenta Murata2019-10-241-0/+11
| | | | | | | | | | | | | | | | | | | | | * Fix a failing test This commit fixes the following failure: ``` 1) Failure: Fiddle::TestImport#test_no_message_with_debug [/Users/mrkn/src/github.com/ruby/fiddle/test/fiddle/test_import.rb:152]: 1. [2/2] Assertion for "stderr" | <[]> expected but was | <["Exception `NameError' at /Users/mrkn/.rbenv/versions/2.5.1/lib/ruby/2.5.0/fiddle/import.rb:157 - uninitialized constant Fiddle::Function::STDCALL"]>. ``` * Stop using Bundler.with_clean_env * Clear existing Ruby environment variables on test_no_message_with_debug https://github.com/ruby/fiddle/commit/13133ddec8
* Make test-all and test-spec runnable on AndroidYusuke Endoh2019-09-091-0/+7
| | | | | | Calling some syscall functions such as Dir.chroot causes SIGSYS instead of EPERM on Android. This change skips all tests that stops the test-suite run.
* test/fiddle/test_function.rb: loosen timeoutk0kubun2018-12-231-1/+1
| | | | | | | | We're hitting `Expected |200 - 351| (151) to be <= 150.` in several places: https://rubyci.org/logs/rubyci.s3.amazonaws.com/osx1012/ruby-trunk/log/20181215T094505Z.fail.html.gz https://travis-ci.org/ruby/ruby/jobs/471483171 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66503 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_function.rb: loosen delta boundaryk0kubun2018-11-131-1/+1
| | | | | | | | | | | | | | | | | | On osx build https://travis-ci.org/ruby/ruby/jobs/454309945, ``` 1) Failure: Fiddle::TestFunction#test_nogvl_poll [/Users/travis/build/ruby/ruby/test/fiddle/test_function.rb:95]: slept amount of time. Expected |200 - 322| (122) to be <= 100. ``` but it succeeds on my macOS machine as is. So it seems that the boundary is just too strict and prone to random failure by overload. To make osx Travis build usable, let me loosen the delta requirement. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_function.rb: try running test_nogvl_poll againk0kubun2018-08-181-4/+0
| | | | | | | | | According to some runs in mjit-test (make test-all RUN_OPTS="--jit-wait"), this test might not be the cause of its failure. So, let me try running this again. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64426 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_function.rb: skip running testk0kubun2018-08-151-0/+4
| | | | | | | | | | | | | | that times out with test-all w/ --jit-wait. I'm running the following command on Wecker CI everyday: ``` make test-all TESTOPTS="--color=never --job-status=normal" RUN_OPTS="--disable-gems --jit-wait --jit-warnings" RUBY_FORCE_TEST_JIT=1 ``` By running yesterday's all commits, r64354 ran successfully but r64355 didn't. So the test should be fixed to run with --jit-wait at first. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64374 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/fiddle/test_function.rb (test_nogvl_poll): stop timer hacknormal2018-08-141-0/+6
| | | | | | | | | | | | | | EINTR seems unavoidable in real programs (or MJIT), so maybe it's not worth dealing with. r64353 relies on POSIX timers to signal. Switching pipes and sockets to non-blocking by default would let us get rid of POSIX timers, timer pthread and this hack: https://bugs.ruby-lang.org/issues/14968 [ruby-core:88360] [Misc #14937] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64355 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test_function.rb: fix messagesnobu2018-07-281-3/+14
| | | | | | | * test/fiddle/test_function.rb (test_nogvl_poll): fix messages as failed conditions, with errno description. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64091 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* removed unusecd constantsnobu2018-07-121-4/+0
| | | | | | | | | | * ruby-runner.c (ruby_libm_func): removed as the following test actually doesn't need the path of libm. * test/fiddle/test_pointer.rb (Fiddle::TestPointer#test_free=): removed never used constants and instance variables. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63957 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle/test_import.rb: fix warnings by rubygemsnobu2018-04-191-1/+1
| | | | | | [Bug #14686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle/import.rb: suppress warningnobu2018-04-191-0/+4
| | | | | | | * ext/fiddle/lib/fiddle/import.rb: suppress exception report when $DEBUG is enabled. [ruby-core:86536] [Bug #14686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63205 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* long long is a C99ismshyouhei2018-02-172-3/+9
| | | | | | | | so SIZEOF_LONG_LONG is not always available. We have to check its defined?-ness before using. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62450 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* `$SAFE` as a process global state. [Feature #14250]ko12017-12-282-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * vm_core.h (rb_vm_t): move `rb_execution_context_t::safe_level` to `rb_vm_t::safe_level_` because `$SAFE` is a process (VM) global state. * vm_core.h (rb_proc_t): remove `rb_proc_t::safe_level` because `Proc` objects don't need to keep `$SAFE` at the creation. Also make `is_from_method` and `is_lambda` as 1 bit fields. * cont.c (cont_restore_thread): no need to keep `$SAFE` for Continuation. * eval.c (ruby_cleanup): use `rb_set_safe_level_force()` instead of access `vm->safe_level_` directly. * eval_jump.c: End procs `END{}` doesn't keep `$SAFE`. * proc.c (proc_dup): removed and introduce `rb_proc_dup` in vm.c. * safe.c (rb_set_safe_level): don't check `$SAFE` 1 -> 0 changes. * safe.c (safe_setter): use `rb_set_safe_level()`. * thread.c (rb_thread_safe_level): `Thread#safe_level` returns `$SAFE`. It should be obsolete. * transcode.c (load_transcoder_entry): `rb_safe_level()` only returns 0 or 1 so that this check is not needed. * vm.c (vm_proc_create_from_captured): don't need to keep `$SAFE` for Proc. * vm.c (rb_proc_create): renamed to `proc_create`. * vm.c (rb_proc_dup): moved from proc.c. * vm.c (vm_invoke_proc): do not need to set and restore `$SAFE` for `Proc#call`. * vm_eval.c (rb_eval_cmd): rename a local variable to represent clearer meaning. * lib/drb/drb.rb: restore `$SAFE`. * lib/erb.rb: restore `$SAFE`, too. * test/lib/leakchecker.rb: check `$SAFE == 0` at the end of tests. * test/rubygems/test_gem.rb: do not set `$SAFE = 1`. * bootstraptest/test_proc.rb: catch up this change. * spec/ruby/optional/capi/string_spec.rb: ditto. * test/bigdecimal/test_bigdecimal.rb: ditto. * test/fiddle/test_func.rb: ditto. * test/fiddle/test_handle.rb: ditto. * test/net/imap/test_imap_response_parser.rb: ditto. * test/pathname/test_pathname.rb: ditto. * test/readline/test_readline.rb: ditto. * test/ruby/test_file.rb: ditto. * test/ruby/test_optimization.rb: ditto. * test/ruby/test_proc.rb: ditto. * test/ruby/test_require.rb: ditto. * test/ruby/test_thread.rb: ditto. * test/rubygems/test_gem_specification.rb: ditto. * test/test_tempfile.rb: ditto. * test/test_tmpdir.rb: ditto. * test/win32ole/test_win32ole.rb: ditto. * test/win32ole/test_win32ole_event.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61510 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix test-all tests to avoid creating report_on_exception warningseregon2017-12-122-13/+15
| | | | | | | | | * The warnings are shown by Thread.report_on_exception defaulting to true. [Feature #14143] [ruby-core:83979] * Improves tests by narrowing down the scope where an exception is expected. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61188 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use mutable strings for mutation tests.ko12017-09-123-4/+4
| | | | | | | | | | | | | | | | * test/fiddle/test_func.rb (test_string): this test break String buffer by `strcpy` ("000" -> "123"). However, the string literal "000" with `frozen_string_literal: true` returns a string object from frozen string pool. So that after this test "000" from fstring pool becomes "123" (modified string). 'test/date/' uses "000" (as fstring) and tests are fails (we could check with `make test-all TESTS='fiddle date'`). * test/fiddle/test_function.rb: ditto. * test/fiddle/test_import.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59861 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Merge fiddle-1.0.0.beta2 from upstream.hsbt2017-09-1211-14/+14
| | | | | | | | | * ext/fiddle/closure.c: use directly declaration for standalone gem without internal.h. * Specify frozen string literal is true. * Update gemspec configuration for release version. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59854 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Use Test::Unit::TestCase instead of MiniTest::Unit::TestCase. Becausehsbt2017-07-138-15/+9
| | | | | | | | | | | tests of fiddle already used customized assertions of ruby core. * test/fiddle/helper.rb: Use Test::Unit::TestCase for base class of testcase. * test/fiddle/test_*.rb: Use assert_raise instead of assert_raises. Remove needless includes for Test::Unit::Assertions. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* test/fiddle/helper: remove special case for x86_64-linuxnormal2017-01-111-3/+0
| | | | | | | | | | | | | RUBY_PLATFORM is "x86_64-linux" on a 32-bit (x86) Ruby built and running on a 64-bit Linux kernel. I also have a /lib64 directory nowadays because I just installed multi-arch support in userspace. So, fall back to loading based in the size of a packed "unsigned long" type instead of special-casing. Tested with both x86 and x86_64 userspace on 64-bit Linux kernel, as well as x86 with a 32-bit Linux kernel. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57309 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Removed the obstacle to running test-all with VC14.usa2016-12-141-2/+2
| | | | | | | | * test/fiddle/test_import.rb (LIBC.fprintf): VC14's `fprintf` is very distinct name, then, just ignore this test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57081 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test/fiddle/test_pointer.rb (test_to_str, test_to_s, test_aref_aset):ngoto2016-07-011-3/+3
| | | | | | | | | Attempt to use independent strings for destructive tests that directly modify values on memory by using Fiddle::Pointer. [Bug #12537] [ruby-dev:49700] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55554 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * test_handle.rb: refine test_fallback_to_ansinobu2016-05-161-1/+2
| | | | | | | | * test/fiddle/test_handle.rb (test_fallback_to_ansi): ensure that the fallback result equals to ANSI version. [ruby-core:75494] [Bug #12377] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* configure.in: revert macro namesnobu2016-05-161-0/+7
| | | | | | | | | | * configure.in (FUNC_STDCALL, FUNC_CDECL, FUNC_FASTCALL): set macro names explicitly to the old names, which are accidentally changed at r54985, for backward compatibilities. fiddle also depends on these names to fallback to ANSI names. [ruby-core:75494] [Bug #12377] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@55015 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* * ext/fiddle/handle.c: check tainted string arguments.nagachika2015-12-161-0/+17
| | | | | | | | Patch provided by tenderlove and nobu. * test/fiddle/test_handle.rb (class TestHandle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53153 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Add frozen_string_literal: false for all filesnaruse2015-12-1611-0/+11
| | | | | | When you change this to true, you may need to add more tests. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fiddle: release GVL for ffi_callnormal2015-11-231-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some external functions I wish to call may take a long time and unnecessarily block other threads. This may lead to performance regressions for fast functions as releasing/acquiring the GVL is not cheap, but can improve performance for long-running functions in multi-threaded applications. This also means we must reacquire the GVL when calling Ruby-defined callbacks for Fiddle::Closure, meaning we must detect whether the current thread has the GVL by exporting ruby_thread_has_gvl_p in internal.h * ext/fiddle/function.c (struct nogvl_ffi_call_args): new struct for GVL release (nogvl_ffi_call): new function (function_call): adjust for GVL release [ruby-core:71642] [Feature #11607] * ext/fiddle/closure.c (struct callback_args): new struct for GVL acquire (with_gvl_callback): adjusted original callback function (callback): wrapper for conditional GVL acquire * ext/fiddle/depend: add dependencies * ext/fiddle/extconf.rb: include top_srcdir for internal.h * internal.h (ruby_thread_has_gvl_p): expose for fiddle * vm_core.h (ruby_thread_has_gvl_p): moved to internal.h * test/fiddle/test_function.rb (test_nogvl_poll): new test git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52723 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* fix r52690naruse2015-11-211-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Visual C++ 14 (2015) uses ucrtbase.dll as c runtimenaruse2015-11-211-1/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e