summaryrefslogtreecommitdiff
path: root/automated/lib/sh-test-lib
diff options
context:
space:
mode:
authorDan Rue <dan.rue@linaro.org>2018-01-26 17:28:35 -0600
committerDan Rue <dan.rue@linaro.org>2018-01-30 08:10:00 -0600
commitf4970555fbf58d5d5152622cfef17df85ff34349 (patch)
treed37280d1cd5df59f89a1556961509866bde661b3 /automated/lib/sh-test-lib
parent8ec540c3707ff9561575d4cca9839953016d37dd (diff)
LTP: Add skipgen skipfile support to ltp
Create a helper function in sh-test-lib to handle the mechanics of generating a skipfile, that will be re-usable by kselftest. Add the following arguments to ltp.sh: [-b board] [-g branch] [-e environment] When the skipfile argument passed via -S ends in ".yaml", a skipfile will be generated using skipgen. Board, branch, and environment are optional arguments that get passed to skipgen. The resulting skipfile is automatically printed to stdout after being generated. Change-Id: Ib45d11acfa85241dbe5dfa7173e75cb7754a6892 Signed-off-by: Dan Rue <dan.rue@linaro.org>
Diffstat (limited to 'automated/lib/sh-test-lib')
-rwxr-xr-xautomated/lib/sh-test-lib27
1 files changed, 26 insertions, 1 deletions
diff --git a/automated/lib/sh-test-lib b/automated/lib/sh-test-lib
index c4e4591..1e02795 100755
--- a/automated/lib/sh-test-lib
+++ b/automated/lib/sh-test-lib
@@ -268,7 +268,7 @@ validate_check_sum() {
convert_to_mb() {
[ "$#" -ne 2 ] && error_msg "Usage: convert_to_mb value units"
- if ! echo "$1" | egrep -q "^[0-9.]+$"; then
+ if ! echo "$1" | grep -E -q "^[0-9.]+$"; then
error_msg "The first argument isn't a number"
fi
value="$1"
@@ -356,3 +356,28 @@ create_out_dir() {
mkdir -p "${OUTPUT}"
[ -d "${OUTPUT}" ] || error_msg "Could not create output directory ${OUTPUT}"
}
+
+generate_skipfile() {
+ # Generate a skipfile and set the SKIPFILE variable based on SKIPFILE_YAML,
+ # BOARD, BRANCH, and ENVIRONMENT.
+ #
+ # In:
+ # SKIPFILE_YAML: (required) skipgen/yaml formatted skipfile
+ # SKIPFILE_PATH: (required) destination file for generated skipfile
+ # BOARD: (optional) board name to pass to skipgen
+ # BRANCH: (optional) branch name to pass to skipgen
+ # ENVIRONMENT: (optional) environment name to pass to skipgen
+ #
+ info_msg "Generating a skipfile based on ${SKIPFILE_YAML}"
+ detect_abi
+ SKIPGEN_ARGS=""
+ test -n "${BOARD}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --board ${BOARD}"
+ test -n "${BRANCH}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --branch ${BRANCH}"
+ test -n "${ENVIRONMENT}" && SKIPGEN_ARGS="${SKIPGEN_ARGS} --environment ${ENVIRONMENT}"
+ # shellcheck disable=SC2086
+ ../../bin/${abi}/skipgen ${SKIPGEN_ARGS} "${SKIPFILE_YAML}" > "${SKIPFILE_PATH}"
+ test $? -eq 0 || error_msg "skipgen failed to generate a skipfile"
+ info_msg "Using the following generated skipfile contents (until EOF):"
+ cat "${SKIPFILE_PATH}"
+ info_msg "EOF"
+}