Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit c52b5dd

Browse files
committedOct 21, 2024·
PR Testing: check for warnings also in files not directly touched by PR
1 parent cd182e3 commit c52b5dd

File tree

1 file changed

+39
-2
lines changed

1 file changed

+39
-2
lines changed
 

‎pr_testing/test_multiple_prs.sh

+39-2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,37 @@ function get_pr_relval_args() {
4444
echo "${WF_ARGS}"
4545
}
4646

47+
# Function to extract filenames by headername and append to changed-files.txt atomically
48+
function extract_filenames() {
49+
local headername="$1"
50+
local input_file="./etc/dependencies/usedby.out"
51+
local temp_file=$(mktemp) # Create a temporary file for atomic update
52+
53+
# Extract lines starting with headername, split them, and append each filename to the temp file
54+
grep "^$headername" "$input_file" | while read -r line; do
55+
# Split the line into an array
56+
IFS=' ' read -r -a array <<< "$line"
57+
58+
# Loop through each element after the first (which is the headername)
59+
for filename in "${array[@]:1}"; do
60+
echo "$filename" >> "$temp_file"
61+
done
62+
done
63+
64+
# Remove duplicates in temp file and append to changed-files.txt atomically
65+
sort -u "$temp_file" >> changed-files.txt
66+
rm "$temp_file" # Clean up temp file
67+
}
68+
69+
# Function to process each line in $WORKSPACE/changed-files
70+
function process_changed_files() {
71+
# Iterate over each line in $WORKSPACE/changed-files
72+
while IFS= read -r headername; do
73+
# Call the function to extract filenames and append them atomically
74+
extract_filenames "$headername"
75+
done < "$WORKSPACE/changed_files"
76+
}
77+
4778
# Constants
4879
echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH} || true
4980
ls ${LD_LIBRARY_PATH} || true
@@ -824,8 +855,6 @@ if ! $CMSDIST_ONLY ; then # If a CMSSW specific PR was specified #
824855
exit 0
825856
fi
826857

827-
git diff --name-only $CMSSW_VERSION > $WORKSPACE/changed-files
828-
829858
# look for any other error in general
830859
if ! grep "ALL_OK" $GIT_MERGE_RESULT_FILE; then
831860
echo "There was an issue with git-cms-merge-topic you can see the log here: ${PR_RESULT_URL}/git-merge-result" > ${RESULTS_DIR}/10-report.res
@@ -1141,6 +1170,14 @@ GENERAL_ERRORS=`grep "ALL_OK" $WORKSPACE/build.log` || true
11411170

11421171
rm -f $WORKSPACE/deprecated-warnings.log
11431172
get_compilation_warnings $WORKSPACE/build.log > $WORKSPACE/all-warnings.log
1173+
1174+
git diff --name-only $CMSSW_VERSION > $WORKSPACE/changed-files
1175+
pushd ..
1176+
SCRAM_TOOL_HOME=`scram b echo_SCRAM_TOOL_HOME 2>/dev/null | tail -1 | cut -d' ' -f3`
1177+
SCRAM_TOOL_HOME=$SCRAM_TOOL_HOME ./config/SCRAM/findDependencies.py -rel `pwd` -arch ${SCRAM_ARCH}
1178+
process_changed_files
1179+
popd
1180+
11441181
for i in $(get_warnings_files $WORKSPACE/all-warnings.log) ; do
11451182
echo $i > $WORKSPACE/warning.log
11461183
grep ": warning: " $WORKSPACE/all-warnings.log | grep "/$i" >> $WORKSPACE/warning.log

0 commit comments

Comments
 (0)
Please sign in to comment.