| |
@@ -25,6 +25,7 @@
|
| |
-t, --testname name of the test
|
| |
--timeout test timeout
|
| |
-c, --cmd shell command to run the test
|
| |
+ --save-files list of files to be saved to artifacts, files are separated by comma. Path is relative to workdir
|
| |
EOF
|
| |
}
|
| |
|
| |
@@ -39,9 +40,10 @@
|
| |
STR_TEST_NAME="${STR_TEST_NAME:-}"
|
| |
STR_ARTIFACTS_DIR="${STR_ARTIFACTS_DIR:-/tmp}"
|
| |
STR_TIMEOUT="${STR_TIMEOUT:-0}"
|
| |
+ STR_SAVE_FILES="${STR_SAVE_FILES:-}"
|
| |
|
| |
# http://wiki.bash-hackers.org/howto/getopts_tutorial
|
| |
- opt=$(getopt -n "$0" --options "hvt:w:a:c:" --longoptions "help,verbose,cmd:,testname:,workdir:,artifactsdir:,timeout:" -- "$@")
|
| |
+ opt=$(getopt -n "$0" --options "hvt:w:a:c:" --longoptions "help,verbose,cmd:,testname:,workdir:,artifactsdir:,timeout:,save-files:" -- "$@")
|
| |
eval set -- "$opt"
|
| |
while [[ $# -gt 0 ]]; do
|
| |
case "$1" in
|
| |
@@ -65,6 +67,10 @@
|
| |
STR_TIMEOUT="$2"
|
| |
shift 2
|
| |
;;
|
| |
+ --save-files)
|
| |
+ STR_SAVE_FILES=$(echo "$2" | tr "," " ")
|
| |
+ shift 2
|
| |
+ ;;
|
| |
-v|--verbose)
|
| |
DEBUG="-v"
|
| |
shift
|
| |
@@ -143,6 +149,15 @@
|
| |
echo " - $(basename $prefixed_log)" >> "$results"
|
| |
fi
|
| |
done
|
| |
+ for file in $STR_SAVE_FILES; do
|
| |
+ if [[ ! -d $STR_ARTIFACTS_DIR/$STR_TEST_NAME ]]; then
|
| |
+ mkdir -p $STR_ARTIFACTS_DIR/$STR_TEST_NAME
|
| |
+ fi
|
| |
+ set +f # allow expand wildcards on file name, like output*.log
|
| |
+ # if for some reason file doesn't exist, just ignore it
|
| |
+ cp -f $STR_WORKDIR/$file $STR_ARTIFACTS_DIR/$STR_TEST_NAME || true
|
| |
+ set -f
|
| |
+ done
|
| |
exit 0
|
| |
}
|
| |
trap clean_exit SIGINT SIGTERM SIGABRT EXIT
|
| |
if you replace
join(',')
withjoin(' ')
this also should work, but no need then : do :tr