From 5566992422ac63feb86b467b2e0285e785a0dee3 Mon Sep 17 00:00:00 2001 From: Michael Zhao Date: Wed, 4 Nov 2020 19:46:39 +0800 Subject: [PATCH] scripts: Fix the failure to fetch latest guest kernel code on AArch64 The integration script failed to obtain the new guest kernel commit when the code folder had been existing on CI machine. Signed-off-by: Michael Zhao --- scripts/run_integration_tests_aarch64.sh | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/run_integration_tests_aarch64.sh b/scripts/run_integration_tests_aarch64.sh index 83fbe53e0..b81462cbd 100755 --- a/scripts/run_integration_tests_aarch64.sh +++ b/scripts/run_integration_tests_aarch64.sh @@ -106,19 +106,25 @@ update_workloads() { } SRCDIR=$PWD - if [ ! -d "$LINUX_CUSTOM_DIR" ]; then - pushd $WORKLOADS_DIR - time git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b "virtio-fs-virtio-iommu-5.8-rc4" $LINUX_CUSTOM_DIR - cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config - popd - else + LINUX_CUSTOM_BRANCH="virtio-fs-virtio-iommu-5.8-rc4" + + # Check whether the local HEAD commit same as the remote HEAD or not. Remove the folder if they are different. + if [ -d "$LINUX_CUSTOM_DIR" ]; then pushd $LINUX_CUSTOM_DIR git fetch - git checkout -f "virtio-fs-virtio-iommu-5.8-rc4" - cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config + LINUX_CUSTOM_LOCAL_HEAD=$(git rev-parse HEAD) + LINUX_CUSTOM_REMOTE_HEAD=$(git rev-parse remotes/origin/$LINUX_CUSTOM_BRANCH) popd + if [ "$LINUX_CUSTOM_LOCAL_HEAD" != "$LINUX_CUSTOM_REMOTE_HEAD" ]; then + rm -rf "$LINUX_CUSTOM_DIR" + fi fi + if [ ! -d "$LINUX_CUSTOM_DIR" ]; then + time git clone --depth 1 "https://github.com/cloud-hypervisor/linux.git" -b $LINUX_CUSTOM_BRANCH $LINUX_CUSTOM_DIR + fi + + cp $SRCDIR/resources/linux-config-aarch64 $LINUX_CUSTOM_DIR/.config build_custom_linux_kernel VIRTIOFSD="$WORKLOADS_DIR/virtiofsd"