diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh
index 9c4d9c9d1..5a999f85a 100644
--- a/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh
+++ b/xCAT-server/share/xcat/tools/jenkins/testreport/email.sh
@@ -201,7 +201,7 @@ function Email_setSubject()
while :
do
- read -n 1
+ read -r -n 1
[[ -z "${REPLY}" || "${REPLY}" =~ [\x00-\x7f\xc0-\xff] ]] &&
(( ${#w} + ${#c} > limit )) &&
declare -g ${mailSubject}+="$(echo -n "${w}" |
@@ -243,7 +243,7 @@ function Email_addAttachment()
# 76 is a magic number, see RFC 2045
- while read -n 76
+ while read -r -n 76
do
inMessage+="${REPLY}"
inMessage+=$'\n'
diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh
index 61ea2ad61..6e3b0b5af 100755
--- a/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh
+++ b/xCAT-server/share/xcat/tools/jenkins/testreport/send-report.sh
@@ -78,7 +78,7 @@ LatestDailyReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, Durati
oIFS="${IFS}"
IFS="|"
color=""
-while read n title arch os duration passed failed no_run subtotal pass_rate n
+while read -r n title arch os duration passed failed no_run subtotal pass_rate n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
echo "
"
@@ -97,7 +97,7 @@ IFS="${oIFS}"
LatestDailyReportSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SEC_TO_TIME(SUM(TIME_TO_SEC(Duration))) AS Duration, SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM LatestDailyReport;")"
oIFS="${IFS}"
IFS="|"
-read n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g')
+read -r n duration passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${LatestDailyReportSummary}" | sed -e '1d' -e 's/ *| */|/g')
echo "
"
echo "Total | "
echo "- | "
@@ -124,7 +124,7 @@ FailedTestCasesReport="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Title, Arch, OS, \`
oIFS="${IFS}"
IFS="|"
color=""
-while read n title arch os failed_test_cases n
+while read -r n title arch os failed_test_cases n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
[ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff"
@@ -153,7 +153,7 @@ SevenDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`,
oIFS="${IFS}"
IFS="|"
color=""
-while read n arch os test_runs passed failed no_run subtotal pass_rate n
+while read -r n arch os test_runs passed failed no_run subtotal pass_rate n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
echo "
"
@@ -172,7 +172,7 @@ IFS="${oIFS}"
SevenDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM SevenDayLookBack;")"
oIFS="${IFS}"
IFS="|"
-read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
+read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${SevenDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
echo "
"
echo "Total | "
echo "- | "
@@ -203,7 +203,7 @@ ThirtyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`
oIFS="${IFS}"
IFS="|"
color=""
-while read n arch os test_runs passed failed no_run subtotal pass_rate n
+while read -r n arch os test_runs passed failed no_run subtotal pass_rate n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
echo "
"
@@ -222,7 +222,7 @@ IFS="${oIFS}"
ThirtyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM ThirtyDayLookBack;")"
oIFS="${IFS}"
IFS="|"
-read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
+read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${ThirtyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
echo "
"
echo "Total | "
echo "- | "
@@ -253,7 +253,7 @@ NinetyDayLookBack="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT Arch, OS, \`Test runs\`
oIFS="${IFS}"
IFS="|"
color=""
-while read n arch os test_runs passed failed no_run subtotal pass_rate n
+while read -r n arch os test_runs passed failed no_run subtotal pass_rate n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
echo "
"
@@ -272,7 +272,7 @@ IFS="${oIFS}"
NinetyDayLookBackSummary="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT SUM(\`Test runs\`), SUM(Passed), SUM(Failed), SUM(\`No run\`), SUM(Subtotal), IFNULL(CONCAT(ROUND(SUM(Passed) / (SUM(Passed) + SUM(Failed)) * 100, 2), '%'), 'N/A') AS \`Pass rate\` FROM NinetyDayLookBack;")"
oIFS="${IFS}"
IFS="|"
-read n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
+read -r n test_runs passed failed no_run total pass_rate n < <(grep -v -- ---- <<<"${NinetyDayLookBackSummary}" | sed -e '1d' -e 's/ *| */|/g')
echo "
"
echo "Total | "
echo "- | "
@@ -302,7 +302,7 @@ Top50FailedTestCases="$("${MYSQL_COMMAND[@]}" -t <<<"SELECT @rank := @rank + 1 A
oIFS="${IFS}"
IFS="|"
color=""
-while read n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n
+while read -r n rank test_case arch os last_seven_days last_thirty_days last_ninety_days n
do
[ "${color}" = "#e0e0e0" ] && color="#a0d0ff" || color="#e0e0e0"
[ "${color}" = "#e0e0e0" ] && color2="#f0f0f0" || color2="#d0e8ff"
diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql
index 215df71fa..0c4ed1243 100644
--- a/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql
+++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xCATjkLogAnalyzer.sql
@@ -338,7 +338,7 @@ SET character_set_client = @saved_cs_client;
/*!50001 SET collation_connection = utf8_general_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
-/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`NinetyDayFailed`.`OSId` desc,`NinetyDayFailed`.`ArchId` desc, `TestCase`.`TestCaseName` */;
+/*!50001 VIEW `FailedTestCasesTopList` AS select `TestCase`.`TestCaseName` AS `Test case`,`ArchDict`.`ArchName` AS `Arch`,`OSDict`.`OSName` AS `OS`,ifnull(`SevenDayFailed`.`Failed`,0) AS `Last seven days`,ifnull(`ThirtyDayFailed`.`Failed`,0) AS `Last thirty days`,`NinetyDayFailed`.`Failed` AS `Last ninety days` from (((((`NinetyDayFailed` left join `SevenDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `SevenDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `SevenDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `SevenDayFailed`.`OSId`)))) left join `ThirtyDayFailed` on(((`NinetyDayFailed`.`TestCaseId` = `ThirtyDayFailed`.`TestCaseId`) and (`NinetyDayFailed`.`ArchId` = `ThirtyDayFailed`.`ArchId`) and (`NinetyDayFailed`.`OSId` = `ThirtyDayFailed`.`OSId`)))) left join `TestCase` on((`NinetyDayFailed`.`TestCaseId` = `TestCase`.`TestCaseId`))) left join `ArchDict` on((`NinetyDayFailed`.`ArchId` = `ArchDict`.`ArchId`))) left join `OSDict` on((`NinetyDayFailed`.`OSId` = `OSDict`.`OSId`))) order by ifnull(`SevenDayFailed`.`Failed`,0) desc,ifnull(`ThirtyDayFailed`.`Failed`,0) desc,`NinetyDayFailed`.`Failed` desc,`OSName`,`ArchName`,`TestCase`.`TestCaseName` */;
/*!50001 SET character_set_client = @saved_cs_client */;
/*!50001 SET character_set_results = @saved_cs_results */;
/*!50001 SET collation_connection = @saved_col_connection */;
diff --git a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh
index 1dc323efa..d3cff55e3 100755
--- a/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh
+++ b/xCAT-server/share/xcat/tools/jenkins/testreport/xcatjk-log2sql.sh
@@ -4,7 +4,7 @@ function usage()
{
local script="${0##*/}"
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
Usage: ${script} [OPTIONS] DIRECTORY
Options:
@@ -194,7 +194,7 @@ function xcattestlog2sql()
[ -n "${test_run_name}" ]
warn_if_bad "$?" "test run has no name" || return 1
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
--
-- Test run has name '${test_run_name}'
--
@@ -204,16 +204,16 @@ function xcattestlog2sql()
[ -f "${logfile}" ]
warn_if_bad "$?" "${logfile}: No such log file" || return 1
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
--
-- Analysis file '${logfile}'
--
EOF
- while read test_case_name test_case_result duration
+ while read -r test_case_name test_case_result duration
do
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
INSERT INTO TestCase (TestCaseId, TestCaseName)
SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp
WHERE NOT EXISTS (
@@ -259,7 +259,7 @@ function xcattestbundle2sql()
[ -n "${test_run_name}" ]
warn_if_bad "$?" "test run has no name" || return 1
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
--
-- Test run has name '${test_run_name}'
--
@@ -269,7 +269,7 @@ function xcattestbundle2sql()
[ -f "${logfile}" ]
warn_if_bad "$?" "${logfile}: No such log file" || return 1
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
--
-- Analysis file '${logfile}'
--
@@ -282,12 +282,12 @@ function xcattestbundle2sql()
EOF
- while read test_case_name
+ while read -r test_case_name
do
# Need chomp ${test_case_name}
test_case_name=$(echo ${test_case_name})
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
INSERT INTO TestCase (TestCaseId, TestCaseName)
SELECT * FROM (SELECT NULL, '${test_case_name}') AS tmp
WHERE NOT EXISTS (
@@ -330,7 +330,7 @@ function jenkinsprojectlog2sql()
[ -f "${logfile}" ]
warn_if_bad "$?" "${logfile}: No such log file" || return 1
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
--
-- Analysis file '${logfile}'
--
@@ -363,7 +363,7 @@ function jenkinsprojectlog2sql()
memo="$(tr -d '\r' <"${logfile}" | grep -A 7 'project.*description' | cut -d ' ' -f 4-)"
- while read ; do echo "${REPLY}" ; done <<-EOF
+ while read -r ; do echo "${REPLY}" ; done <<-EOF
INSERT INTO ArchDict (ArchId, ArchName)
SELECT * FROM (SELECT NULL, '${arch}') AS tmp
WHERE NOT EXISTS (
@@ -428,7 +428,7 @@ JenkinsMailLog="$(echo "${xCATjkLog_DIR}/mail."*)"
[ -f "${JenkinsMailLog}" ]
exit_if_bad "$?" "${JenkinsMailLog}: no such log file"
-while read ; do echo "${REPLY}" ; done <