diff options
author | Anders Roxell <anders.roxell@linaro.org> | 2019-02-27 13:47:29 +0100 |
---|---|---|
committer | Chase Qi <chase.qi@linaro.org> | 2019-03-14 10:42:32 +0800 |
commit | a50a292fc0829b04b210b9d6b6a00a0e9d9b6db8 (patch) | |
tree | b19e1a5e53f9582045ed8b9df1036de5045be97e | |
parent | 18f30ecdc1b34453219e4779d918c333f49c0a58 (diff) |
add chroot with ltp for now
Signed-off-by: Anders Roxell <anders.roxell@linaro.org>
-rwxr-xr-x | automated/linux/chroot/download_and_mount.sh | 19 | ||||
-rw-r--r-- | automated/linux/chroot/ltp_chroot.yaml | 40 | ||||
-rwxr-xr-x | automated/linux/chroot/post_setup_run.sh | 10 | ||||
-rwxr-xr-x | automated/linux/chroot/pre_setup_run.sh | 14 |
4 files changed, 83 insertions, 0 deletions
diff --git a/automated/linux/chroot/download_and_mount.sh b/automated/linux/chroot/download_and_mount.sh new file mode 100755 index 0000000..b8477d5 --- /dev/null +++ b/automated/linux/chroot/download_and_mount.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +set -e + +NEW_ROOTFS=${1} + +( +cd / +curl -SOL "${NEW_ROOTFS}" +unxz rpb-console-image-lkft-*.rootfs.tar.xz +mkdir -p /new_root +tar --strip-components=1 -C new_root -xf rpb-console-image-lkft-*.rootfs.tar +rm rpb-console-image-lkft-*.rootfs.tar +cd new_root +mount -t proc /proc proc/ +mount --rbind /sys sys/ +mount --rbind /dev dev/ +mount --rbind /run run/ +) diff --git a/automated/linux/chroot/ltp_chroot.yaml b/automated/linux/chroot/ltp_chroot.yaml new file mode 100644 index 0000000..add9705 --- /dev/null +++ b/automated/linux/chroot/ltp_chroot.yaml @@ -0,0 +1,40 @@ +metadata: + name: ltp-chroot + format: "Lava-Test-Shell Test Definition 1.0" + description: "Run a chroot" + maintainer: + - anders.roxell@linaro.org + - chase.qi@linaro.org + os: + - OE + scope: + - functional + devices: + - qemu-arm64 +params: + #Parameters that is here for the chroot + NEW_ROOTFS: https://snapshots.linaro.org/openembedded/lkft/lkft/rocko/am57xx-evm/lkft/linux-next/441/rpb-console-image-lkft-am57xx-evm-20190115034131-441.rootfs.tar.xz + TEST_SUITE: ltp + +run: + steps: + - df -h + - pwd + - TESTDEF_URL=$(pwd) + - cd ./automated/linux/chroot + - ./download_and_mount.sh ${NEW_ROOTFS} + - . ./pre_setup_run.sh ${TEST_SUITE} ${TESTDEF_URL} + - | + # overwrite default params. + cat << EOF >> /new_root/run.sh + TST_CMDFILES=$TST_CMDFILES + SKIPFILE=$SKIPFILE + BOARD=$BOARD + BRANCH=$BRANCH + ENVIRONMENT=$ENVIRONMENT + SKIP_INSTALL=$SKIP_INSTALL + EOF + - . ./post_setup_run.sh ${TEST_SUITE} + - cat /new_root/run.sh + - chroot /new_root /bin/bash /run.sh + - /new_root/testdef/automated/utils/send-to-lava.sh /new_root/testdef/automated/linux/${TEST_SUITE}/output/result.txt diff --git a/automated/linux/chroot/post_setup_run.sh b/automated/linux/chroot/post_setup_run.sh new file mode 100755 index 0000000..aeeb6be --- /dev/null +++ b/automated/linux/chroot/post_setup_run.sh @@ -0,0 +1,10 @@ +#!/bin/bash + +set -e + +TEST_SUITE=${1} + +( +cd / +awk "/cd \.\/automated\/linux/{flag=1; next} /send-to-lava\.sh/{flag=0} flag" new_root/testdef/automated/linux/"${TEST_SUITE}"/"${TEST_SUITE}".yaml | sed 's/^ *- *//' >> new_root/run.sh +) diff --git a/automated/linux/chroot/pre_setup_run.sh b/automated/linux/chroot/pre_setup_run.sh new file mode 100755 index 0000000..41ec27f --- /dev/null +++ b/automated/linux/chroot/pre_setup_run.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +set -e + +TEST_SUITE=${1} +TESTDEF_URL=${2} + +( +cd / +git clone "${TESTDEF_URL}" new_root/testdef +echo "cat /etc/os-release" > new_root/run.sh +echo "cd /testdef/automated/linux/\"${TEST_SUITE}\"/" >> new_root/run.sh +awk "/params/{flag=1; next} /run/{flag=0} flag" new_root/testdef/automated/linux/"${TEST_SUITE}"/"${TEST_SUITE}".yaml | sed 's/^ *//; s/: */=/' >> new_root/run.sh +) |