summaryrefslogtreecommitdiff
path: root/test/ruby/test_rubyoptions.rb
AgeCommit message (Collapse)Author
2018-07-27ruby.c: taint ARGV on Windowsnobu
* ruby.c (external_str_new_cstr): strings come from the external should be tainted. [ruby-dev:50596] [Bug #14941] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64071 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-22test_rubyoptions.rb: allow passing test_verbosek0kubun
with --jit. `./ruby --jit -Itest/lib test/ruby/test_rubyoptions.rb -n "TestRubyOptions#test_verbose"` has failed without -DMJIT_FORCE_ENABLE like: 1) Failure: TestRubyOptions#test_verbose [/home/travis/build/k0kubun/mjit-test/test/ruby/test_rubyoptions.rb:118]: <"ruby 2.6.0dev (2018-07-21 trunk 64010) +JIT [x86_64-linux]"> expected but was <"ruby 2.6.0dev (2018-07-21 trunk 64010) [x86_64-linux]">. but the test should pass even without -DMJIT_FORCE_ENABLE. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64011 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-18test_rubyoptions.rb: skip testing JIT on mswink0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-18ruby.c: accept --disable-jit optionk0kubun
by promoting jit to feature flag. mjit.h: update comment about mjit_opts.on test_rubyoptions.rb: add test for switching JIT enablement "--jit" flag usage may be deprecated later, but not discussed yet. [Feature #14878] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63995 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-16ruby.c: disable DidYouMean as gemnobu
* ruby.c (process_options): as DidYouMean requires Rubygems, disable the former when the latter is disabled too. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63977 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-05unrevert r63852 but keep SIGCHLD path disabled for win32normal
Reading win32/win32.c waitpid implementation, maybe waitpid(-1, ...) on that platform will never conflict with mjit use of waitpid. In any case, I've added WAITPID_USE_SIGCHLD macro to vm_core.h so it can be easy for Linux/BSD users to test (hopefully!) win32-compatible code. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63855 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-07-04Revert r63758 and related commitsnaruse
The change is unstable on Windows. Please re-commit it when it correctly supports Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63852 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-30fix r63799 ("test/ruby/test_rubyoptions.rb: improve diagnostics for failures")normal
CI machines are faster than mine :x git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63802 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-06-30test/ruby/test_rubyoptions.rb: improve diagnostics for failuresnormal
rubyci.org OSX CI instances seem to hang on this, but I'm not sure why... git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63799 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31fix the conditionnobu
* test/ruby/test_rubyoptions.rb: Process.wait with WNOHANG returns nil while the target process is alive. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-31test_rubyoptions.rb: relax timeoutnobu
* test/ruby/test_rubyoptions.rb: wait for setting process title until the child process dies, in the case of extra heavy loads. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63537 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-29fake.rb: fix RUBY_DESCRIPTION for MJITnobu
* template/fake.rb.in: reflect MJIT to RUBY_DESCRIPTION. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63522 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-24test_rubyoptions.rb: RbConfig::CONFIG['cppflags'] can be nilk0kubun
not '' at least on AppVeyor git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63502 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-24test_rubyoptions.rb: allow passing test_verbosek0kubun
with -DMJIT_FORCE_ENABLE. With -DMJIT_FORCE_ENABLE, absence of --jit doesn't mean JIT disabled. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63501 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-05-09Use `&.` instead of modifier ifkazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63378 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28test_rubyoptions.rb: let all tests work with --jitk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28test_bug_reporter.rb: make it work with --jitk0kubun
test_rubyoptions.rb: replace gsub with sub because it's suboptimal for this git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63287 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-28test_rubyoptions.rb: let test_verbose work w/ --jitk0kubun
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-13file.c: chardev is loadablenobu
* file.c (ruby_is_fd_loadable): allow character devices to load, e.g., `ruby /dev/null` exits successfully. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63143 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12parse.y: `when` indentnobu
* parse.y (k_when): warn less-indented `when` than `case`. [ruby-core:86492] [Bug #14674] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-04-12assert indents of `case` and `end`nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63138 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-19parse.y: mismatched indentations at middlenobu
* parse.y (k_rescue, k_ensure, k_when, k_else, k_elsif): warn mismatched indentations at keywords in middle of blocks. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62836 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-03-01parse.y: refine assign_in_cond warningnobu
* parse.y (assign_in_cond): refine a warning message for assignment of a literal in conditinal expression. [ruby-core:85872] [Bug #14562] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62620 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22test/ruby/test_rubyoptions.rb: fix typo and only expect +JIT for CRubyeregon
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22test_rubyoptions.rb: don't test --jit if not supportedk0kubun
test/lib/jit_support.rb: carved out JITSupport test/ruby/test_jit.rb: ditto git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62533 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-22version.c: show +JIT when --jit is passedk0kubun
in version output. version.h: ditto ruby.c: propagate option for it common.mk: updated dependency for version.c mjit.c: overwrites the RUBY_DESCRIPTION to have +JIT when --jit is passed test/ruby/test_rubyoptions.rb: add test for them Only `ruby --jit -v` will have "+JIT", but this is intentional. This may not be convenient for debugging by ticket with `ruby -v`, but it's convenient for benchmark tools that pass options (--jit) when showing it. At least such behavior is planned for benchmark_driver.gem and this behavior is designed for it. Other benchmark tools are recommended to follow the behavior too if they show version. RUBY_DESCRIPTION might be useful for it too. The position of "+JIT" is changed from original proposal because other platforms like JRuby and TruffleRuby end it with archtecture. It's made similar to JRuby, but it's upper-cased because Matz made approval for "+JIT" in the ticket. Example: $ ruby -v ruby 2.6.0dev (2018-02-22 trunk 62529) [x86_64-linux] $ ruby --jit -v ruby 2.6.0dev (2018-02-22 trunk 62529) +JIT [x86_64-linux] After --jit is made default in the future, this output may be removed. So do not rely on this output if possible. [Feature #14462] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62530 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16compile.c: keep debug infonobu
* compile.c (iseq_peephole_optimize): keep freezestring insn with debug info. [Bug #14475] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62418 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-16test_rubyoptions.rb: show code in failure messagesnobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62415 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2018-02-04mjit.c: merge MJIT infrastructurek0kubun
that allows to JIT-compile Ruby methods by generating C code and using C compiler. See the first comment of mjit.c to know what this file does. mjit.c is authored by Vladimir Makarov <vmakarov@redhat.com>. After he invented great method JIT infrastructure for MRI as MJIT, Lars Kanis <lars@greiz-reinsdorf.de> sent the patch to support MinGW in MJIT. In addition to merging it, I ported pthread to Windows native threads. Now this MJIT infrastructure can be compiled on Visual Studio. This commit simplifies mjit.c to decrease code at initial merge. For example, this commit does not provide multiple JIT threads support. We can resurrect them later if we really want them, but I wanted to minimize diff to make it easier to review this patch. `/tmp/_mjitXXX` file is renamed to `/tmp/_ruby_mjitXXX` because non-Ruby developers may not know the name "mjit" and the file name should make sure it's from Ruby and not from some harmful programs. TODO: it may be better to store this to some temporary directory which Ruby is already using by Tempfile, if it's not bad for performance. mjit.h: New. It has `mjit_exec` interface similar to `vm_exec`, which is for triggering MJIT. This drops interface for AOT compared to the original MJIT. Makefile.in: define macros to let MJIT know the path of MJIT header. Probably we can refactor this to reduce the number of macros (TODO). win32/Makefile.sub: ditto. common.mk: compile mjit.o and mjit_compile.o. Unlike original MJIT, this commit separates MJIT infrastructure and JIT compiler code as independent object files. As initial patch is NOT going to have ultra-fast JIT compiler, it's likely to replace JIT compiler, e.g. original MJIT's compiler or some future JIT impelementations which are not public now. inits.c: define MJIT module. This is added because `MJIT.enabled?` was necessary for testing. test/lib/zombie_hunter.rb: skip if `MJIT.enabled?`. Obviously this wouldn't work with current code when JIT is enabled. test/ruby/test_io.rb: skip this too. This would make no sense with MJIT. ruby.c: define MJIT CLI options. As major difference from original MJIT, "-j:l"/"--jit:llvm" are renamed to "--jit-cc" because I want to support not only gcc/clang but also cl.exe (Visual Studio) in the future. But it takes only "--jit-cc=gcc", "--jit-cc=clang" for now. And only long "--jit" options are allowed since some Ruby committers preferred it at Ruby developers Meeting on January, and some of options are renamed. This file also triggers to initialize MJIT thread and variables. eval.c: finalize MJIT worker thread and variables. test/ruby/test_rubyoptions.rb: fix number of CLI options for --jit. thread_pthread.c: change for pthread abstraction in MJIT. Prefix rb_ for functions which are used by other files. thread_win32.c: ditto, for Windows. Those pthread porting is one of major works that YARV-MJIT created, which is my fork of MJIT, in Feature 14235. thread.c: follow rb_ prefix changes vm.c: trigger MJIT call on VM invocation. Also trigger `mjit_mark` to avoid SEGV by race between JIT and GC of ISeq. The improvement was provided by wanabe <s.wanabe@gmail.com>. In JIT compiler I created and am going to add in my next commit, I found that having `mjit_exec` after `vm_loop_start:` is harmful because the JIT-ed function doesn't proceed other ISeqs on RESTORE_REGS of leave insn. Executing non-FINISH frame is unexpected for my JIT compiler and `exception_handler` triggers executions of such ISeqs. So `mjit_exec` here should be executed only when it directly comes from `vm_exec` call. `RubyVM::MJIT` module and `.enabled?` method is added so that we can skip some tests which don't expect JIT threads or compiler file descriptors. vm_insnhelper.h: trigger MJIT on method calls during VM execution. vm_core.h: add fields required for mjit.c. `bp` must be `cfp[6]` because rb_control_frame_struct is likely to be casted to another struct. The last position is the safest place to add the new field. vm_insnhelper.c: save initial value of cfp->ep as cfp->bp. This is an optimization which are done in both MJIT and YARV-MJIT. So this change is added in this commit. Calculating bp from ep is a little heavy work, so bp is kind of cache for it. iseq.c: notify ISeq GC to MJIT. We should know which iseq in MJIT queue is GCed to avoid SEGV. TODO: unload some GCed units in some safe way. gc.c: add hooks so that MJIT can wait GC, and vice versa. Simultaneous JIT and GC executions may cause SEGV and so we should synchronize them. cont.c: save continuation information in MJIT worker. As MJIT shouldn't unload JIT-ed code which is being used, MJIT wants to know full list of saved execution contexts for continuation and detect ISeqs in use. mjit_compile.c: added empty JIT compiler so that you can reuse this commit to build your own JIT compiler. This commit tries to compile ISeqs but all of them are considered as not supported in this commit. So you can't use JIT compiler in this commit yet while we added --jit option now. Patch author: Vladimir Makarov <vmakarov@redhat.com>. Contributors: Takashi Kokubun <takashikkbn@gmail.com>. wanabe <s.wanabe@gmail.com>. Lars Kanis <lars@greiz-reinsdorf.de>. Part of Feature 12589 and 14235. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62189 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-16ruby.c: script __dir__ encodingnobu
* ruby.c (process_options): fallback to the encoding of the script name since rb_realpath_internal() cannot convert the encoding when it is ASCII-8BIT. * test/ruby/test_rubyoptions.rb (test___dir__encoding): explicitly pass environment variables for locale as they are overriden by invoke_ruby. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61297 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-12-12Add FrozenError as a subclass of RuntimeErrorshyouhei
FrozenError will be used instead of RuntimeError for exceptions raised when there is an attempt to modify a frozen object. The reason for this change is to differentiate exceptions related to frozen objects from generic exceptions such as those generated by Kernel#raise without an exception class. From: Jeremy Evans <code@jeremyevans.net> Signed-off-by: Urabe Shyouhei <shyouhei@ruby-lang.org> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61131 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-11-12load.c: cwd encodingnobu
* load.c (rb_get_expanded_load_path): save cwd cache in OS path encoding, to get rid of unnecessary conversion and infinite loading when it needs encoding conversion. [ruby-dev:50221] [Bug #13863] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60743 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-24Test for r60396nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60400 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-21The encoding of __FILE__ and __dir__ should be sameusa
* ruby.c (process_options): convert the real path of the script to locale encoding if its encoding is not locale (maybe UTF-8) on Windows/OS X. this change makes the encoding of __dir__ to the same encoding of __FILE__ when the script name is passed from commandline. * test/ruby/test_options.rb (test___dir__encoding): test for this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60300 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-19ruby.c: reject NUL in $0nobu
* ruby.c (ruby_setproctitle): raise if the argument contains NUL char. process title is a NUL-terminated string. [ruby-core:82425] [Bug #13829] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60215 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-10-11parse.y: token info with BOMnobu
* parse.y (parser_prepare): set token_info_enabled flag first, before returning at BOM. [ruby-dev:50288] [Bug #13998] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60160 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-20ruby.c: paragraph mode by -00nobu
* ruby.c (proc_options): set to paragraph mode, if -00 is given, as well as perl and -R0 option in 0.49. [ruby-core:81987] [Bug #13736] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59970 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-15Remove needless splat arraykazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59921 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-09-13test_rubyoptions.rb: keep paths if necessarynobu
* test/ruby/test_rubyoptions.rb (TestRubyOptions#test_search): PATH must keep library loading paths on a platform where it is used for that purpose, for extra libraries. [ruby-core:81178] [Bug #13569] [Fix GH-1616] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59870 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-08-10ruby.c: ignore non-option in shebang linenobu
* ruby.c (moreswitches): process all words as options only in an environment variable, but not in a shebang line. [ruby-core:82267] [Bug #13786] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59564 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-13Use tr! instead of gsub!kazu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59324 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-07-10test_rubyoptions.rb: assert -00nobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@59308 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-06-01fix failure on r58981ko1
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58983 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-05-30test_rubyoptions.rb: ruby-runner sets $0 to install name nownobu
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58969 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-19parse.y: chomp by -lnobu
* parse.y (rb_parser_while_loop): should chomp but not chop by -l option. [ruby-core:78099] [Bug #12926] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57373 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13error.c: movednobu
* error.c (preface_dump, postscript_dump): CrashReporter directory was used before Mac OS X 10.6. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2017-01-13error.c: movednobu
* error.c (preface_dump, postscript_dump): moved from rb_vm_bugreport to place the last important message at the very last after [NOTE]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57317 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-26Fix -e script encodingnobu
* ruby.c (process_options): convert -e script to the encoding given by a command line option on Windows. assume it is the expected encoding. [ruby-dev:49461] [Bug #11900] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54785 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-23ruby.c: fix command line encoding on cygwinnobu
* ruby.c: cygwin does not use w32_cmdvector, command line can be other than UTF-8. [ruby-dev:49519] [Bug #12184] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54720 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2016-04-11test_rubyoptions.rb: suppress warningnobu
* test/ruby/test_rubyoptions.rb (test_indentation_check): remove unused variable to suppress warning. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@54538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e