Skip to content
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

Output lines are messed up with several tests files #86

Closed
a14n opened this issue Apr 22, 2015 · 8 comments
Closed

Output lines are messed up with several tests files #86

a14n opened this issue Apr 22, 2015 · 8 comments
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@a14n
Copy link
Contributor

a14n commented Apr 22, 2015

When I use pub run test (with test-0.12.0-beta.10 and Dart 1.10.0-dev.1.9) when several test files are available, the output lines seem not correct (dupplicated or removed).

For instance with the rational package:

$ pub run test:test test/bigint_test.dart 

00:00 +0: string validation                                                           
00:00 +1: string validation                                                           
00:00 +1: valid js int                                                                
00:00 +2: valid js int                                                                
00:00 +2: toString()                                                                  
00:00 +3: toString()                                                                  
00:00 +3: operator ==(BigInt other)                                                   
00:00 +4: operator ==(BigInt other)                                                   
00:00 +4: compareTo(BigInt other)                                                     
00:00 +5: compareTo(BigInt other)                                                     
00:00 +5: operator +(BigInt other)                                                    
00:00 +6: operator +(BigInt other)                                                    
00:00 +6: operator -(BigInt other)                                                    
00:00 +7: operator -(BigInt other)                                                    
00:00 +7: operator *(BigInt other)                                                    
00:00 +8: operator *(BigInt other)                                                    
00:00 +8: operator %(BigInt other)                                                    
00:00 +9: operator %(BigInt other)                                                    
00:00 +9: operator ~/(BigInt other)                                                   
00:00 +10: operator ~/(BigInt other)                                                  
00:00 +10: operator -()                                                               
00:00 +11: operator -()                                                               
00:00 +11: All tests passed!                                                                        

$ pub run test:test test/rational_test.dart 

00:00 +0: string validation                                                           
00:00 +1: string validation                                                           
00:00 +1: parse scientific notation                                                   
00:00 +2: parse scientific notation                                                   
00:00 +2: get isInteger                                                               
00:00 +3: get isInteger                                                               
00:00 +3: operator ==(Rational other)                                                 
00:00 +4: operator ==(Rational other)                                                 
00:00 +4: toDecimalString()                                                           
00:00 +5: toDecimalString()                                                           
00:00 +5: compareTo(Rational other)                                                   
00:00 +6: compareTo(Rational other)                                                   
00:00 +6: operator +(Rational other)                                                  
00:00 +7: operator +(Rational other)                                                  
00:00 +7: operator -(Rational other)                                                  
00:00 +8: operator -(Rational other)                                                  
00:00 +8: operator *(Rational other)                                                  
00:00 +9: operator *(Rational other)                                                  
00:00 +9: operator %(Rational other)                                                  
00:00 +10: operator %(Rational other)                                                 
00:00 +10: operator /(Rational other)                                                 
00:00 +11: operator /(Rational other)                                                 
00:00 +11: operator ~/(Rational other)                                                
00:00 +12: operator ~/(Rational other)                                                
00:00 +12: operator -()                                                               
00:00 +13: operator -()                                                               
00:00 +13: remainder(Rational other)                                                  
00:00 +14: remainder(Rational other)                                                  
00:00 +14: operator <(Rational other)                                                 
00:00 +15: operator <(Rational other)                                                 
00:00 +15: operator <=(Rational other)                                                
00:00 +16: operator <=(Rational other)                                                
00:00 +16: operator >(Rational other)                                                 
00:00 +17: operator >(Rational other)                                                 
00:00 +17: operator >=(Rational other)                                                
00:00 +18: operator >=(Rational other)                                                
00:00 +18: get isNaN                                                                  
00:00 +19: get isNaN                                                                  
00:00 +19: get isNegative                                                             
00:00 +20: get isNegative                                                             
00:00 +20: get isInfinite                                                             
00:00 +21: get isInfinite                                                             
00:00 +21: abs()                                                                      
00:00 +22: abs()                                                                      
00:00 +22: signum                                                                     
00:00 +23: signum                                                                     
00:00 +23: floor()                                                                    
00:00 +24: floor()                                                                    
00:00 +24: ceil()                                                                     
00:00 +25: ceil()                                                                     
00:00 +25: round()                                                                    
00:00 +26: round()                                                                    
00:00 +26: truncate()                                                                 
00:00 +27: truncate()                                                                 
00:00 +27: clamp(Rational lowerLimit, Rational upperLimit)                            
00:00 +28: clamp(Rational lowerLimit, Rational upperLimit)                            
00:00 +28: toInt()                                                                    
00:00 +29: toInt()                                                                    
00:00 +29: toDouble()                                                                 
00:00 +30: toDouble()                                                                 
00:00 +30: toStringAsFixed(int fractionDigits)                                        
00:00 +31: toStringAsFixed(int fractionDigits)                                        
00:00 +31: toStringAsExponential(int fractionDigits)                                  
00:00 +32: toStringAsExponential(int fractionDigits)                                  
00:00 +32: toStringAsPrecision(int precision)                                         
00:00 +33: toStringAsPrecision(int precision)                                         
00:00 +33: hasFinitePrecision                                                         
00:00 +34: hasFinitePrecision                                                         
00:00 +34: precision                                                                  
00:00 +35: precision                                                                  
00:00 +35: scale                                                                      
00:00 +36: scale                                                                      
00:00 +36: All tests passed!                                                                        

$ pub run test:test

