summaryrefslogtreecommitdiff
path: root/test/fiddle/test_function.rb
AgeCommit message (Collapse)Author
2019-10-24[ruby/fiddle] Remove taint support (#21)Jeremy Evans
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
2018-12-23test/fiddle/test_function.rb: loosen timeoutk0kubun
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
2018-11-13test_function.rb: loosen delta boundaryk0kubun
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
2018-08-18test_function.rb: try running test_nogvl_poll againk0kubun
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
2018-08-15test_function.rb: skip running testk0kubun
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
2018-08-14test/fiddle/test_function.rb (test_nogvl_poll): stop timer hacknormal
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
2018-07-28test_function.rb: fix messagesnobu
* 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
2017-09-12Use mutable strings for mutation tests.ko1
* 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
2017-09-12Merge fiddle-1.0.0.beta2 from upstream.hsbt
* 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
2017-07-13Use Test::Unit::TestCase instead of MiniTest::Unit::TestCase. Becausehsbt
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
2015-12-16Add frozen_string_literal: false for all filesnaruse
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
2015-11-23fiddle: release GVL for ffi_callnormal
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
2015-10-30use assert_raisenobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-11-13* test/lib/envutil.rb: Moved from test/ruby/.akr
* test/lib/find_executable.rb: Ditto. * test/lib/memory_status.rb: Ditto. * test/lib/test/unit.rb: require envutil. * test/: Don't require envutil in test files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48409 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-09fiddle/function.c: fix memory leak on exceptionnobu
* ext/fiddle/function.c (function_call): fix memory leak when an exception occurs at argument conversion or the function call. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45301 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-02-24* test/fiddle/test_function.rb: remove unused variables.hsbt
* test/fileutils/test_fileutils.rb: ditto. * test/io/console/test_io_console.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2012-12-11* ext/fiddle/function.c (Fiddle::Function.new): new keyword argument :name ↵ngoto
to set the name attribute. * ext/fiddle/lib/fiddle/import.rb (import_function, bind_function): set function name by using the :name keyword argument. Re-fixes r38243. [ruby-core:50566] * test/fiddle/test_function.rb (test_name): test for the :name keyword argument and Fiddle::Function#name. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2011-01-23 * test/fiddle/test_fiddle.rb: Don't run test if the system don't supportkosaki
fiddle. * test/fiddle/test_function.rb: ditto. * test/fiddle/test_closure.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@30639 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2010-05-06* ext/fiddle/*: Adding fiddle library to wrap libffitenderlove
* test/fiddle/*: testing fiddle extension * ext/dl/lib/dl.rb: Requiring fiddle if it is available * ext/dl/lib/dl/callback.rb: using Fiddle if it is available * ext/dl/lib/dl/func.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27640 b2dd03c8-39d4-4d8f-98ff-823fe69b080e