From aaa41aaa9aa968dc094144ab2cd4ebe923184824 Mon Sep 17 00:00:00 2001 From: Hridya Valsaraju Date: Thu, 8 Feb 2018 11:09:35 -0800 Subject: Move VTS test to verify DTBO to test/vts/host/verifyDTBO Also moving verifyDTBO.sh to libufdt/test since it is a standalone test that can be run independent of VTS. Bug: 67779848 Bug: 72697311 Test: vts-tradefed run vts -m verifyDTBO Change-Id: I4c420404a482f7260796c93e054516bb6ec3b84f --- tests/src/Android.mk | 15 ++++++++++++++ tests/verifyDTBO.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++ tests/vts/Android.mk | 35 --------------------------------- tests/vts/AndroidTest.xml | 24 ----------------------- tests/vts/verifyDTBO.sh | 45 ------------------------------------------ 5 files changed, 65 insertions(+), 104 deletions(-) create mode 100644 tests/verifyDTBO.sh delete mode 100644 tests/vts/Android.mk delete mode 100644 tests/vts/AndroidTest.xml delete mode 100644 tests/vts/verifyDTBO.sh (limited to 'tests') diff --git a/tests/src/Android.mk b/tests/src/Android.mk index 27ba52c..9ede790 100644 --- a/tests/src/Android.mk +++ b/tests/src/Android.mk @@ -122,3 +122,18 @@ LOCAL_REQUIRED_MODULES := dtc include $(BUILD_HOST_EXECUTABLE) ################################################### +include $(CLEAR_VARS) + +LOCAL_MODULE := ufdt_verify_overlay +LOCAL_CFLAGS := $(libufdt_tests_cflags) +LOCAL_SRC_FILES := ufdt_verify_overlay_app.cpp +LOCAL_STATIC_LIBRARIES := \ + libufdt \ + libfdt \ + libufdt_sysdeps \ + libufdt_verify +LOCAL_REQUIRED_MODULES := dtc + +include $(BUILD_NATIVE_TEST) + +################################################### diff --git a/tests/verifyDTBO.sh b/tests/verifyDTBO.sh new file mode 100644 index 0000000..231101e --- /dev/null +++ b/tests/verifyDTBO.sh @@ -0,0 +1,50 @@ +#!/bin/bash + +if [ -z "${ANDROID_HOST_OUT}" ]; then + echo 'ANDROID_HOST_OUT not set. Please run lunch' + exit 1 +fi + +ANDROID_HOST_BIN_LOCATION=${ANDROID_HOST_OUT}/bin + +adb root + +tmpdir=$(mktemp -d) +trap 'rm -rf ${tmpdir};' EXIT + +cd $tmpdir + +#find out the location to read the DTBO image from +boot_suffix=$(adb wait-for-device shell getprop ro.boot.slot_suffix) +dtbo_partition="/dev/block/bootdevice/by-name/dtbo" +dtbo_path=$dtbo_partition$boot_suffix + +#read the dtbo image and the final device tree from device +adb pull $dtbo_path dtbo.img > /dev/null +adb pull /sys/firmware/fdt final_dt > /dev/null + +#decompile the DTBO image +mkdtimg_path="${ANDROID_HOST_BIN_LOCATION}/mkdtimg" +$mkdtimg_path dump dtbo.img -b dumped_dtbo > /dev/null + +#Get the index of the overlay applied from the kernel command line +overlay_idx=$(adb shell cat /proc/cmdline | grep -o "androidboot.dtbo_idx=[^ ]*" | cut -d "=" -f 2) +arg="" +for idx in ${overlay_idx//,/ } +do + arg="${arg}dumped_dtbo.${idx} " +done + +#verify that the overlay was correctly applied +verify_bin_path="${ANDROID_HOST_BIN_LOCATION}/ufdt_verify_overlay_host" +$verify_bin_path final_dt $arg +result=$? + +if [[ "$result" -eq "0" ]]; then + echo "Overlay was verified successfully" +else + echo "Incorrect overlay application" +fi + +exit $result + diff --git a/tests/vts/Android.mk b/tests/vts/Android.mk deleted file mode 100644 index 99681b5..0000000 --- a/tests/vts/Android.mk +++ /dev/null @@ -1,35 +0,0 @@ -# -# Copyright (C) 2018 The Android Open Source Project -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) - -LOCAL_MODULE := verifyDTBO.sh -LOCAL_SRC_FILES := verifyDTBO.sh -LOCAL_MODULE_CLASS := EXECUTABLES -LOCAL_MODULE_TAGS := optional -LOCAL_IS_HOST_MODULE := true -LOCAL_REQUIRED_MODULES := \ - mkdtimg \ - ufdt_verify_overlay_host \ - -include $(BUILD_PREBUILT) - -include $(CLEAR_VARS) - -LOCAL_MODULE := VtsVerifyDTBOTest -VTS_CONFIG_SRC_DIR := system/tools/libufdt/test/vts --include test/vts/tools/build/Android.host_config.mk diff --git a/tests/vts/AndroidTest.xml b/tests/vts/AndroidTest.xml deleted file mode 100644 index 6add7c5..0000000 --- a/tests/vts/AndroidTest.xml +++ /dev/null @@ -1,24 +0,0 @@ - - - - - - - diff --git a/tests/vts/verifyDTBO.sh b/tests/vts/verifyDTBO.sh deleted file mode 100644 index e28ac5f..0000000 --- a/tests/vts/verifyDTBO.sh +++ /dev/null @@ -1,45 +0,0 @@ -#!/bin/bash - -if [ -z "${ANDROID_HOST_OUT}" ]; then - echo 'ANDROID_HOST_OUT not set. Please run lunch' - exit 1 -fi - -ANDROID_VTS_HOST_BIN_LOCATION=${ANDROID_HOST_OUT}/vts/android-vts/testcases/host/bin - -adb root - -tmpdir=$(mktemp -d) -trap 'rm -rf ${tmpdir};' EXIT - -cd $tmpdir - -#find out the location to read the DTBO image from -boot_suffix=$(adb wait-for-device shell getprop ro.boot.slot_suffix) -dtbo_partition="/dev/block/bootdevice/by-name/dtbo" -dtbo_path=$dtbo_partition$boot_suffix - -#read the dtbo image and the final device tree from device -adb pull $dtbo_path dtbo.img > /dev/null -adb pull /sys/firmware/fdt final_dt > /dev/null - -#decompile the DTBO image -mkdtimg_path="${ANDROID_VTS_HOST_BIN_LOCATION}/mkdtimg" -$mkdtimg_path dump dtbo.img -b dumped_dtbo > /dev/null - -#Get the index of the overlay applied from the kernel command line -overlay_idx=$(adb shell cat /proc/cmdline | grep -o "androidboot.dtbo_idx=\w*" | cut -d "=" -f 2) - -#verify that the overlay was correctly applied -verify_bin_path="${ANDROID_VTS_HOST_BIN_LOCATION}/ufdt_verify_overlay_host" -$verify_bin_path final_dt dumped_dtbo.$overlay_idx -result=$? - -if [[ "$result" -eq "0" ]]; then - echo "Overlay was verified successfully" -else - echo "Incorrect overlay application" -fi - -exit $result - -- cgit v1.2.3