00:00 +0: test/rational_test.dart: string validation                                  
00:00 +1: test/rational_test.dart: string validation                                  
00:00 +2: test/rational_test.dart: string validation                                  
00:00 +3: test/bigint_test.dart: toString()                                           
00:00 +4: test/bigint_test.dart: toString()                                           
00:00 +5: test/bigint_test.dart: toString()                                           
00:00 +6: test/bigint_test.dart: toString()                                           
00:00 +7: test/bigint_test.dart: toString()                                           
00:00 +8: test/rational_test.dart: compareTo(Rational other)                          
00:00 +9: test/rational_test.dart: compareTo(Rational other)                          
00:00 +9: test/bigint_test.dart: operator ==(BigInt other)                            
00:00 +10: test/rational_test.dart: operator +(Rational other)                        
00:00 +11: test/bigint_test.dart: compareTo(BigInt other)                             
00:00 +12: test/rational_test.dart: operator -(Rational other)                        
00:00 +13: test/bigint_test.dart: operator +(BigInt other)                            
00:00 +14: test/rational_test.dart: operator *(Rational other)                        
00:00 +15: test/bigint_test.dart: operator -(BigInt other)                            
00:00 +16: test/bigint_test.dart: operator -(BigInt other)                            
00:00 +16: test/rational_test.dart: operator %(Rational other)                        
00:00 +17: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +18: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +19: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +20: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +21: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +22: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +23: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +24: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +25: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +26: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +27: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +28: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +29: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +30: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +31: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +32: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +33: test/bigint_test.dart: operator *(BigInt other)                            
00:00 +34: test/rational_test.dart: truncate()                                        
00:00 +35: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +36: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +37: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +38: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +39: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +40: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +41: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +42: test/bigint_test.dart: operator %(BigInt other)                            
00:00 +42: test/rational_test.dart: hasFinitePrecision                                
00:00 +43: test/bigint_test.dart: operator ~/(BigInt other)                           
00:00 +44: test/bigint_test.dart: operator ~/(BigInt other)                           
00:00 +45: test/bigint_test.dart: operator ~/(BigInt other)                           
00:00 +46: test/bigint_test.dart: operator ~/(BigInt other)                           
00:00 +46: test/bigint_test.dart: operator -()                                        
00:00 +47: test/bigint_test.dart: operator -()                                        
00:00 +47: All tests passed!                                                                        

BTW: I don't really know why but depending on the screen size the pub run test output is either a single line or the above multi-line output. What is the reason ?

@zoechi
Copy link

zoechi commented Apr 22, 2015

Seems to be similar to google/grinder.dart#194 I run into when I run tests using Grinder.

@nex3
Copy link
Member

nex3 commented Apr 22, 2015

@a14n

When I use pub run test (with test-0.12.0-beta.10 and Dart 1.10.0-dev.1.9) when several test files are available, the output lines seem not correct (dupplicated or removed).

The runner runs multiple test suites in parallel. This means that there's not a clear linear progression of tests, since multiple tests are running at once and they may overlap, so it has to decide what to print when. The heuristic it uses is simple: it always prints the name of the test that's been running for the longest. This means that quick tests may not show up, and slow tests may show up for longer, but it also produces the least incomprehensible flickering on the command line.

BTW: I don't really know why but depending on the screen size the pub run test output is either a single line or the above multi-line output. What is the reason ?

Single-line output works via the magic of the carriage return or \r character. When printed, this character tells the terminal's cursor to go back to the beginning of the current line; any characters printed afterwards will overwrite those printed previously. This works well if everything fits on one line, but (for many terminals) once the width is too small the \r ends up on the next line, which means that it only goes back to the beginning of that line. This creates the multi-line output you see.

Unfortunately, there's no way (short of C APIs that are inaccessible to Dart) to determine the actual width of the terminal, so we have to just choose a number. The best workaround is to widen your terminal.

@nex3 nex3 closed this as completed Apr 22, 2015
@a14n
Copy link
Contributor Author

a14n commented Apr 22, 2015

Thanks for the explanation.

@nex3
Copy link
Member

nex3 commented Apr 22, 2015

Unfortunately, there's no way (short of C APIs that are inaccessible to Dart) to determine the actual width of the terminal, so we have to just choose a number. The best workaround is to widen your terminal.

Actually, this may not be true; it looks like most Unix terminals are capable of more advanced manipulation just using escape codes on standard IO. That's worth investigating in the future.

@nex3
Copy link
Member

nex3 commented Apr 22, 2015

Actually, dart:io's Stdout object has a terminalLines getter. We should just use that to detect how long to make our lines.

@nex3 nex3 reopened this Apr 22, 2015
@nex3 nex3 added this to the 0.12.0 milestone Apr 22, 2015
@nex3 nex3 added type-enhancement A request for a change that isn't a bug type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed type-enhancement A request for a change that isn't a bug labels Apr 22, 2015
@nex3
Copy link
Member

nex3 commented Apr 22, 2015

Unfortunately, this is blocked on pub run spawning an isolate for its subprocesses.

@avilladsen
Copy link

Is there any update on this? Is it still blocked?

@nex3
Copy link
Member

nex3 commented Sep 20, 2017

No, this is no longer blocked.

@nex3 nex3 removed the status-blocked Blocked from making progress by another (referenced) issue label Sep 20, 2017
nex3 added a commit that referenced this issue Nov 1, 2017
nex3 added a commit that referenced this issue Nov 1, 2017
Fall back on a 200-character default, which is less likely to obscure
test names when printing to a non-terminal destination.

Closes #86
@nex3 nex3 closed this as completed in #716 Nov 2, 2017
nex3 added a commit that referenced this issue Nov 2, 2017
Use Stdout.terminalColumns for line length

Fall back on a 200-character default, which is less likely to obscure
test names when printing to a non-terminal destination.

Closes #86
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

4 participants