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>
diff --git a/automated/linux/ltp/ltp.sh b/automated/linux/ltp/ltp.sh
index cb4a1ac..789b56e 100755
--- a/automated/linux/ltp/ltp.sh
+++ b/automated/linux/ltp/ltp.sh
@@ -15,6 +15,11 @@
TST_CMDFILES=""
# List of test cases to be skipped
SKIPFILE=""
+# List of test cases to be skipped in yaml/skipgen format
+SKIPFILE_YAML=""
+BOARD=""
+BRANCH=""
+ENVIRONMENT=""
# LTP version
LTP_VERSION="20170929"
LTP_TMPDIR=/ltp-tmp
@@ -24,6 +29,9 @@
usage() {
echo "Usage: ${0} [-T mm,math,syscalls]
[-S skipfile-lsk-juno]
+ [-b board]
+ [-g branch]
+ [-e environment]
[-s True|False]
[-v LTP_VERSION]
[-M Timeout_Multiplier]
@@ -31,7 +39,7 @@
exit 0
}
-while getopts "M:T:S:s:v:R:" arg; do
+while getopts "M:T:S:b:g:e:s:v:R:" arg; do
case "$arg" in
T)
TST_CMDFILES="${OPTARG}"
@@ -39,17 +47,38 @@
LOG_FILE=$(echo "${OPTARG}"| sed 's,\/,_,')
;;
S)
- OPT=$(echo "${OPTARG}" | grep "http")
- if [ -z "${OPT}" ] ; then
- # LTP skipfile
- SKIPFILE="-S ${SCRIPTPATH}/${OPTARG}"
+ if [ -z "${OPTARG##*http*}" ]; then
+ if [ -z "${OPTARG##*yaml*}" ]; then
+ # Skipfile is of type yaml
+ SKIPFILE_TMP="http-skipfile.yaml"
+ SKIPFILE_YAML="${SCRIPTPATH}/${SKIPFILE_TMP}"
+ else
+ # Skipfile is normal skipfile
+ SKIPFILE_TMP="http-skipfile"
+ SKIPFILE="-S ${SCRIPTPATH}/${SKIPFILE_TMP}"
+ fi
+ # Download LTP skipfile from specified URL
+ if ! wget "${OPTARG}" -O "${SKIPFILE_TMP}"; then
+ error_msg "Failed to fetch ${OPTARG}"
+ exit 1
+ fi
+ elif [ "${OPTARG##*.}" = "yaml" ]; then
+ # yaml skipfile; use skipgen to generate a skipfile
+ SKIPFILE_YAML="${SCRIPTPATH}/${OPTARG}"
else
- # Download LTP skipfile from speficied URL
- wget "${OPTARG}" -O "skipfile"
- SKIPFILE="skipfile"
- SKIPFILE="-S ${SCRIPTPATH}/${SKIPFILE}"
+ # Regular LTP skipfile
+ SKIPFILE="-S ${SCRIPTPATH}/${OPTARG}"
fi
;;
+ b)
+ export BOARD="${OPTARG}"
+ ;;
+ g)
+ export BRANCH="${OPTARG}"
+ ;;
+ e)
+ export ENVIRONMENT="${OPTARG}"
+ ;;
# SKIP_INSTALL is true in case of Open Embedded builds
# SKIP_INSTALL is flase in case of Debian builds
s) SKIP_INSTALL="${OPTARG}";;
@@ -60,6 +89,16 @@
esac
done
+if [ -n "${SKIPFILE_YAML}" ]; then
+ export SKIPFILE_PATH="${SCRIPTPATH}/generated_skipfile"
+ generate_skipfile
+ if [ ! -f "${SKIPFILE_PATH}" ]; then
+ error_msg "Skipfile ${SKIPFILE} does not exist";
+ exit 1
+ fi
+ SKIPFILE="-S ${SKIPFILE_PATH}"
+fi
+
# Install LTP test suite
install_ltp() {
rm -rf /opt/ltp