Naresh Kamboju | c3a32af | 2017-01-18 11:16:22 +0530 | [diff] [blame] | 1 | #!/bin/sh |
| 2 | # |
| 3 | # MMC test cases |
| 4 | # |
| 5 | # Copyright (C) 2017, Linaro Limited. |
| 6 | # |
| 7 | # This program is free software; you can redistribute it and/or |
| 8 | # modify it under the terms of the GNU General Public License |
| 9 | # as published by the Free Software Foundation; either version 2 |
| 10 | # of the License, or (at your option) any later version. |
| 11 | # |
| 12 | # This program is distributed in the hope that it will be useful, |
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | # GNU General Public License for more details. |
| 16 | # |
| 17 | # You should have received a copy of the GNU General Public License |
| 18 | # along with this program; if not, write to the Free Software |
| 19 | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 20 | # |
| 21 | # Author: Naresh Kamboju <naresh.kamboju@linaro.org> |
| 22 | # |
| 23 | |
| 24 | # shellcheck disable=SC1091 |
| 25 | . ../../lib/sh-test-lib |
| 26 | OUTPUT="$(pwd)/output" |
| 27 | RESULT_FILE="${OUTPUT}/result.txt" |
| 28 | export RESULT_FILE |
| 29 | |
| 30 | # List the mmc devices |
| 31 | list_all_mmc_devices() { |
| 32 | info_msg "Running list-all-mmc-devices test..." |
| 33 | lsblk | grep "mmc" |
| 34 | exit_on_fail "mmc" |
| 35 | } |
| 36 | |
| 37 | # Test run. |
| 38 | ! check_root && error_msg "This script must be run as root" |
Daniel Díaz | 6f49a1b | 2017-02-15 18:56:15 -0600 | [diff] [blame^] | 39 | create_out_dir "${OUTPUT}" |
Naresh Kamboju | c3a32af | 2017-01-18 11:16:22 +0530 | [diff] [blame] | 40 | |
| 41 | info_msg "About to run MMC test..." |
| 42 | info_msg "Output directory: ${OUTPUT}" |
| 43 | |
| 44 | # Check kernel config |
| 45 | if [ -f /proc/config.gz ] |
| 46 | then |
| 47 | CONFIG_MMC=$(zcat /proc/config.gz | grep "CONFIG_MMC=") |
| 48 | CONFIG_MMC_SDHCI=$(zcat /proc/config.gz | grep "CONFIG_MMC_SDHCI=") |
| 49 | elif [ -f /boot/config-"$(uname -r)" ] |
| 50 | then |
| 51 | KERNEL_CONFIG_FILE="/boot/config-$(uname -r)" |
| 52 | CONFIG_MMC=$(grep "CONFIG_MMC=" "${KERNEL_CONFIG_FILE}") |
| 53 | CONFIG_MMC_SDHCI=$(grep "CONFIG_MMC_SDHCI=" "${KERNEL_CONFIG_FILE}") |
| 54 | else |
| 55 | exit_on_skip "mmc-pre-requirements" "Kernel config file not available" |
| 56 | fi |
| 57 | |
| 58 | ( [ "${CONFIG_MMC}" = "CONFIG_MMC=y" ] || [ "${CONFIG_MMC}" = "CONFIG_MMC=m" ] ) && ( [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=y" ] || [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=m" ] ) |
| 59 | exit_on_skip "mmc-pre-requirements" "Kernel config CONFIG_MMC=y or CONFIG_MMC=m and CONFIG_MMC_SDHCI=y or CONFIG_MMC_SDHCI=m not enabled" |
| 60 | |
| 61 | list_all_mmc_devices |