Skip to content
This repository has been archived by the owner on May 12, 2021. It is now read-only.

Reformat usage output in test_image.sh #165

Merged
merged 1 commit into from
Sep 18, 2018

Conversation

marcov
Copy link
Contributor

@marcov marcov commented Sep 10, 2018

Reformat the usage output displayed with help command or -h option.
Trap exit codes only after options parsing, as that is used to generate a test report.

Before:

Usage: test_images.sh [help|<distro>]                                                                                  
       test_images.sh [options]                                                                                        
                                                                                                                       
Options:                                                                                                               
                                                                                                                       
  -h | --help          # Show usage.                                                                                   
  --distro <distro>    # Only run tests for specified distro.                                                          
  --list               # List all distros that can be tested.                                                          
  --test-images-only   # Only run images tests for the list of distros under test.                                     
  --test-initrds-only  # Only run initrds tests for the list of distros under test.                                    
                                                                                                                       
Parameters:                                                                                                            
                                                                                                                       
                                                                                                                       
help     : Show usage.                                                                                                 
<distro> : Only run tests for specified distro.

Notes:

- If no options or parameters are specified, all tests will be run.                                                   

INFO: tests passed successfully - cleaning up

After:

Usage: test_images.sh [options] [command | <distro>]

Options:
  -h | --help          # Show usage.
  --distro <distro>    # Only run tests for specified distro.                                                         
  --list               # List all distros that can be tested.                                                         
  --test-images-only   # Only run images tests for the list of distros under test.                                    
  --test-initrds-only  # Only run initrds tests for the list of distros under test.                                   

Commands:
help     : Show usage.


When <distro> is specified, tests are run only for the specified <distro> distribution.                               
Otherwise, tests are be run on all distros.

@marcov marcov force-pushed the reformat-usage branch 2 times, most recently from b65d120 to c1d32a5 Compare September 12, 2018 13:45
Reformat the usage output displayed with `help` command or `-h` option.
Trap exit codes only after options parsing, as that is used to
generate a test report.

Fixes: kata-containers#169

Signed-off-by: Marco Vedovati <mvedovati@suse.com>
Copy link
Contributor

@grahamwhaley grahamwhaley left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

heh - will you be updating all scripts you touch? I think all our scripts are hard wired to /bin/bash - so, that could keep you busy for some time ;-)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not so bad if you just do that when stumbling on it :)
Btw I started to care about this when reviewing kata-containers/tests#692

@grahamwhaley
Copy link
Contributor

hint - when changing the output of something like the help, it is useful to include the before and after example output in the merge or commit message - makes it easier to review ;-)

@marcov
Copy link
Contributor Author

marcov commented Sep 18, 2018

@grahamwhaley yep you are right:)

@jcvenegas jcvenegas merged commit c3230c2 into kata-containers:master Sep 18, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants