Skip to content

Commit

Permalink
Add support for external test scripts
Browse files Browse the repository at this point in the history
Enhance the ./check test driver with an option to call external scripts
as if they resided inside xfstests. This should help prototyping tests
built on top of xfstests infrastructure without actually adding them to
the framework first.

Signed-off-by: David Sterba <[email protected]>
  • Loading branch information
kdave committed May 15, 2024
1 parent 1eccb97 commit 7705347
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions check
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ iterations=1
istop=false
loop_on_fail=0
exclude_tests=()
EXTERNAL_SCRIPTS=()

# This is a global variable used to pass test failure text to reporting gunk
_err_msg=""
Expand Down Expand Up @@ -83,6 +84,7 @@ check options
-s section run only specified section from config file
-S section exclude the specified section from the config file
-L <n> loop tests <n> times following a failure, measuring aggregate pass/fail metrics
--external FILE use external testscript FILE, can be specified multiple times
testlist options
-g group[,group...] include tests from these groups
Expand Down Expand Up @@ -342,6 +344,16 @@ while [ $# -gt 0 ]; do
loop_on_fail=$2; shift
;;

--external)
xfile="$2"; shift;
if ! [ -f "$xfile" ]; then
echo "External script $xfile is not a file"
exit 1
fi
echo "Adding external script $xfile"
EXTERNAL_SCRIPTS+=("$xfile")
;;

-*) usage ;;
*) # not an argument, we've got tests now.
have_test_arg=true ;;
Expand Down Expand Up @@ -385,6 +397,10 @@ if [ -n "$subdir_xfile" ]; then
done
fi

for ext in ${EXTERNAL_SCRIPTS[*]}; do
echo "$ext" >> $tmp.list
done

# Process tests from command line now.
if $have_test_arg; then
while [ $# -gt 0 ]; do
Expand Down

0 comments on commit 7705347

Please sign in to comment.