From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Content-Transfer-Encoding: 7bit From: Daniel Sangorrin Date: Tue, 18 Apr 2017 17:41:48 +0900 Message-Id: <1492504910-15293-5-git-send-email-daniel.sangorrin@toshiba.co.jp> In-Reply-To: <1492504910-15293-1-git-send-email-daniel.sangorrin@toshiba.co.jp> References: <1492504910-15293-1-git-send-email-daniel.sangorrin@toshiba.co.jp> Subject: [Fuego] [PATCH 2/2] tests: add Functional.kernel_build test List-Id: Mailing list for the Fuego test framework List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: fuego@lists.linuxfoundation.org Easy to automatize kernel builds for different architectures. There are a few TODOs for corner cases but it works. Next I want to add a deploy option so that we can put the resulting kernel on a tftp folder or give it to lava. Signed-off-by: Daniel Sangorrin --- .../Functional.kernel_build.spec | 18 +++++ .../tests/Functional.kernel_build/kernel_build.sh | 80 ++++++++++++++++++++++ 2 files changed, 98 insertions(+) create mode 100644 engine/tests/Functional.kernel_build/Functional.kernel_build.spec create mode 100755 engine/tests/Functional.kernel_build/kernel_build.sh diff --git a/engine/tests/Functional.kernel_build/Functional.kernel_build.spec b/engine/tests/Functional.kernel_build/Functional.kernel_build.spec new file mode 100644 index 0000000..39914a8 --- /dev/null +++ b/engine/tests/Functional.kernel_build/Functional.kernel_build.spec @@ -0,0 +1,18 @@ +{ + "testName": "Functional.kernel_build", + "specs": + [ + { + "name": "cip-x86", + "repo": "https://github.com/cip-project/linux-cip.git" + }, + { + "name": "cip-arm64", + "repo": "https://github.com/cip-project/linux-cip.git", + "platform": "aarch64", + "arch": "arm64", + "params": "-j8 Image dtbs modules", + "regex_p": "^ OBJCOPY arch/arm64/boot/Image" + } + ] +} diff --git a/engine/tests/Functional.kernel_build/kernel_build.sh b/engine/tests/Functional.kernel_build/kernel_build.sh new file mode 100755 index 0000000..285d5ba --- /dev/null +++ b/engine/tests/Functional.kernel_build/kernel_build.sh @@ -0,0 +1,80 @@ +function test_pre_check { + echo "Doing a pre_check" + # FIXTHIS: if making uImage, check for mkimage +} + +function test_build { + FOLDER="$(basename "$FUNCTIONAL_KERNEL_BUILD_REPO" .git)" + + # Clone if no tarball was defined + if [ -z ${tarball+x} ]; then + assert_define FUNCTIONAL_KERNEL_BUILD_REPO + + # Set branch or tag (default: "master" branch) + if [ -z ${FUNCTIONAL_KERNEL_BUILD_TAG+x} ]; then + if [ -z ${FUNCTIONAL_KERNEL_BUILD_BRANCH+x} ]; then + FUNCTIONAL_KERNEL_BUILD_BRANCH="master" + fi + else + FUNCTIONAL_KERNEL_BUILD_BRANCH=$FUNCTIONAL_KERNEL_BUILD_TAG + fi + + # FIXTHIS: the folder gets removed with the rebuild flag set to true + if [ ! -d "$FOLDER" ]; then + echo "Cloning $FUNCTIONAL_KERNEL_BUILD_REPO:$FUNCTIONAL_KERNEL_BUILD_BRANCH" + git clone --depth 1 "$FUNCTIONAL_KERNEL_BUILD_REPO" \ + --branch $FUNCTIONAL_KERNEL_BUILD_BRANCH + cd "$FOLDER" + else + cd "$FOLDER" + if [ -z ${FUNCTIONAL_KERNEL_BUILD_TAG+x} ]; then + make mrproper + git pull + fi + fi + fi + + # Configuration + if [ -z ${FUNCTIONAL_KERNEL_BUILD_ARCH+x} ]; then + FUNCTIONAL_KERNEL_BUILD_ARCH="x86_64" + fi + + if [ -z ${FUNCTIONAL_KERNEL_BUILD_CONFIG+x} ]; then + FUNCTIONAL_KERNEL_BUILD_CONFIG="defconfig" + fi + echo "Configuring kernel with $FUNCTIONAL_KERNEL_BUILD_CONFIG" + make ARCH=$FUNCTIONAL_KERNEL_BUILD_ARCH $FUNCTIONAL_KERNEL_BUILD_CONFIG + + # Building + echo "Building Kernel" + if [ -z ${FUNCTIONAL_KERNEL_BUILD_PARAMS+x} ]; then + $FUNCTIONAL_KERNEL_BUILD_PARAMS="-j4 bzImage modules" + fi + + if [ ! -z ${FUNCTIONAL_KERNEL_BUILD_PLATFORM+x} ]; then + OLD_PLATFORM=$PLATFORM + PLATFORM=$FUNCTIONAL_KERNEL_BUILD_PLATFORM + source $FUEGO_RO/toolchains/tools.sh + PLATFORM=$OLD_PLATFORM + fi + + make ARCH=$FUNCTIONAL_KERNEL_BUILD_ARCH $FUNCTIONAL_KERNEL_BUILD_PARAMS > build.log 2>&1 || true + + report "cat build.log" +} + +function test_deploy { + echo "Deploying kernel" + # FIXTHIS: copy to tftp folder for lava etc.. +} + +function test_processing { + echo "Processing kernel build log" + if [ -z ${FUNCTIONAL_KERNEL_BUILD_REGEX_P+x} ]; then + log_compare "$TESTDIR" "1" "^Kernel: arch/.* is ready" "p" + else + log_compare "$TESTDIR" "1" "$FUNCTIONAL_KERNEL_BUILD_REGEX_P" "p" + fi +} + +. $FUEGO_CORE/engine/scripts/functional.sh -- 2.7.4