wombatu-kun commented on code in PR #19933:
URL: https://github.com/apache/hudi/pull/19933#discussion_r4623663884


##########
scripts/jacoco/merge_jacoco_exec_files.sh:
##########
@@ -18,13 +18,18 @@
 # under the License.
 #
 /bin/bash --version
-shopt -s globstar
+# nullglob drops a directory with no exec files instead of passing its pattern 
to merge.
+shopt -s globstar nullglob
 echo "Jacoco CLI jar: $1"
-echo "Hudi source directory: $2"
+echo "Hudi source directories: ${*:2}"
+exec_files=()
+for dir in "${@:2}"; do
+  exec_files+=($dir/**/jacoco-agent/**/*.exec)
+done
 retry_count=0
 while [[ $retry_count -lt 3 ]]; do
-  ls -l $2/**/jacoco-agent/**/*.exec
-  java -jar $1 merge $2/**/jacoco-agent/**/*.exec --destfile merged-jacoco.exec
+  ls -l "${exec_files[@]}"
+  java -jar $1 merge "${exec_files[@]}" --destfile merged-jacoco.exec

Review Comment:
   With no matching exec files, `nullglob` makes this call succeed with an 
empty `merged-jacoco.exec` instead of reporting the missing inputs. Reject an 
empty `exec_files` array before invoking JaCoCo.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to