@@ -681,6 +681,11 @@ report_tests() {
681681 fi
682682 done
683683 fi
684+ if [ -f " $LOG_DIR /patch-wise.log" ]; then
685+ log_marker " Patchwise Report:"
686+ cat " $LOG_DIR /patch-wise.log" >> " $LOG_FILE "
687+ fi
688+
684689 if [ -z " $FAIL_TEST " ]; then
685690 logs_me " Passed(ALL): $PASS_TEST "
686691 else
@@ -796,7 +801,7 @@ usage() {
796801
797802 printf ' %s\n' \
798803 ' ' \
799- " Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-T tmp_dir_base] [-l logfile] [-C] [-c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
804+ " Usage: $APP_NAME [-d | -V] [-j CPUs] [-B build_target] [-T tmp_dir_base] [-l logfile] [-C] [-P] [- c defconfig_name] [-n N][-1..9]|[-p patch_dir]|[-b base_branch [-t head_branch]] [-S smatch_script] -U -Z" \
800805 ' '
801806
802807 printf ' \t%s\n' \
@@ -808,6 +813,7 @@ usage() {
808813 " -l logfile: report file (defaults to $LOG_FILE )" \
809814 " -L Use llvm to build 'LLVM=1 CC='$ccache clang''" \
810815 " -C: run Complete tests(WARNING: could take significant time!)" \
816+ " -P: run patchwise tests(WARNING: could take significant time!)" \
811817 " -c defconfig: name (default uses current .config + olddefconfig)" \
812818 " -[1..9]: test the tip of current branch (1 to 9 number of patches)" \
813819 " -n N: test the tip of current branch with 'N' number of patches" \
@@ -854,7 +860,7 @@ usage() {
854860
855861ORIDE=0
856862DTB_NOSKIP=0
857- while getopts " S:n:j:c:T:B:l:p:b:t:m:123456789CdDUVZL " opt; do
863+ while getopts " S:n:j:c:T:B:l:p:b:t:m:123456789CdDUVZLP " opt; do
858864 case $opt in
859865 j)
860866 KM_CPUS=$OPTARG
@@ -937,6 +943,14 @@ while getopts "S:n:j:c:T:B:l:p:b:t:m:123456789CdDUVZL" opt; do
937943 exit 1
938944 fi
939945 ;;
946+ P)
947+ PATCHWISE=1
948+ APPS_NEEDED=" $APPS_NEEDED patchwise"
949+ if [ -z " $OPENAI_API_KEY " ]; then
950+ usage " Cannot run patchwise without OPENAI_API_KEY"
951+ exit 1
952+ fi
953+ ;;
940954 [1-9])
941955 TEST_TOP=yes
942956 if [ -n " ${PATCH_DIR}${BASE_BRANCH}${TEST_BRANCH} " ]; then
@@ -1166,6 +1180,27 @@ done
11661180
11671181tests_end
11681182
1183+ if [ " $PATCHWISE " -eq 1 ]; then
1184+ PATCHWISE_ARGS=" "
1185+ if [ " $OPENAI_API_PROVIDER " ]; then
1186+ PATCHWISE_ARGS=" $PATCHWISE_ARGS --provider=$OPENAI_API_PROVIDER "
1187+ fi
1188+ if [ " $OPENAI_API_MODEL " ]; then
1189+ PATCHWISE_ARGS=" $PATCHWISE_ARGS --model=$OPENAI_API_MODEL "
1190+ fi
1191+ PATCHWISE_ARGS=" $PATCHWISE_ARGS --repo-path . --commits=HEAD...HEAD~$PATCHCOUNT "
1192+ echo " Starting Patchwise for $PATCHCOUNT patches.. Please be patient"
1193+ if [ -n " $CURRENT_BRANCH " ]; then
1194+ echo " Restoring to $CURRENT_BRANCH branch"
1195+ git reset --hard 2> /dev/null
1196+ git checkout " $CURRENT_BRANCH " 2> /dev/null
1197+ fi
1198+ if [ -d ' /tmp/patchwise/sandbox/kernel' ]; then
1199+ rm -rf /tmp/patchwise/sandbox/kernel
1200+ fi
1201+ patchwise $PATCHWISE_ARGS --log-file " $LOG_DIR /patch-wise.log"
1202+ fi
1203+
11691204NOW_SEC=$( date " +%s" )
11701205DELTAP=$(( NOW_SEC - STARTP_SEC))
11711206echo
0 commit comments