Skip to content

Commit 1e4165f

Browse files
roxellnareshkamboju
authored andcommitted
automated: linux: ltp: add support for the new kirk runner
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 <anders.roxell@linaro.org>
1 parent d34f5cb commit 1e4165f

File tree

2 files changed

+32
-4
lines changed

2 files changed

+32
-4
lines changed

automated/linux/ltp/ltp.sh

+26-3
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ BUILD_FROM_TAR="false"
3030
SHARD_NUMBER=1
3131
SHARD_INDEX=1
3232

33+
RUNNER=""
34+
3335
LTP_TMPDIR=/ltp-tmp
3436

3537
LTP_INSTALL_PATH=/opt/ltp
@@ -46,6 +48,7 @@ usage() {
4648
[-v LTP_VERSION]
4749
[-M Timeout_Multiplier]
4850
[-R root_password]
51+
[-r new runner (kirk)]
4952
[-u git url]
5053
[-p build directory]
5154
[-t build from tarfile ]
@@ -55,7 +58,7 @@ usage() {
5558
exit 0
5659
}
5760

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

163+
parse_ltp_json_results() {
164+
jq -r '.results| .[]| "\(.test_fqn) \(.test.result)"' "$1" \
165+
| sed 's/brok/fail/; s/conf/skip/' >> "${RESULT_FILE}"
166+
}
167+
159168
# Run LTP test suite
160169
run_ltp() {
161170
# shellcheck disable=SC2164
@@ -172,14 +181,28 @@ run_ltp() {
172181
cat runtest/shardfile
173182
echo "===========End Tests to run ==============="
174183

175-
pipe0_status "./runltp -p -q -f shardfile \
184+
if [ -n "${RUNNER}" ]; then
185+
eval "${RUNNER}" --version
186+
# shellcheck disable=SC2181
187+
if [ $? -ne "0" ]; then
188+
error_msg "${RUNNER} is not installed into the file system."
189+
fi
190+
pipe0_status "${RUNNER} --framework ltp --run-suite shardfile \
191+
-d ${LTP_TMPDIR} --env LTP_COLORIZE_OUTPUT=0 \
192+
--skip-file ${SKIPFILE_PATH} \
193+
--json-report /tmp/kirk-report.json \
194+
--verbose" "tee ${OUTPUT}/LTP_${LOG_FILE}.out"
195+
parse_ltp_json_results "/tmp/kirk-report.json"
196+
else
197+
pipe0_status "./runltp -p -q -f shardfile \
176198
-l ${OUTPUT}/LTP_${LOG_FILE}.log \
177199
-C ${OUTPUT}/LTP_${LOG_FILE}.failed \
178200
-d ${LTP_TMPDIR} \
179201
${SKIPFILE}" "tee ${OUTPUT}/LTP_${LOG_FILE}.out"
202+
parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log"
203+
fi
180204
# check_return "runltp_${LOG_FILE}"
181205

182-
parse_ltp_output "${OUTPUT}/LTP_${LOG_FILE}.log"
183206
# Cleanup
184207
# don't fail the whole test job if rm fails
185208
rm -rf "${LTP_TMPDIR}" || true

automated/linux/ltp/ltp.yaml

+6-1
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@ params:
3939
# root's password. Needed by ltp/su01.
4040
ROOT_PASSWD: root
4141

42+
# New kirk runner (https://github.com/linux-test-project/kirk.git)
43+
# Needs to be installed onto the rootfs.
44+
# Set RUNNER to full path to kik or to kirk if its in the PATH.
45+
RUNNER: ""
46+
4247
# If the following parameter is set, then the LTP suite is
4348
# cloned and used unconditionally. In particular, the version
4449
# of the suite is set to the commit pointed to by the
@@ -71,5 +76,5 @@ params:
7176
run:
7277
steps:
7378
- cd ./automated/linux/ltp/
74-
- ./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}"
79+
- ./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}"
7580
- ../../utils/send-to-lava.sh ./output/result.txt

0 commit comments

Comments
 (0)