-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
OSX: can't run test framework - sometimes #256
Comments
test/unit do provide an interface to hook a gui, i choose to go the console route so that i could use shoes terminal, was more interesting to me :-) |
I may try to move the stdout/stderr notification center loops (if you will) into regular Shoes start up on osx and unless their is a terminal window, they wouldn't update anything just flush. That way $stdout is setup earlier as it is when run with -w on the commandline. |
There's a curiosity or four with test-unit and Shoes/OSX. On OSX the xterm-256color is not being found in ENV['TERM'] or it's not being passed to the right places. That looks like a test-unit bug. There are options to TestRunner.new that might help with setting output to $stderr -but I've yet to find any doc about where run() is located and what options it supports and what I have seen say's no options. |
Shoes users would benefit from a GUI version. we should always consider the long term benefits of extending Shoes ecosystem, encouraging users to use its features and report issues. |
@backorder , so far the tests are only of value to people willing to fix shoes internals. Those folks can handle the terminal output and there is GUI to select which tests and button to not display details. I'm perfectly happy running them -w on the osx command line. The problem is they should also run loaded from the splash screen on osx. It behaves badly because Shoes/OSX doesn't have working ruby STDOUT at the time test/unit is loaded. |
Some progress. I updated the test/unit gem to 3.2.0 (osx was 3.0.8, linux: 3.1.7) - no change on the colorization. I think I've found the bug that causes it to fail when run w/o One more clarification for @backorder, the GUI tests in test/unit are Gtk2, Tk, or Fox. You have to Perhaps someone will be inspired to do a gui for mini-test since Ruby delivers both and evidently opinions about which is better runs deep. |
* no monkey patch works for OSX and test/unit * bugs/bug236.rb is broken - that explains the missing color * it's like something didn't get merged from terminal branch
* mostly a commit in case I need to revert.
It gets deeper and deeper. So many moving parts if you can't depend on STDOUT or $stdout. My current thinking is that Shoes OSX needs to create it's stdout fd from an NSPipe before initializing Ruby, (world.c, shoes_init() and gems on the paths) and store the NSFileHandles and fds globally, Then when the event loop is started add an NSNotifcationCenter observer that basically just empties the pipe so it doesn't hang Shoes with a pipe full condition. IF a script calls Shoes.terminal (or Shoes.show_console) then cocoa-term.m would replace that Observer sink with a new one that puts the chars into the NSTextView like is done now. Would it be easier to hook into minitest as an plugin sort of thing that interprets test results and appends to a Shoes edit_box? Maybe, Maybe not. None of that explains why bugs/bug236.rb can work (-w or not) when displaying colors. |
following from a bit too far away |
* Shoes.terminal works again but still oddly compared to -w launch No gain for branch. Boo for online Apple doc. * -h or -g list -l don't display results so thats not good. Suggests the Gui (a window) needs to be on screen for Notication Center to work.
Before I could really get into what osx is doing I decided I need a better launch script for |
I like the last screenshot the best. You still can use the colours to highlight successful and failed tests, or have an option to turn it on/off. |
@backorder - you missed the point. All four of them should be similar (colored). Three are are, one incorrectly with cyan instead of green and the one you like, should have color - it's the default setting for test/unit. Shoes is not handling default color settings for two of them properly. |
If you look closer, OSX native terminal sets a background of green with black text and Linux native terminal draws green dots. That's nothing to do with Shoes or the script settings (and both test/units are 3.20.0 now). Shoes.terminal ought to be close. It's not. It could be that test/unit is sending a |
I modified the terminal code to capture the data stream before it's interpreted for esc sequences. On Linux it's sending an escape sequence I didn't handle for setting colors and it would be a mess to implement it properly - Any one want to type in an 256 element table of RGB values in C? On OSX + Shoes.terminal there are no escape sequences being sent. zip, nada, none but the capture does have other controls chars so it is getting the raw stream from test/unit. debugging test/unit in Shoes is probably easier on OSX but I'm not looking forward to it. |
OSX color diagnosed. test/unit checks if the output is a tty? before checking for ENV["TERM"] and that tty test will fail on Shoes/OSX in Shoes.terminal. No way to fix that in Shoes. Tests need to explicitly ask for color. @test_result = Test::Unit::UI::Console::TestRunner.run(tests, {use_color: true}) you can set to it false if you don't like colors. The shade of green is a little different between native xterm-256color and Shoes.terminal but I consider that very small problem unlikely to be fixed or even noticed. |
* because OSX wants it and it can't be fixed in Shoes.
* raw capture data can be enabled for the 'copy' button. Very useful for debuging escape sequences: * which still aren't correct * removed VTE code * will remove game-mode in the future. Clever but DOA for osx.
* convert some 256 color indices to 8 (dos?) colors. very incomplete.
* not sure anyone would notice or care about the bugs.
For consistency I'm going to add the osx screen captures for Tests/tests_video.rb showing the error they find - a different error from linux but the point is to show the text formatting and colors. There are color differences which will be important to someone I suppose. The solution is too I think I'll create a new github issue about the color256 problem and close this one since one can run tests with or without color. The colors may be wrong in some peoples opinion but since this a very unlikely to be used part of Shoes. I'm also going to remove any cursor positioning code. Bad idea and who cares? |
* just a couple of cosmetic things left for #236
One mystery solved.The Gtk theme determines how/which test/unit escapes are sent. on the pi2, it looks like it does on OSX - green background, black character whereas on my Ubuntu theme it's green characters on a white background. I don't know whether to laugh, cry or sigh. |
Closed in Shoes 3.3.2 |
Running the Tests/ tests_video_vlc.rb and tests_svg.rb as written fails on OSX unless its done with a
$ ./cshoes -w Tests/...rb command line invocation. When run **without** the -w switch (or from a Splash screen pick) then the null osx $stdout has been _captured_ in a test/unit internal variable (
io) in the
require`s or setup of minitest before the call to Shoes.terminal (or deprecated Shoes.show_console).Although this seems related to issue #224 and #236 (which are mostly fixed), it's different. The nascent test framework GUI from @passenger94 doesn't account for the idea that stdout is defined later. I suspect test/unit might have an option to change that
io
variable. Or it should have.The text was updated successfully, but these errors were encountered: