Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions lava-job-template/qemu/qemu-blktests-hd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,48 @@ actions:
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 30
definitions:
- repository:
metadata:
format: Lava-Test Test Definition 1.0
name: install-kernel-moduels
description: "install kernel moduels"
run:
steps:
- |
kernel_release=$(uname -r)
modules_install_path="/lib/modules/${kernel_release}"
kernel_modules_url="https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/OERV-RVCI/rvck-olk/latest/${kernel_release}.tgz"
tmp_tar="/root/${kernel_release}.tgz"

[[ -d "${modules_install_path}" ]] && { echo "${modules_install_path} already exists"; return; }

mkdir -p /lib/modules
rm -f "$tmp_tar"
wget -O "${tmp_tar}" "${kernel_modules_url}" || { echo "wget ${kernel_modules_url} failed"; exit 1; }
tar -xf "${tmp_tar}" -C /lib/modules/ || { echo "tar ${tmp_tar} failed"; exit 2; }
rm -f "${tmp_tar}" || :
sync
reboot
from: inline
name: install-kernel-moduels
path: inline/install-kernel-moduels.yaml
# BOOT_BLOCK
- boot:
timeout:
minutes: 20
method: qemu
media: tmpfs
prompts: ["root@openeuler-riscv64"]
auto_login:
login_prompt: "openeuler-riscv64 login:"
username: root
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 10100
Expand Down
42 changes: 42 additions & 0 deletions lava-job-template/qemu/qemu-blktests-mmc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,48 @@ actions:
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 30
definitions:
- repository:
metadata:
format: Lava-Test Test Definition 1.0
name: install-kernel-moduels
description: "install kernel moduels"
run:
steps:
- |
kernel_release=$(uname -r)
modules_install_path="/lib/modules/${kernel_release}"
kernel_modules_url="https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/OERV-RVCI/rvck-olk/latest/${kernel_release}.tgz"
tmp_tar="/root/${kernel_release}.tgz"

[[ -d "${modules_install_path}" ]] && { echo "${modules_install_path} already exists"; return; }

mkdir -p /lib/modules
rm -f "$tmp_tar"
wget -O "${tmp_tar}" "${kernel_modules_url}" || { echo "wget ${kernel_modules_url} failed"; exit 1; }
tar -xf "${tmp_tar}" -C /lib/modules/ || { echo "tar ${tmp_tar} failed"; exit 2; }
rm -f "${tmp_tar}" || :
sync
reboot
from: inline
name: install-kernel-moduels
path: inline/install-kernel-moduels.yaml
# BOOT_BLOCK
- boot:
timeout:
minutes: 20
method: qemu
media: tmpfs
prompts: ["root@openeuler-riscv64"]
auto_login:
login_prompt: "openeuler-riscv64 login:"
username: root
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 10100
Expand Down
42 changes: 42 additions & 0 deletions lava-job-template/qemu/qemu-blktests-nvme.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,48 @@ actions:
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 30
definitions:
- repository:
metadata:
format: Lava-Test Test Definition 1.0
name: install-kernel-moduels
description: "install kernel moduels"
run:
steps:
- |
kernel_release=$(uname -r)
modules_install_path="/lib/modules/${kernel_release}"
kernel_modules_url="https://fast-mirror.isrc.ac.cn/openeuler-sig-riscv/openEuler-RISC-V/RVCK/OERV-RVCI/rvck-olk/latest/${kernel_release}.tgz"
tmp_tar="/root/${kernel_release}.tgz"

[[ -d "${modules_install_path}" ]] && { echo "${modules_install_path} already exists"; return; }

mkdir -p /lib/modules
rm -f "$tmp_tar"
wget -O "${tmp_tar}" "${kernel_modules_url}" || { echo "wget ${kernel_modules_url} failed"; exit 1; }
tar -xf "${tmp_tar}" -C /lib/modules/ || { echo "tar ${tmp_tar} failed"; exit 2; }
rm -f "${tmp_tar}" || :
sync
reboot
from: inline
name: install-kernel-moduels
path: inline/install-kernel-moduels.yaml
# BOOT_BLOCK
- boot:
timeout:
minutes: 20
method: qemu
media: tmpfs
prompts: ["root@openeuler-riscv64"]
auto_login:
login_prompt: "openeuler-riscv64 login:"
username: root
password_prompt: "Password:"
password: openEuler12#$
# TEST_BLOCK
- test:
timeout:
minutes: 10100
Expand Down
84 changes: 61 additions & 23 deletions lava-testcases/common-test/blktests/blktests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ gpgcheck=0
priority=99
"


while getopts "T:F:" arg; do
case "$arg" in
T)
Expand All @@ -35,7 +36,7 @@ done

parse_blktests_output() {
while IFS= read -r line; do
if [[ "$line" =~ \[(.*)\] ]]; then
if [[ "$line" =~ \[(passed|failed|not run)\]$ ]]; then
status="${BASH_REMATCH[1]}"
case "$status" in
passed)
Expand All @@ -47,9 +48,6 @@ parse_blktests_output() {
"not run")
new_status="skip"
;;
*)
new_status="unknown"
;;
esac
test_item=${line%%(*}
test_item=$(echo $test_item | sed 's/ //g')
Expand All @@ -62,39 +60,79 @@ parse_blktests_output() {
done < "$1"
}


install_blktests() {
echo "${RAVA_REPO}" | tee -a /etc/yum.repos.d/openEuler.repo
dnf install -y blktests
}

test_nvme(){
if [ -z "${TEST_ITEMS}" ]; then
cat > config << EOF
TEST_DEVS=(${1})
NVMET_TRTYPES="loop rdma tcp"
QUICK_RUN=1
TIMEOUT=100
EOF
test_items=nvme
echo "start test nvme: ./check ${test_items}" | tee -a "${OUTPUT}"/blktests.log
./check ${test_items} 2>&1 | tee -a "${OUTPUT}"/blktests.log
fi
cat > config << EOF
TEST_DEVS=(${1})
EXCLUDE=(block/040)
QUICK_RUN=1
TIMEOUT=100
EOF
test_items=${TEST_ITEMS:-block}
echo "start test nvme: ./check ${test_items}" | tee -a "${OUTPUT}"/blktests.log
./check ${test_items} 2>&1 | tee -a "${OUTPUT}"/blktests.log
}

test_mmc(){
### skip block/011 block/040
cat > config << EOF
TEST_DEVS=(${1})
EXCLUDE=(block/011 block/040)
QUICK_RUN=1
TIMEOUT=100
EOF
test_items=${TEST_ITEMS:-block}
echo "start test mmc: ./check ${test_items}" | tee -a "${OUTPUT}"/blktests.log
./check ${test_items} 2>&1 | tee -a "${OUTPUT}"/blktests.log
}

test_hdd(){
cat > config << EOF
TEST_DEVS=(${1})
EXCLUDE=(block/040)
QUICK_RUN=1
TIMEOUT=100
EOF
test_items=${TEST_ITEMS:-block throtl}
echo "start test hdd: ./check ${test_items}" | tee -a "${OUTPUT}"/blktests.log
./check ${test_items} 2>&1 | tee -a "${OUTPUT}"/blktests.log
}

run_blktests() {
cd /usr/lib/blktests
mkdir -p "${OUTPUT}"
rm -f "${OUTPUT}"/blktests.log

DEVICES=$(lsblk | grep "${DISK_FILTER}" | awk '{print $1}')
if [ -z "${DEVICES}" ]; then
echo Disk of size "${DISK_FILTER}" not detected.
exit 1
fi
TEST_DEVS_STR="TEST_DEVS=("
for dev in $DEVICES; do
TEST_DEVS_STR="${TEST_DEVS_STR}/dev/$dev "
lsblk -p -n -o NAME,SIZE,TYPE,ROTA,ZONED | grep "${DISK_FILTER}" | while read -r DEV SIZE TYPE ROTA ZONED; do
echo $DEV, $SIZE, $TYPE, $ROTA, $ZONED
case "$(basename "$DEV")" in
nvme*) test_nvme "$DEV" ;;
mmcblk*) test_mmc "$DEV" ;;
*) [[ "$ROTA" -eq 1 ]] && test_hdd "$DEV" || echo "skip test $DEV" ;;
esac
done

TEST_DEVS_STR="${TEST_DEVS_STR%?})"
echo $TEST_DEVS_STR > config
echo "QUICK_RUN=1" >> config
echo "TIMEOUT=90" >> config
cat config

echo start: ./check "${TEST_ITEMS}" | tee "${OUTPUT}"/blktests.log
./check "${TEST_ITEMS}" | tee "${OUTPUT}"/blktests.log
parse_blktests_output "${OUTPUT}"/blktests.log
cat "${OUTPUT}"/blktests.log
cat "${RESULT_FILE}"
}

lsmod
ls -la /lib/modules/

echo "============== Tests to run ==============="
install_blktests
echo "blktests install completely"
Expand Down