Skip to content
Snippets Groups Projects
Commit 9f5ed99d authored by June.He's avatar June.He Committed by Sean Owen
Browse files

[SPARK-6773][Tests]Fix RAT checks still passed issue when download rat jar failed

check -license will passed in next time when rat jar download failed.

Add 2 step to fix this:
1. Clean the rat.jar if download failed.
2. Add a check logic after run rat checking.

Author: June.He <jun.hejun@huawei.com>

Closes #5421 from sisihj/rat-issue and squashes the following commits:

4958302 [June.He] delete redundant check and add quoted
66f7088 [June.He] Fix RAT checks still passed issue when download rat jar failed
7311e83 [June.He] Fix RAT checks still passed issue when download rat jar failed
parent 18ca089b
No related branches found
No related tags found
No related merge requests found
......@@ -24,29 +24,27 @@ acquire_rat_jar () {
JAR="$rat_jar"
if [[ ! -f "$rat_jar" ]]; then
# Download rat launch jar if it hasn't been downloaded yet
if [ ! -f "$JAR" ]; then
# Download
printf "Attempting to fetch rat\n"
JAR_DL="${JAR}.part"
if [ $(command -v curl) ]; then
curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR"
elif [ $(command -v wget) ]; then
wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR"
else
printf "You do not have curl or wget installed, please install rat manually.\n"
exit -1
fi
fi
unzip -tq $JAR &> /dev/null
if [ $? -ne 0 ]; then
# We failed to download
printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n"
# Download rat launch jar if it hasn't been downloaded yet
if [ ! -f "$JAR" ]; then
# Download
printf "Attempting to fetch rat\n"
JAR_DL="${JAR}.part"
if [ $(command -v curl) ]; then
curl -L --silent "${URL}" > "$JAR_DL" && mv "$JAR_DL" "$JAR"
elif [ $(command -v wget) ]; then
wget --quiet ${URL} -O "$JAR_DL" && mv "$JAR_DL" "$JAR"
else
printf "You do not have curl or wget installed, please install rat manually.\n"
exit -1
fi
printf "Launching rat from ${JAR}\n"
fi
unzip -tq "$JAR" &> /dev/null
if [ $? -ne 0 ]; then
# We failed to download
rm "$JAR"
printf "Our attempt to download rat locally to ${JAR} failed. Please install rat manually.\n"
exit -1
fi
}
......@@ -71,6 +69,11 @@ mkdir -p "$FWDIR"/lib
$java_cmd -jar "$rat_jar" -E "$FWDIR"/.rat-excludes -d "$FWDIR" > rat-results.txt
if [ $? -ne 0 ]; then
echo "RAT exited abnormally"
exit 1
fi
ERRORS="$(cat rat-results.txt | grep -e "??")"
if test ! -z "$ERRORS"; then
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment