diff --git a/tests/mooncake-ci-test/install.sh b/tests/mooncake-ci-test/install.sh index 8429cb12264b6b2e5d2c12d5d4f2790bf1905acd..b37c7528ed13d3161ea29b3da135a3ccc7d51d47 100644 --- a/tests/mooncake-ci-test/install.sh +++ b/tests/mooncake-ci-test/install.sh @@ -10,6 +10,7 @@ DEP_PKG_LIST="unzip jq" TEST_GIT_REPO=${TEST_GIT_REPO:-"kvcache-ai/Mooncake"} BRANCH=${BRANCH:-"main"} # LOCAL_MOONCAKE_DIR= +# PR_ID= . $TONE_BM_SUITE_DIR/common.sh @@ -38,6 +39,27 @@ extract_src() if [ "$?" -ne 0 ]; then exit 1 fi + + # Apply PR patch if PR_ID is set + if [ -n "${PR_ID}" ]; then + echo "Applying PR patch for PR #${PR_ID}" + patch_url="https://patch-diff.githubusercontent.com/raw/${TEST_GIT_REPO}/pull/${PR_ID}.patch" + patch_file="${TONE_BM_BUILD_DIR}/pr-${PR_ID}.patch" + + if curl --fail -L -o "${patch_file}" "${patch_url}"; then + cd "${TONE_BM_BUILD_DIR}/Mooncake" + git apply "${patch_file}" + if [ $? -ne 0 ]; then + echo "ERROR: Failed to apply patch from ${patch_url}" + exit 1 + fi + cd - > /dev/null + else + echo "ERROR: Failed to download patch from ${patch_url}" + exit 1 + fi + fi + cp -a ${TONE_BM_BUILD_DIR}/Mooncake/scripts/tone_tests ${mooncake_path} fi