summaryrefslogtreecommitdiff
path: root/test/fiddle
AgeCommit message (Collapse)Author
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
2018-07-12removed unusecd constantsnobu
* 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
2018-04-19fiddle/test_import.rb: fix warnings by rubygemsnobu
[Bug #14686] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63206 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-19fiddle/import.rb: suppress warningnobu
* 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
2018-02-17long long is a C99ismshyouhei
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
2017-12-28`$SAFE` as a process global state. [Feature #14250]ko1
* 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
2017-12-12Fix test-all tests to avoid creating report_on_exception warningseregon
* 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
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
2017-01-11test/fiddle/helper: remove special case for x86_64-linuxnormal
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
2016-12-14Removed the obstacle to running test-all with VC14.usa
* 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
2016-07-01* test/fiddle/test_pointer.rb (test_to_str, test_to_s, test_aref_aset):ngoto
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
2016-05-16* test_handle.rb: refine test_fallback_to_ansinobu
* 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
2016-05-16configure.in: revert macro namesnobu
* 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
2015-12-16* ext/fiddle/handle.c: check tainted string arguments.nagachika
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
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-11-21fix r52690naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52696 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-11-21Visual C++ 14 (2015) uses ucrtbase.dll as c runtimenaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52690 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-10-30test/fiddle: revert r52384 partiallynobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52388 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
2015-06-18* include/ruby/ruby.h: $SAFE=2 is now obsolete.hsbt
* dir.c, ext/fiddle/handle.c, ext/socket/basicsocket.c, file.c gc.c, io.c, process.c, safe.c, signal.c, win32/file.c: removed code for $SAFE=2 * test/erb/test_erb.rb, test/fiddle/test_handle.rb test/ruby/test_env.rb: removed tests for $SAFE=2. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50958 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-05* test/fiddle/test_handle.rb: fix syntax.ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49159 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-05test_handle.rb: use -test-/dln/emptynobu
* test/fiddle/test_handle.rb (test_NEXT): use -test-/dln/empty which is always a shared object and is not used by others. [ruby-dev:48629] [Bug #10384] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49157 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-05test_handle.rb: separate blocksnobu
* test/fiddle/test_handle.rb (test_static_sym, test_NEXT): separate each rescue blocks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49156 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-05test_handle.rb: remove skipsnobu
* test/fiddle/test_handle.rb (test_static_sym, test_DEFAULT): remove useless skips. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49155 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03* ext/fiddle/lib/fiddle/cparser.rb: r49110 brake Fiddle::Import withhsbt
type_alias * test/fiddle/test_cparser.rb: added type_alias test for parse_ctype and parse_struct_signature. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49119 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2015-01-03* ext/fiddle/lib/fiddle/cparser.rb: Support for Fiddle::CParserhsbt
to handle rich signatures including parameter names and function pointer types. Patch by @theryan [fix GH-590] * test/fiddle/test_cparser.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49110 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-09-17* test/fiddle/test_import.rb (Fiddle::TestImport#test_sizeof):hsbt
added test for long long [fix GH-716] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47607 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-09-15fiddle/import.rb: fix typonobu
* ext/fiddle/lib/fiddle/import.rb (Fiddle::Importer#sizeof): fix typo, SIZEOF_LONG_LON. [Fix GH-714] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47590 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-13test/dl, test/fiddle: relax criterianobu
* test/dl/test_{cptr,handle}.rb, test/fiddle/test_{handle,pointer}.rb: relax memory leak criteria. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-03-11envutil.rb: do not check RSS by defaultnobu
* test/ruby/envutil.rb (Test::Test#assert_no_memory_leak): do not check RSS by default, enabled by rss optional keyword argument. TestHash#test_exception_in_rehash sometimes fails otherwise. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45314 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-03-09tests for [Bug #9599]nobu
* test/dl/test_{cptr,handle}.rb: tests for [Bug #9599]. * test/fiddle/test_{handle,pointer}.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45299 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
2014-01-15same as r44598naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44600 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-01-15same as r44597naruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@44599 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-09-28* test/dl/test_base.rb: {libc, libm} detection now handle GNU/Hurdkosaki
correctly. Patch by Gabriele Giacone (1o5g4r8o@gmail.com). * test/fiddle/helper.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43077 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25* test/fiddle/test_handle.rb (Fiddle::TestHandle#test_static_sym): adjust ↵ktsj
indent. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40931 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-25* test/fiddle/test_c_struct_entry.rb,ktsj
test/fiddle/test_c_union_entity.rb, test/fiddle/test_cparser.rb, test/fiddle/test_func.rb, test/fiddle/test_handle.rb, test/fiddle/test_import.rb, test/fiddle/test_pointer.rb: don't run test if the system don't support fiddle. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40930 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-05-14* ext/dl/lib/dl/func.rb (DL::Function#call): check tainted whennagachika
$SAFE > 0. * ext/fiddle/function.c (function_call): check tainted when $SAFE > 0. * test/fiddle/test_func.rb (module Fiddle): add test for above. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40728 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11Fix if-endnaruse
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2013-04-11Experimental fix for ffi_closure_free causes dumping core/SEGVnaruse
http://u64.rubyci.org/~chkbuild/ruby-trunk/log/20130411T041301Z.log.html.gz#test%2F-ext- git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@40233 b2dd03c8-39d4-4d8f-98ff-823fe69b080e