Skip to content

Commit

Permalink
automated: linux: ltp: add support for the new kirk runner
Browse files Browse the repository at this point in the history
LTP has depricated their runltp runner to run tests.
The new one is called kirk
(https://github.com/linux-test-project/kirk.git) which replaces runltp.
For now runltp will be the default runner. If someone wants to use
kirk, it has to be pre-installed into the rootfs, and the yaml varialbe
RUNNER has to be set to 'kirk' or '/usr/local/bin/kirk'.

Signed-off-by: Anders Roxell <[email protected]>
  • Loading branch information
roxell authored and nareshkamboju committed Jun 13, 2024
1 parent d34f5cb commit 1e4165f
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
29 changes: 26 additions & 3 deletions automated/linux/ltp/ltp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ BUILD_FROM_TAR="false"
SHARD_NUMBER=1
SHARD_INDEX=1

RUNNER=""

LTP_TMPDIR=/ltp-tmp

LTP_INSTALL_PATH=/opt/ltp
Expand All @@ -46,6 +48,7 @@ usage() {
[-v LTP_VERSION]
[-M Timeout_Multiplier]
[-R root_password]
[-r new runner (kirk)]
[-u git url]
[-p build directory]
[-t build from tarfile ]
Expand All @@ -55,7 +58,7 @@ usage() {
exit 0
}

while getopts "M:T:S:b:d:g:e:i:s:v:R:u:p:t:c:n:" arg; do
while getopts "M:T:S:b:d:g:e:i:s:v:R:r:u:p:t:c:n:" arg; do
case "$arg" in
T)
TST_CMDFILES="${OPTARG}"
Expand Down Expand Up @@ -111,6 +114,7 @@ while getopts "M:T:S:b:d:g:e:i:s:v:R:u:p:t:c:n:" arg; do
# Slow machines need more timeout Default is 5min and multiply * MINUTES
M) export LTP_TIMEOUT_MUL="${OPTARG}";;
R) export PASSWD="${OPTARG}";;
r) export RUNNER="${OPTARG}";;
u)
if [[ "$OPTARG" != '' ]]; then
TEST_GIT_URL="$OPTARG"
Expand Down Expand Up @@ -156,6 +160,11 @@ parse_ltp_output() {
| sed 's/PASS/pass/; s/FAIL/fail/; s/CONF/skip/' >> "${RESULT_FILE}"
}

parse_ltp_json_results() {
jq -r '.results| .[]| "\(.test_fqn) \(.test.result)"' "$1" \
| sed 's/brok/fail/; s/conf/skip/' >> "${RESULT_FILE}"
}

# Run LTP test suite
run_ltp() {
# shellcheck disable=SC2164
Expand All @@ -172,14 +181,28 @@ run_ltp() {
cat runtest/shardfile
echo "===========End Tests to run ==============="

pipe0_status "./runltp -p -q -f shardfile \
if [ -n "${RUNNER}" ]; then
eval "${RUNNER}" --version
# shellcheck disable=SC2181
if [ $? -ne "0" ]; then
error_msg "${RUNNER} is not installed into the file system."
fi
pipe0_status "${RUNNER} --framework ltp --run-suite shardfile \
-d ${LTP_TMPDIR} --env LTP_COLORIZE_OUTPUT=0 \
--skip-file ${SKIPFILE_PATH} \
--json-report /tmp/kirk-report.json \
--verbose" "tee ${OUTPUT}/LTP_${LOG_FILE}.out"
parse_ltp_json_results "/tmp/kirk-report.json"
else
pipe0_status "./runltp -p -q -f shardfile \
-l ${OUTPUT}/LTP_${LOG_FILE}.log \
-C ${OUTPUT}/LTP_${LOG_FILE}.failed \
-d ${LTP_TMPDIR} \
${SKIPFILE}" "tee ${OUTPUT}/LTP_${LOG_FILE}.out"
parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log"
fi
# check_return "runltp_${LOG_FILE}"

parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log"
# Cleanup
# don't fail the whole test job if rm fails
rm -rf "${LTP_TMPDIR}" || true
Expand Down
7 changes: 6 additions & 1 deletion automated/linux/ltp/ltp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,11 @@ params:
# root's password. Needed by ltp/su01.
ROOT_PASSWD: root

# New kirk runner (https://github.com/linux-test-project/kirk.git)
# Needs to be installed onto the rootfs.
# Set RUNNER to full path to kik or to kirk if its in the PATH.
RUNNER: ""

# If the following parameter is set, then the LTP suite is
# cloned and used unconditionally. In particular, the version
# of the suite is set to the commit pointed to by the
Expand Down Expand Up @@ -71,5 +76,5 @@ params:
run:
steps:
- cd ./automated/linux/ltp/
- ./ltp.sh -T "${TST_CMDFILES}" -s "${SKIP_INSTALL}" -v "${LTP_VERSION}" -M "${TIMEOUT_MULTIPLIER}" -R "${ROOT_PASSWD}" -b "${BOARD}" -d "${LTP_TMPDIR}" -g "${BRANCH}" -e "${ENVIRONMENT}" -i "${LTP_INSTALL_PATH}" -S "${SKIPFILE}" -p "${TEST_DIR}" -u "${TEST_GIT_URL}" -t "${BUILD_FROM_TAR}" -n "${SHARD_NUMBER}" -c "${SHARD_INDEX}"
- ./ltp.sh -T "${TST_CMDFILES}" -s "${SKIP_INSTALL}" -v "${LTP_VERSION}" -M "${TIMEOUT_MULTIPLIER}" -R "${ROOT_PASSWD}" -r "${RUNNER}" -b "${BOARD}" -d "${LTP_TMPDIR}" -g "${BRANCH}" -e "${ENVIRONMENT}" -i "${LTP_INSTALL_PATH}" -S "${SKIPFILE}" -p "${TEST_DIR}" -u "${TEST_GIT_URL}" -t "${BUILD_FROM_TAR}" -n "${SHARD_NUMBER}" -c "${SHARD_INDEX}"
- ../../utils/send-to-lava.sh ./output/result.txt

0 comments on commit 1e4165f

Please sign in to comment.