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

Add t/test_opts.sh - Automated testing of command line options #1536

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

horshack-dpreview
Copy link
Contributor

New script for testing combinations of command-line options. You define groups of options and this script will execute all permutations of those options. I've been using this to test my changes before committing. For example:

numjobs=("numjobs=1" "numjobs=8")
rw=("rw=write" "rw=randrw")
bs=("bs=512" "bs=64K")
thread=("" "thread")

all=("numjobs" "rw" "bs" "thread")

commonArgs="-name=test -ioengine=null -size=500M"

Will execute fio with permutations of options:

Permutation 0: --numjobs=1 --rw=write --bs=512
Permutation 1: --numjobs=8 --rw=write --bs=512
Permutation 2: --numjobs=1 --rw=randrw --bs=512
Permutation 3: --numjobs=8 --rw=randrw --bs=512
Permutation 4: --numjobs=1 --rw=write --bs=64K
Permutation 5: --numjobs=8 --rw=write --bs=64K
Permutation 6: --numjobs=1 --rw=randrw --bs=64K
Permutation 7: --numjobs=8 --rw=randrw --bs=64K
Permutation 8: --numjobs=1 --rw=write --bs=512 --thread
Permutation 9: --numjobs=8 --rw=write --bs=512 --thread
Permutation 10: --numjobs=1 --rw=randrw --bs=512 --thread
Permutation 11: --numjobs=8 --rw=randrw --bs=512 --thread
Permutation 12: --numjobs=1 --rw=write --bs=64K --thread
Permutation 13: --numjobs=8 --rw=write --bs=64K --thread
Permutation 14: --numjobs=1 --rw=randrw --bs=64K --thread
Permutation 15: --numjobs=8 --rw=randrw --bs=64K --thread

All permutations will have these options in common:

-name=test -ioengine=null -size=500M

Signed-off-by: Adam Horshack ([email protected])

@vincentkfu
Copy link
Collaborator

shellcheck has some suggestions:

$ shellcheck t/test_opts.sh 

In t/test_opts.sh line 1:
 #!/bin/bash
^-- SC1114 (error): Remove leading spaces before the shebang.


In t/test_opts.sh line 34:
    local numjobs=("numjobs=1" "numjobs=8")
          ^-----^ SC2034 (warning): numjobs appears unused. Verify use (or export if used externally).


In t/test_opts.sh line 35:
    local rw=("rw=write" "rw=randrw")
          ^-- SC2034 (warning): rw appears unused. Verify use (or export if used externally).


In t/test_opts.sh line 36:
    local bs=("bs=512" "bs=64K")
          ^-- SC2034 (warning): bs appears unused. Verify use (or export if used externally).


In t/test_opts.sh line 37:
    local thread=("" "thread") # groups can have empty members, to test with and without option
          ^----^ SC2034 (warning): thread appears unused. Verify use (or export if used externally).


In t/test_opts.sh line 47:
    read -p "Press enter to start tests..."
    ^--^ SC2162 (info): read without -r will mangle backslashes.


In t/test_opts.sh line 125:
        if [[ -z ${groupVals[@]} ]]; then
                 ^-------------^ SC2199 (error): Arrays implicitly concatenate in [[ ]]. Use a loop (or explicit * instead of @).


In t/test_opts.sh line 148:
    "${fio_executable}" $args; exitCode=$?
                        ^---^ SC2086 (info): Double quote to prevent globbing and word splitting.

Did you mean: 
    "${fio_executable}" "$args"; exitCode=$?

For more information:
  https://www.shellcheck.net/wiki/SC1114 -- Remove leading spaces before the ...
  https://www.shellcheck.net/wiki/SC2199 -- Arrays implicitly concatenate in ...
  https://www.shellcheck.net/wiki/SC2034 -- bs appears unused. Verify use (or...

New script for testing combinations of command-line options.
You define groups of options and this script will execute all
permutations of those options. For example:

numjobs=("numjobs=1" "numjobs=8")
rw=("rw=write" "rw=randrw")
bs=("bs=512" "bs=64K")
thread=("" "thread")

all=("numjobs" "rw" "bs" "thread")

commonArgs="-name=test -ioengine=null -size=500M"

Will execute fio with permutations of options:

Permutation 0: --numjobs=1 --rw=write --bs=512
Permutation 1: --numjobs=8 --rw=write --bs=512
Permutation 2: --numjobs=1 --rw=randrw --bs=512
Permutation 3: --numjobs=8 --rw=randrw --bs=512
Permutation 4: --numjobs=1 --rw=write --bs=64K
Permutation 5: --numjobs=8 --rw=write --bs=64K
Permutation 6: --numjobs=1 --rw=randrw --bs=64K
Permutation 7: --numjobs=8 --rw=randrw --bs=64K
Permutation 8: --numjobs=1 --rw=write --bs=512 --thread
Permutation 9: --numjobs=8 --rw=write --bs=512 --thread
Permutation 10: --numjobs=1 --rw=randrw --bs=512 --thread
Permutation 11: --numjobs=8 --rw=randrw --bs=512 --thread
Permutation 12: --numjobs=1 --rw=write --bs=64K --thread
Permutation 13: --numjobs=8 --rw=write --bs=64K --thread
Permutation 14: --numjobs=1 --rw=randrw --bs=64K --thread
Permutation 15: --numjobs=8 --rw=randrw --bs=64K --thread

All permutations will have these options in common:

-name=test -ioengine=null -size=500M

Signed-off-by: Adam Horshack ([email protected])
@horshack-dpreview
Copy link
Contributor Author

@vincentkfu, Thanks. All but the first warning were false alarms. I've removed the leading space on the shebang.

@vincentkfu
Copy link
Collaborator

Leading space is still there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants