From ea26a7cc5ddd2a7b01b1f96f4876c1fdb7783e5f Mon Sep 17 00:00:00 2001 From: Chase Qi Date: Wed, 19 Apr 2017 15:49:27 +0800 Subject: Rename test directory for disk partitioning test Change-Id: Idcd83a16e0f2f938f31eb312eccaa344b634512c Signed-off-by: Chase Qi --- .../linux/disk-partitioning/disk-partitioning.sh | 90 ++++++++++++++++++++++ .../linux/disk-partitioning/disk-partitioning.yaml | 34 ++++++++ automated/linux/disk/disk-partitioning.sh | 90 ---------------------- automated/linux/disk/disk-partitioning.yaml | 34 -------- plans/rpb_ee/rpb_ee_functional.yaml | 4 +- 5 files changed, 126 insertions(+), 126 deletions(-) create mode 100755 automated/linux/disk-partitioning/disk-partitioning.sh create mode 100644 automated/linux/disk-partitioning/disk-partitioning.yaml delete mode 100755 automated/linux/disk/disk-partitioning.sh delete mode 100644 automated/linux/disk/disk-partitioning.yaml diff --git a/automated/linux/disk-partitioning/disk-partitioning.sh b/automated/linux/disk-partitioning/disk-partitioning.sh new file mode 100755 index 0000000..e0c7033 --- /dev/null +++ b/automated/linux/disk-partitioning/disk-partitioning.sh @@ -0,0 +1,90 @@ +#!/bin/sh + +# shellcheck disable=SC1091 +. ../../lib/sh-test-lib +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" +export RESULT_FILE +DISKLABEL="gpt" +FILESYSTEM="ext4" + +usage() { + echo "Usage: $0 [-d ] [-l ] [-f ] [-s ]" 1>&2 + exit 1 +} + +while getopts "d:l:f:r:s:" o; do + case "$o" in + # The existing disk label on the device will be destroyed, + # and all data on this disk will be lost. + d) DEVICE="${OPTARG}" ;; + l) DISKLABEL="${OPTARG}" ;; + f) FILESYSTEM="${OPTARG}" ;; + s) SKIP_INSTALL="${OPTARG}" ;; + *) usage ;; + esac +done + +create_disklabel() { + echo + echo "Creating ${DEVICE} disklabel: ${DISKLABEL}" + umount "${DEVICE}*" > /dev/null 2>&1 + # If mklabel fails, skip the following tests. + skip_list="create-partition format-partition mount-partition umount-partition" + parted -s "${DEVICE}" mklabel "${DISKLABEL}" + exit_on_fail "create-disklabel" "${skip_list}" + + sync + sleep 10 +} + +create_partition() { + echo + echo "Creating partition: ${DEVICE}1" + skip_list="format-partition mount-partition umount-partition" + parted -s "${DEVICE}" mkpart primary 0% 100% + exit_on_fail "create-partition" "${skip_list}" + + sync + sleep 10 +} + +format_partition() { + echo + echo "Formatting ${DEVICE}1 to ${FILESYSTEM}" + skip_list="mount-partition umount-partition" + if [ "${FILESYSTEM}" = "fat32" ]; then + echo "y" | mkfs -t vfat -F 32 "${DEVICE}1" + else + echo "y" | mkfs -t "${FILESYSTEM}" "${DEVICE}1" + fi + exit_on_fail "format-partition" "${skip_list}" + + sync + sleep 10 +} + +disk_mount() { + echo + echo "Running mount/umount tests..." + umount /mnt > /dev/null 2>&1 + skip_list="umount-partition" + mount "${DEVICE}1" /mnt + exit_on_fail "mount-partition" "${skip_list}" + + umount "${DEVICE}1" + check_return "umount-partition" +} + +# Test run. +[ -b "${DEVICE}" ] || error_msg "Please specify a block device with '-d'" +! check_root && error_msg "You need to be root to run this script." +create_out_dir "${OUTPUT}" + +pkgs="parted e2fsprogs dosfstools" +install_deps "${pkgs}" "${SKIP_INSTALL}" + +create_disklabel +create_partition +format_partition +disk_mount diff --git a/automated/linux/disk-partitioning/disk-partitioning.yaml b/automated/linux/disk-partitioning/disk-partitioning.yaml new file mode 100644 index 0000000..c48b52a --- /dev/null +++ b/automated/linux/disk-partitioning/disk-partitioning.yaml @@ -0,0 +1,34 @@ +metadata: + name: disk-partitioning-test + format: "Lava-Test-Shell Test Definition 1.0" + description: "Disk partitioning test." + maintainer: + - chase.qi@linaro.org + os: + - debian + - ubuntu + - fedora + - centos + devices: + - mustang + - hi6220-hikey + - apq8016-sbc + scope: + - functional + environment: + - lava-test-shell + +params: + # The existing disk label on the device will be destroyed, + # and all data on this disk will be lost. + DEVICE: "" + # Supported labels: msdos and gpt + DISKLABEL: "gpt" + FILESYSTEM: "ext4" + SKIP_INSTALL: "False" + +run: + steps: + - cd ./automated/linux/disk/ + - ./disk-partitioning.sh -d "${DEVICE}" -l "${DISKLABEL}" -f "${FILESYSTEM}" -s "${SKIP_INSTALL}" + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/automated/linux/disk/disk-partitioning.sh b/automated/linux/disk/disk-partitioning.sh deleted file mode 100755 index e0c7033..0000000 --- a/automated/linux/disk/disk-partitioning.sh +++ /dev/null @@ -1,90 +0,0 @@ -#!/bin/sh - -# shellcheck disable=SC1091 -. ../../lib/sh-test-lib -OUTPUT="$(pwd)/output" -RESULT_FILE="${OUTPUT}/result.txt" -export RESULT_FILE -DISKLABEL="gpt" -FILESYSTEM="ext4" - -usage() { - echo "Usage: $0 [-d ] [-l ] [-f ] [-s ]" 1>&2 - exit 1 -} - -while getopts "d:l:f:r:s:" o; do - case "$o" in - # The existing disk label on the device will be destroyed, - # and all data on this disk will be lost. - d) DEVICE="${OPTARG}" ;; - l) DISKLABEL="${OPTARG}" ;; - f) FILESYSTEM="${OPTARG}" ;; - s) SKIP_INSTALL="${OPTARG}" ;; - *) usage ;; - esac -done - -create_disklabel() { - echo - echo "Creating ${DEVICE} disklabel: ${DISKLABEL}" - umount "${DEVICE}*" > /dev/null 2>&1 - # If mklabel fails, skip the following tests. - skip_list="create-partition format-partition mount-partition umount-partition" - parted -s "${DEVICE}" mklabel "${DISKLABEL}" - exit_on_fail "create-disklabel" "${skip_list}" - - sync - sleep 10 -} - -create_partition() { - echo - echo "Creating partition: ${DEVICE}1" - skip_list="format-partition mount-partition umount-partition" - parted -s "${DEVICE}" mkpart primary 0% 100% - exit_on_fail "create-partition" "${skip_list}" - - sync - sleep 10 -} - -format_partition() { - echo - echo "Formatting ${DEVICE}1 to ${FILESYSTEM}" - skip_list="mount-partition umount-partition" - if [ "${FILESYSTEM}" = "fat32" ]; then - echo "y" | mkfs -t vfat -F 32 "${DEVICE}1" - else - echo "y" | mkfs -t "${FILESYSTEM}" "${DEVICE}1" - fi - exit_on_fail "format-partition" "${skip_list}" - - sync - sleep 10 -} - -disk_mount() { - echo - echo "Running mount/umount tests..." - umount /mnt > /dev/null 2>&1 - skip_list="umount-partition" - mount "${DEVICE}1" /mnt - exit_on_fail "mount-partition" "${skip_list}" - - umount "${DEVICE}1" - check_return "umount-partition" -} - -# Test run. -[ -b "${DEVICE}" ] || error_msg "Please specify a block device with '-d'" -! check_root && error_msg "You need to be root to run this script." -create_out_dir "${OUTPUT}" - -pkgs="parted e2fsprogs dosfstools" -install_deps "${pkgs}" "${SKIP_INSTALL}" - -create_disklabel -create_partition -format_partition -disk_mount diff --git a/automated/linux/disk/disk-partitioning.yaml b/automated/linux/disk/disk-partitioning.yaml deleted file mode 100644 index c48b52a..0000000 --- a/automated/linux/disk/disk-partitioning.yaml +++ /dev/null @@ -1,34 +0,0 @@ -metadata: - name: disk-partitioning-test - format: "Lava-Test-Shell Test Definition 1.0" - description: "Disk partitioning test." - maintainer: - - chase.qi@linaro.org - os: - - debian - - ubuntu - - fedora - - centos - devices: - - mustang - - hi6220-hikey - - apq8016-sbc - scope: - - functional - environment: - - lava-test-shell - -params: - # The existing disk label on the device will be destroyed, - # and all data on this disk will be lost. - DEVICE: "" - # Supported labels: msdos and gpt - DISKLABEL: "gpt" - FILESYSTEM: "ext4" - SKIP_INSTALL: "False" - -run: - steps: - - cd ./automated/linux/disk/ - - ./disk-partitioning.sh -d "${DEVICE}" -l "${DISKLABEL}" -f "${FILESYSTEM}" -s "${SKIP_INSTALL}" - - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/plans/rpb_ee/rpb_ee_functional.yaml b/plans/rpb_ee/rpb_ee_functional.yaml index c4b5f1b..38fd7fb 100644 --- a/plans/rpb_ee/rpb_ee_functional.yaml +++ b/plans/rpb_ee/rpb_ee_functional.yaml @@ -90,12 +90,12 @@ requirements: category: Low-level kernel tests: automated: - - path: automated/linux/disk/disk-partitioning.yaml + - path: automated/linux/disk-partitioning/disk-partitioning.yaml repository: https://git.linaro.org/qa/test-definitions.git mandatory: True parameters: DEVICE: /dev/sdb - - path: automated/linux/disk/disk-partitioning.yaml + - path: automated/linux/disk-partitioning/disk-partitioning.yaml repository: https://git.linaro.org/qa/test-definitions.git mandatory: True parameters: -- cgit v1.2.3