[ 
https://issues.apache.org/jira/browse/BIGTOP-1316?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14032584#comment-14032584
 ] 

Steve Loughran commented on BIGTOP-1316:
----------------------------------------

if someone does {{exit(-2)}}, then the return code from the operation is 
{{-2}}. The purpose of the sign correction to ensure that the exit code raised 
is what you see in your assertis without having to know in your head that it 
magically becomes, in the case of exit -2, 254. This lets you make assertions 
that the result of an operation matches the exit code *using the same 
constant*. I still keep the uncorrected return code around for those people who 
like to keep their maintenance costs high. 

w.r.t debugging, Having things at trace level lets you see the output even for 
commands that do not fail -this can be useful- ; on a failure my asserts simply 
repeat this with a different log level. Which we can't easily do by sharing 
code unless I play games with closures and then pass in {{Log.trace()}} or 
{{LOG.error}} depending on the chosen log level.

> enhance Shell for better checking of return code & output logging
> -----------------------------------------------------------------
>
>                 Key: BIGTOP-1316
>                 URL: https://issues.apache.org/jira/browse/BIGTOP-1316
>             Project: Bigtop
>          Issue Type: Improvement
>          Components: Tests
>    Affects Versions: 0.8.0
>            Reporter: Steve Loughran
>            Assignee: Steve Loughran
>            Priority: Minor
>         Attachments: BIGTOP-1316-001.patch
>
>
> for the slider tests, we extended Shell with 
> [SliderShellhttps://svn.apache.org/viewvc/incubator/slider/trunk/slider-funtest/src/main/groovy/org/apache/slider/funtest/framework/SliderShell.groovy?view=markup],
>  adding some more features. Some of those are biased towards executing our 
> entry point, but there are some useful core features worth pulling up to the 
> base class
> # {{toString()}} and {{dump()}} methods with diagnostics
> # return code sign correction and assertion checking
> # construction of bash environment and command lines
> The bash setup could be done with a class {{Bash extends Shell}} which is 
> designed purely for bash execution



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to