Skip to content

Commit

Permalink
Merge pull request #1299 from whisperity/daily-execution-script
Browse files Browse the repository at this point in the history
Fix the daily analysis integration template script always saying there are new bugs
  • Loading branch information
dkrupp authored Jan 18, 2018
2 parents bd8f8db + 5f139d3 commit 58caed9
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 10 deletions.
16 changes: 11 additions & 5 deletions docs/script_daily.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,18 @@ DIFF_CMD=$(cat << END \
END
)
WAS_OUTPUT=1
# Assume that there are new bugs introduced, unless proven otherwise.
echo -n "1" > "${WORKSPACE}/was_output.txt"
eval "${DIFF_CMD}" | while read -r line
do
# If CodeChecker says there aren't new bugs, introduce them.
# If CodeChecker says there aren't new bugs, don't introduce them.
if [[ "$line" =~ "- No results" ]]
then
WAS_OUTPUT=0
# This file is needed because the output of "CodeChecker cmd diff"
# may contain lines that are only information for the user, so we can
# not rely on the existence of 'bugs.txt' as only indicator of new bugs.
echo -n "0" > "${WORKSPACE}/was_output.txt"
fi
echo "${line}"
Expand All @@ -82,8 +87,9 @@ then
eval "${DIFF_CMD}"
echo "Bug visualisation HTML files generated at \"${HTML_DIR}\"."
end
fi
WAS_OUTPUT=$(cat "${WORKSPACE}/was_output.txt")
if [ $WAS_OUTPUT -eq 1 ]
then
echo "New bugs introduced!"
Expand All @@ -100,4 +106,4 @@ maintainers.
This can be done via e-mail sending, setting these as attachments, or copying
these files into a persistent (outside the CI job's workspace!) place and
sending its URL to the maintainers.
sending its URL to the maintainers.
16 changes: 11 additions & 5 deletions docs/script_update.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,18 @@ DIFF_CMD=$(cat << END \
END
)
WAS_OUTPUT=1
# Assume that there are new bugs introduced, unless proven otherwise.
echo -n "1" > "${WORKSPACE}/was_output.txt"
eval "${DIFF_CMD}" | while read -r line
do
# If CodeChecker says there aren't new bugs, introduce them.
# If CodeChecker says there aren't new bugs, don't introduce them.
if [[ "$line" =~ "- No results" ]]
then
WAS_OUTPUT=0
# This file is needed because the output of "CodeChecker cmd diff"
# may contain lines that are only information for the user, so we can
# not rely on the existence of 'bugs.txt' as only indicator of new bugs.
echo -n "0" > "${WORKSPACE}/was_output.txt"
fi
echo "${line}"
Expand All @@ -78,8 +83,9 @@ then
eval "${DIFF_CMD}"
echo "Bug visualisation HTML files generated at \"${HTML_DIR}\"."
end
fi
WAS_OUTPUT=$(cat "${WORKSPACE}/was_output.txt")
if [ $WAS_OUTPUT -eq 1 ]
then
echo "New bugs would be introduced -- rejecting pull request!"
Expand All @@ -99,4 +105,4 @@ these files into a persistent (outside the CI job's workspace!) place and
sending its URL to the maintainers.
The return code of this script can be further used in the CI job to set ticket
or pull request status on the code tracker (such as Gerrit or GitLab).
or pull request status on the code tracker (such as Gerrit or GitLab).

0 comments on commit 58caed9

Please sign in to comment.