aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMilosz Wasilewski <milosz.wasilewski@linaro.org>2020-03-02 18:53:29 +0000
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2020-03-02 20:33:54 +0000
commit60152068147bb90df21b9f9314dc318d718fe517 (patch)
tree283e19b4288c3d4a6d052e548236928410e6a403
parenta85631aa4ab6eda07cb306b0c86c5bc58ec77d5c (diff)
fixed sanity-check warnings
Signed-off-by: Milosz Wasilewski <milosz.wasilewski@linaro.org>
-rwxr-xr-xautomated/android/apk-automation/andebenchpro2015.py4
-rwxr-xr-xautomated/android/apk-automation/cf-bench.py2
-rwxr-xr-xautomated/android/apk-automation/geekbench3.py4
-rwxr-xr-xautomated/android/apk-automation/geekbench4.py18
-rwxr-xr-xautomated/android/apk-automation/jbench.py2
-rwxr-xr-xautomated/android/bootstat/device-script.sh14
-rwxr-xr-xautomated/android/boottime/device-script.sh18
-rwxr-xr-xautomated/android/noninteractive-tradefed/tradefed-runner.py18
-rw-r--r--automated/android/tradefed/result_parser.py8
-rwxr-xr-xautomated/android/workload-automation/workload-automation.sh2
-rwxr-xr-xautomated/android/workload-automation3/workload-automation.sh2
-rw-r--r--automated/linux/aep-pre-post/postprocess_lisa_results.py1
-rwxr-xr-xautomated/linux/badblocks/badblocks.sh2
-rwxr-xr-xautomated/linux/dd-wr-speed/dd-wr-speed.sh2
-rwxr-xr-xautomated/linux/device-read-perf/device-read-perf.sh4
-rwxr-xr-xautomated/linux/dsdbench/dsdbench.sh2
-rwxr-xr-xautomated/linux/gst-validate/gst_validate_lava_parse.py2
-rwxr-xr-xautomated/linux/iperf/iperf.sh4
-rwxr-xr-xautomated/linux/kernel-compilation/kernel-compilation.sh2
-rwxr-xr-xautomated/linux/kvm/start-kvm.sh67
-rwxr-xr-xautomated/linux/kvm/wait-ip.py3
-rwxr-xr-xautomated/linux/kvm/wait-kvm.sh1
-rwxr-xr-xautomated/linux/lapack/lapack.sh8
-rwxr-xr-xautomated/linux/linpack/linpack.sh2
-rwxr-xr-xautomated/linux/ltp-open-posix/ltp-open-posix.sh1
-rwxr-xr-xautomated/linux/ltp-realtime/ltp-realtime.py131
-rwxr-xr-xautomated/linux/ltp-realtime/ltp-realtime.sh1
-rwxr-xr-xautomated/linux/mmc/mmc-test.sh2
-rw-r--r--automated/linux/nginx-server/linux-ip.sh2
-rw-r--r--automated/linux/nginx-server/odp-dpdk-git.sh2
-rw-r--r--automated/linux/nginx-server/odp-dpdk.sh2
-rwxr-xr-xautomated/linux/openjdk/openjdk-smoke.sh2
-rwxr-xr-xautomated/linux/openssh/openssh-debian.sh2
-rw-r--r--automated/linux/ota-update/ota-update.py1
-rwxr-xr-xautomated/linux/ptest/ptest.py12
-rwxr-xr-xautomated/linux/ui-browser-test/install.sh4
-rwxr-xr-xautomated/linux/unixbench/unixbench.sh4
-rwxr-xr-xautomated/linux/wlan-download/wlan-download-test.sh10
-rwxr-xr-xautomated/linux/workload-automation3/workload-automation.sh2
-rwxr-xr-xautomated/utils/httperf/httperf-runner.py18
-rwxr-xr-xautomated/utils/post-to-squad.py1
-rwxr-xr-xautomated/utils/send-to-lava.sh6
-rwxr-xr-xmanual/generic/linux/openssh-centos.sh2
-rw-r--r--plans/testplan2html.py1
44 files changed, 225 insertions, 173 deletions
diff --git a/automated/android/apk-automation/andebenchpro2015.py b/automated/android/apk-automation/andebenchpro2015.py
index 05c2b54..909f279 100755
--- a/automated/android/apk-automation/andebenchpro2015.py
+++ b/automated/android/apk-automation/andebenchpro2015.py
@@ -35,8 +35,8 @@ class ApkRunnerImpl(ApkTestRunner):
"Overall Score",
"Verify"]
- pat_score = re.compile("^(?P<measurement>[\d\.]+)$")
- pat_score_unit_str = "^(?P<measurement>[\d\.]+)(?P<units>[^\d\.]+)$"
+ pat_score = re.compile(r"^(?P<measurement>[\d\.]+)$")
+ pat_score_unit_str = r"^(?P<measurement>[\d\.]+)(?P<units>[^\d\.]+)$"
pat_score_unit = re.compile(pat_score_unit_str)
with open(local_result_csv, 'r') as f:
diff --git a/automated/android/apk-automation/cf-bench.py b/automated/android/apk-automation/cf-bench.py
index 44014ff..c777157 100755
--- a/automated/android/apk-automation/cf-bench.py
+++ b/automated/android/apk-automation/cf-bench.py
@@ -63,7 +63,7 @@ class ApkRunnerImpl(ApkTestRunner):
found_score_view = True
score_uid = score_view.getUniqueId()
- uid = int(re.search("id/no_id/(?P<uid>\d+)", score_uid).group('uid'))
+ uid = int(re.search(r"id/no_id/(?P<uid>\d+)", score_uid).group('uid'))
score = self.vc.findViewByIdOrRaise("id/no_id/%s" % (uid + offset))
score_text = score.getText()
if score_text.find("%") > 0:
diff --git a/automated/android/apk-automation/geekbench3.py b/automated/android/apk-automation/geekbench3.py
index ce99533..bcfb188 100755
--- a/automated/android/apk-automation/geekbench3.py
+++ b/automated/android/apk-automation/geekbench3.py
@@ -45,8 +45,8 @@ class ApkRunnerImpl(ApkTestRunner):
self.logger.info("Geekbench 3 Test is still in progress...")
else:
self.logger.error("Something goes wrong! It is unusual that the test has not been started after 10+ seconds! Please manually check it!")
- #self.all_fail()
- #sys.exit(1)
+ # self.all_fail()
+ # sys.exit(1)
# Generate the .gb3 file
self.device.press('KEYCODE_MENU')
diff --git a/automated/android/apk-automation/geekbench4.py b/automated/android/apk-automation/geekbench4.py
index 2e4434d..829bd1c 100755
--- a/automated/android/apk-automation/geekbench4.py
+++ b/automated/android/apk-automation/geekbench4.py
@@ -7,13 +7,13 @@ import time
from common import ApkTestRunner
from com.dtmilano.android.viewclient import ViewNotFoundException
-## geekbench-3-4-3-0.apk
-## Version is 4.3.0
-## size: 100459959
-## md5sum: c0013d79b8518edcdbcf7a2019d2e0ca
-## Url:
-## https://geekbench-3.en.uptodown.com/android
-## https://play.google.com/store/apps/details?id=com.primatelabs.geekbench
+# geekbench-3-4-3-0.apk
+# Version is 4.3.0
+# size: 100459959
+# md5sum: c0013d79b8518edcdbcf7a2019d2e0ca
+# Url:
+# https://geekbench-3.en.uptodown.com/android
+# https://play.google.com/store/apps/details?id=com.primatelabs.geekbench
class ApkRunnerImpl(ApkTestRunner):
@@ -69,8 +69,8 @@ class ApkRunnerImpl(ApkTestRunner):
continue
self.logger.error("Something goes wrong! It is unusual that the test has not been started after 10+ seconds! Please manually check it!")
- #self.all_fail()
- #sys.exit(1)
+ # self.all_fail()
+ # sys.exit(1)
def parseResult(self):
raw_output_file = '%s/geekbench3-result-itr%s.json' % (self.config['output'], self.config['itr'])
diff --git a/automated/android/apk-automation/jbench.py b/automated/android/apk-automation/jbench.py
index 0481081..5ba24c5 100755
--- a/automated/android/apk-automation/jbench.py
+++ b/automated/android/apk-automation/jbench.py
@@ -24,7 +24,7 @@ class ApkRunnerImpl(ApkTestRunner):
time.sleep(5)
self.dump_always()
results = self.vc.findViewByIdOrRaise("it.JBench.bench:id/textViewResult")
- if re.search('^\d+$', results.getText()):
+ if re.search(r'^\d+$', results.getText()):
finished = True
print("benchmark finished")
print("%s=%s" % ("JBench", results.getText().strip()))
diff --git a/automated/android/bootstat/device-script.sh b/automated/android/bootstat/device-script.sh
index a72ea44..cde4851 100755
--- a/automated/android/bootstat/device-script.sh
+++ b/automated/android/bootstat/device-script.sh
@@ -32,18 +32,24 @@ local_file_parent=$(cd "${local_file_parent}"||exit; pwd)
DATA_TMP="/data/local/tmp"
collect_data(){
+ # shellcheck disable=SC2039
local bootstat_cmd="/system/bin/bootstat"
+ # shellcheck disable=SC2039
local bootstat_res="${DATA_TMP}/bootstat.result"
if [ -x "${bootstat_cmd}" ]; then
- ${bootstat_cmd} -p | grep -v "Boot events" | grep -v '\--------'> "${bootstat_res}"
- if [ $? -ne 0 ]; then
+ if ! ${bootstat_cmd} -p | grep -v "Boot events" | grep -v '\--------'> "${bootstat_res}"
+ then
output_test_result "bootstat" "fail"
exit 1
else
output_test_result "bootstat" "pass"
while read -r line; do
- local test_case=$(echo "${line}" | awk '{print $1}')
- local measurement=$(echo "${line}" | awk '{print $2}')
+ # shellcheck disable=SC2039
+ local test_case
+ test_case=$(echo "${line}" | awk '{print $1}')
+ # shellcheck disable=SC2039
+ local measurement
+ measurement=$(echo "${line}" | awk '{print $2}')
if [ "X${test_case}" = "Xboot_reason" ]; then
output_test_result "bootstat_${test_case}" "pass" "${measurement}" "number"
elif echo "${test_case}" | grep -q "ro.boottime.init"; then
diff --git a/automated/android/boottime/device-script.sh b/automated/android/boottime/device-script.sh
index 00c7be9..958d26f 100755
--- a/automated/android/boottime/device-script.sh
+++ b/automated/android/boottime/device-script.sh
@@ -304,35 +304,35 @@ getBootTimeInfoFromDmesg(){
# here we presume kernel message starts from 0
CONSOLE_SECONDS_START=0
CONSOLE_SECONDS_END=$(getTime "Freeing unused kernel memory")
- if [ ! -z "${CONSOLE_SECONDS_END}" ] && [ ! -z "${CONSOLE_SECONDS_START}" ]; then
+ if [ -n "${CONSOLE_SECONDS_END}" ] && [ -n "${CONSOLE_SECONDS_START}" ]; then
KERNEL_BOOT_TIME=$(echo "${CONSOLE_SECONDS_END} ${CONSOLE_SECONDS_START} - p" | dc)
output_test_result "KERNEL_BOOT_TIME" "pass" "${KERNEL_BOOT_TIME}" "s"
fi
POINT_FS_MOUNT_START=$(getTime "Freeing unused kernel memory:"|tail -n1)
POINT_FS_MOUNT_END=$(getTime "init: Starting service 'logd'...")
- if [ ! -z "${POINT_FS_MOUNT_END}" ] && [ ! -z "${POINT_FS_MOUNT_START}" ]; then
+ if [ -n "${POINT_FS_MOUNT_END}" ] && [ -n "${POINT_FS_MOUNT_START}" ]; then
FS_MOUNT_TIME=$(echo "${POINT_FS_MOUNT_END} ${POINT_FS_MOUNT_START} - p" | dc)
output_test_result "FS_MOUNT_TIME" "pass" "${FS_MOUNT_TIME}" "s"
fi
POINT_FS_DURATION_START=$(getTime "init: /dev/hw_random not found"|tail -n1)
POINT_FS_DURATION_END=$(getTime "init: Starting service 'logd'...")
- if [ ! -z "${POINT_FS_DURATION_END}" ] && [ ! -z "${POINT_FS_DURATION_START}" ]; then
+ if [ -n "${POINT_FS_DURATION_END}" ] && [ -n "${POINT_FS_DURATION_START}" ]; then
FS_MOUNT_DURATION=$(echo "${POINT_FS_DURATION_END} ${POINT_FS_DURATION_START} - p" | dc)
output_test_result "FS_MOUNT_DURATION" "pass" "${FS_MOUNT_DURATION}" "s"
fi
POINT_SERVICE_BOOTANIM_START=$(getTime "init: Starting service 'bootanim'..."|tail -n1)
POINT_SERVICE_BOOTANIM_END=$(getTime "init: Service 'bootanim'.* exited with status"|tail -n1)
- if [ ! -z "${POINT_SERVICE_BOOTANIM_END}" ] && [ ! -z "${POINT_SERVICE_BOOTANIM_START}" ]; then
+ if [ -n "${POINT_SERVICE_BOOTANIM_END}" ] && [ -n "${POINT_SERVICE_BOOTANIM_START}" ]; then
BOOTANIM_TIME=$(echo "${POINT_SERVICE_BOOTANIM_END} ${POINT_SERVICE_BOOTANIM_START} - p" | dc)
output_test_result "BOOTANIM_TIME" "pass" "${BOOTANIM_TIME}" "s"
fi
POINT_INIT_START=$(getTime "Freeing unused kernel memory")
POINT_SERVICE_SURFACEFLINGER_START=$(getTime "init: Starting service 'surfaceflinger'..."|tail -n1)
- if [ ! -z "${POINT_SERVICE_SURFACEFLINGER_START}" ] && [ ! -z "${POINT_INIT_START}" ]; then
+ if [ -n "${POINT_SERVICE_SURFACEFLINGER_START}" ] && [ -n "${POINT_INIT_START}" ]; then
INIT_TO_SURFACEFLINGER_START_TIME=$(echo "${POINT_SERVICE_SURFACEFLINGER_START} ${POINT_INIT_START} - p" | dc)
output_test_result "INIT_TO_SURFACEFLINGER_START_TIME" "pass" "${INIT_TO_SURFACEFLINGER_START_TIME}" "s"
fi
@@ -353,7 +353,7 @@ getBootTimeInfoFromDmesg(){
SURFACEFLINGER_BOOT_TIME=$(echo "${SURFACEFLINGER_BOOT_TIME_MS}" | awk '{printf "%.3f",$1/1000;}')
output_test_result "SURFACEFLINGER_BOOT_TIME" "pass" "${SURFACEFLINGER_BOOT_TIME}" "s"
- if [ ! -z "${POINT_SURFACEFLINGER_BOOT}" ] && [ ! -z "${POINT_LAUNCHER_DISPLAYED}" ] && [ ! -z "${INIT_TO_SURFACEFLINGER_START_TIME}" ]; then
+ if [ -n "${POINT_SURFACEFLINGER_BOOT}" ] && [ -n "${POINT_LAUNCHER_DISPLAYED}" ] && [ -n "${INIT_TO_SURFACEFLINGER_START_TIME}" ]; then
min=$(echo "${POINT_LAUNCHER_DISPLAYED} ${POINT_SURFACEFLINGER_BOOT}" | awk '{if ($1 < $2) printf $1; else print $2}')
@@ -373,19 +373,19 @@ getBootTimeInfoFromDmesg(){
fi
- if [ ! -z "${INIT_TO_SURFACEFLINGER_START_TIME}" ] && [ ! -z "${SURFACEFLINGER_BOOT_TIME}" ] ; then
+ if [ -n "${INIT_TO_SURFACEFLINGER_START_TIME}" ] && [ -n "${SURFACEFLINGER_BOOT_TIME}" ] ; then
ANDROID_BOOT_TIME=$(echo "${INIT_TO_SURFACEFLINGER_START_TIME} ${SURFACEFLINGER_BOOT_TIME}" | awk '{printf "%.3f",$1 + $2;}')
output_test_result "ANDROID_BOOT_TIME" "pass" "${ANDROID_BOOT_TIME}" "s"
fi
SERVICE_START_TIME_INFO=$(grep "healthd:" "${LOG_DMESG}"|head -n 1)
SERVICE_START_TIME_END=$(echo "${SERVICE_START_TIME_INFO}"|cut -d] -f 1|cut -d[ -f2| tr -d " ")
- if [ ! -z "${SERVICE_START_TIME_END}" ] && [ ! -z "${CONSOLE_SECONDS_START}" ]; then
+ if [ -n "${SERVICE_START_TIME_END}" ] && [ -n "${CONSOLE_SECONDS_START}" ]; then
SERVICE_START_TIME=$(echo "${SERVICE_START_TIME_END} ${CONSOLE_SECONDS_START} - p" | dc)
output_test_result "ANDROID_SERVICE_START_TIME" "pass" "${SERVICE_START_TIME}" "s"
fi
- if [ ! -z "${KERNEL_BOOT_TIME}" ] && [ ! -z "${ANDROID_BOOT_TIME}" ] ; then
+ if [ -n "${KERNEL_BOOT_TIME}" ] && [ -n "${ANDROID_BOOT_TIME}" ] ; then
TOTAL_SECONDS=$(echo "${KERNEL_BOOT_TIME} ${ANDROID_BOOT_TIME}" | awk '{printf "%.3f",$1 + $2;}')
output_test_result "TOTAL_BOOT_TIME" "pass" "${TOTAL_SECONDS}" "s"
fi
diff --git a/automated/android/noninteractive-tradefed/tradefed-runner.py b/automated/android/noninteractive-tradefed/tradefed-runner.py
index 6808256..7a3aac8 100755
--- a/automated/android/noninteractive-tradefed/tradefed-runner.py
+++ b/automated/android/noninteractive-tradefed/tradefed-runner.py
@@ -43,10 +43,10 @@ def result_parser(xml_file, result_format):
else:
num = int(m.group(2), 16)
# #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
- if not(num in (0x9, 0xA, 0xD) or
- 0x20 <= num <= 0xD7FF or
- 0xE000 <= num <= 0xFFFD or
- 0x10000 <= num <= 0x10FFFF):
+ if not(num in (0x9, 0xA, 0xD)
+ or 0x20 <= num <= 0xD7FF
+ or 0xE000 <= num <= 0xFFFD
+ or 0x10000 <= num <= 0x10FFFF):
etree_content = etree_content[:mstart] + etree_content[mend:]
endpos = len(etree_content)
pos = mend
@@ -115,10 +115,10 @@ def result_parser(xml_file, result_format):
'failed, the output for the rest '
'failed test cases will be '
'skipped.' % (args.FAILURES_PRINTED))
- #break the for loop of failed_tests
+ # break the for loop of failed_tests
break
if failures_count > args.FAILURES_PRINTED:
- #break the for loop of test_cases
+ # break the for loop of test_cases
break
if result_format == ATOMIC:
@@ -146,9 +146,9 @@ parser.add_argument('-r', dest='RESULTS_FORMAT', required=False,
passed and failed tests are recorded for each module. 'atomic' means \
each test result is recorded separately")
-## The total number of failed test cases to be printed for this job
-## Print too much failures would cause the lava job timed out
-## Default to not print any failures
+# The total number of failed test cases to be printed for this job
+# Print too much failures would cause the lava job timed out
+# Default to not print any failures
parser.add_argument('-f', dest='FAILURES_PRINTED', type=int,
required=False, default=0,
help="Speciy the number of failed test cases to be\
diff --git a/automated/android/tradefed/result_parser.py b/automated/android/tradefed/result_parser.py
index 96686ed..3dd90a9 100644
--- a/automated/android/tradefed/result_parser.py
+++ b/automated/android/tradefed/result_parser.py
@@ -50,10 +50,10 @@ class TradefedResultParser:
num = int(m.group(2), 16)
# #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF]
if not (
- num in (0x9, 0xA, 0xD) or
- 0x20 <= num <= 0xD7FF or
- 0xE000 <= num <= 0xFFFD or
- 0x10000 <= num <= 0x10FFFF
+ num in (0x9, 0xA, 0xD)
+ or 0x20 <= num <= 0xD7FF
+ or 0xE000 <= num <= 0xFFFD
+ or 0x10000 <= num <= 0x10FFFF
):
etree_content = etree_content[:mstart] + etree_content[mend:]
endpos = len(etree_content)
diff --git a/automated/android/workload-automation/workload-automation.sh b/automated/android/workload-automation/workload-automation.sh
index f95b9b0..6e5fad0 100755
--- a/automated/android/workload-automation/workload-automation.sh
+++ b/automated/android/workload-automation/workload-automation.sh
@@ -48,7 +48,7 @@ done
. "${TEST_DIR}/../../lib/android-test-lib"
cd "${TEST_DIR}"
-if [ ! -z "${NEW_OUTPUT}" ]; then
+if [ -n "${NEW_OUTPUT}" ]; then
OUTPUT="${NEW_OUTPUT}"
fi
create_out_dir "${OUTPUT}"
diff --git a/automated/android/workload-automation3/workload-automation.sh b/automated/android/workload-automation3/workload-automation.sh
index 651a125..79fde8b 100755
--- a/automated/android/workload-automation3/workload-automation.sh
+++ b/automated/android/workload-automation3/workload-automation.sh
@@ -48,7 +48,7 @@ done
. "${TEST_DIR}/../../lib/android-test-lib"
cd "${TEST_DIR}"
-if [ ! -z "${NEW_OUTPUT}" ]; then
+if [ -n "${NEW_OUTPUT}" ]; then
OUTPUT="${NEW_OUTPUT}"
fi
create_out_dir "${OUTPUT}"
diff --git a/automated/linux/aep-pre-post/postprocess_lisa_results.py b/automated/linux/aep-pre-post/postprocess_lisa_results.py
index a313c5c..7cfb58b 100644
--- a/automated/linux/aep-pre-post/postprocess_lisa_results.py
+++ b/automated/linux/aep-pre-post/postprocess_lisa_results.py
@@ -46,5 +46,6 @@ def main():
# value is measurement to be recorded
results.write("%s pass %s _\r\n" % (key, value))
+
if __name__ == "__main__":
main()
diff --git a/automated/linux/badblocks/badblocks.sh b/automated/linux/badblocks/badblocks.sh
index 0698df1..7c48a2b 100755
--- a/automated/linux/badblocks/badblocks.sh
+++ b/automated/linux/badblocks/badblocks.sh
@@ -41,7 +41,7 @@ install
command -v badblocks
exit_on_fail "badblocks-existence-check"
-if [ ! -z "${BLOCK_DEVICE}" ] && [ -e "${BLOCK_DEVICE}" ]; then
+if [ -n "${BLOCK_DEVICE}" ] && [ -e "${BLOCK_DEVICE}" ]; then
info_msg "Running ${TEST_SUITE} test on ${BLOCK_DEVICE}"
LOG_FILE="${OUTPUT}/${TEST_SUITE}-output.txt"
test_cmd="badblocks -v ${BADBLOCKS_PARAMS} ${BLOCK_DEVICE} 2>&1"
diff --git a/automated/linux/dd-wr-speed/dd-wr-speed.sh b/automated/linux/dd-wr-speed/dd-wr-speed.sh
index 4995f1e..7919f92 100755
--- a/automated/linux/dd-wr-speed/dd-wr-speed.sh
+++ b/automated/linux/dd-wr-speed/dd-wr-speed.sh
@@ -102,7 +102,7 @@ parse_output() {
itr=1
while read -r line; do
- if echo "${line}" | egrep -q "(M|G)B/s"; then
+ if echo "${line}" | grep -q -E "(M|G)B/s"; then
measurement="$(echo "${line}" | awk '{print $(NF-1)}')"
units="$(echo "${line}" | awk '{print substr($NF,1,2)}')"
result=$(convert_to_mb "${measurement}" "${units}")
diff --git a/automated/linux/device-read-perf/device-read-perf.sh b/automated/linux/device-read-perf/device-read-perf.sh
index 17b072f..3b9cb4b 100755
--- a/automated/linux/device-read-perf/device-read-perf.sh
+++ b/automated/linux/device-read-perf/device-read-perf.sh
@@ -25,9 +25,9 @@ install_deps "hdparm" "${SKIP_INSTALL}"
# Test all block devices if device not specified.
if [ -z "${device_list}" ]; then
- if lsblk | egrep "^(sd|hd|mmcblk)[a-z0-9] "; then
+ if lsblk | grep -E "^(sd|hd|mmcblk)[a-z0-9] "; then
device_list=$(lsblk \
- | egrep "^(sd|hd|mmcblk)[a-z0-9] " \
+ | grep -E "^(sd|hd|mmcblk)[a-z0-9] " \
| awk '{print $1}')
else
error_msg "Block device NOT found"
diff --git a/automated/linux/dsdbench/dsdbench.sh b/automated/linux/dsdbench/dsdbench.sh
index f002db6..da5eee5 100755
--- a/automated/linux/dsdbench/dsdbench.sh
+++ b/automated/linux/dsdbench/dsdbench.sh
@@ -56,7 +56,7 @@ if [ "${TEST_SUITE}" = "BENCHMARKS" ]; then
| tee "${LOG_FILE}"
# Parse log file.
- egrep "^Benchmark.*op$" "${LOG_FILE}" \
+ grep -E "^Benchmark.*op$" "${LOG_FILE}" \
| awk '{printf("%s pass %s %s\n", $1,$3,$4)}' \
| tee -a "${RESULT_FILE}"
elif [ "${TEST_SUITE}" = "TESTS" ]; then
diff --git a/automated/linux/gst-validate/gst_validate_lava_parse.py b/automated/linux/gst-validate/gst_validate_lava_parse.py
index 8845fe6..70b93c9 100755
--- a/automated/linux/gst-validate/gst_validate_lava_parse.py
+++ b/automated/linux/gst-validate/gst_validate_lava_parse.py
@@ -50,7 +50,7 @@ if __name__ == '__main__':
with open(sys.argv[2], 'r') as f:
ignore_tests = f.read().split()
- rex = re.compile('^(?P<test_case_id>validate\..*):\s+(?P<result>(Failed|Passed|Skipped|Timeout))')
+ rex = re.compile(r'^(?P<test_case_id>validate\..*):\s+(?P<result>(Failed|Passed|Skipped|Timeout))')
with open(sys.argv[1], 'r') as f:
for line in f.readlines():
s = rex.search(line)
diff --git a/automated/linux/iperf/iperf.sh b/automated/linux/iperf/iperf.sh
index 80ca89a..f896925 100755
--- a/automated/linux/iperf/iperf.sh
+++ b/automated/linux/iperf/iperf.sh
@@ -65,11 +65,11 @@ stdbuf -o0 iperf3 -c "${SERVER}" -t "${TIME}" -P "${THREADS}" 2>&1 \
# Parse logfile.
if [ "${THREADS}" -eq 1 ]; then
- egrep "(sender|receiver)" "${LOGFILE}" \
+ grep -E "(sender|receiver)" "${LOGFILE}" \
| awk '{printf("iperf-%s pass %s %s\n", $NF,$7,$8)}' \
| tee -a "${RESULT_FILE}"
elif [ "${THREADS}" -gt 1 ]; then
- egrep "[SUM].*(sender|receiver)" "${LOGFILE}" \
+ grep -E "[SUM].*(sender|receiver)" "${LOGFILE}" \
| awk '{printf("iperf-%s pass %s %s\n", $NF,$6,$7)}' \
| tee -a "${RESULT_FILE}"
fi
diff --git a/automated/linux/kernel-compilation/kernel-compilation.sh b/automated/linux/kernel-compilation/kernel-compilation.sh
index 7e5c2d1..48138b3 100755
--- a/automated/linux/kernel-compilation/kernel-compilation.sh
+++ b/automated/linux/kernel-compilation/kernel-compilation.sh
@@ -57,7 +57,7 @@ case "${abi}" in
esac
measurement="$(grep "^real" "${LOGFILE}" | awk '{print $2}')"
-if egrep "arch/.*/boot/Image" "${LOGFILE}"; then
+if grep -E "arch/.*/boot/Image" "${LOGFILE}"; then
report_pass "kernel-compilation"
add_metric "kernel-compilation-time" "pass" "${measurement}" "seconds"
else
diff --git a/automated/linux/kvm/start-kvm.sh b/automated/linux/kvm/start-kvm.sh
index 6ed3a67..8dd5216 100755
--- a/automated/linux/kvm/start-kvm.sh
+++ b/automated/linux/kvm/start-kvm.sh
@@ -21,8 +21,8 @@
# Create cloud-config image to set up credentials for image
configure_guest()
{
- IP=`ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/'`
- SSH_KEY=`head -1 /root/.ssh/authorized_keys||head -1 $HOME/.ssh/authorized_keys`
+ IP=$(ip addr | grep 'state UP' -A2 | tail -n1 | awk '{print $2}' | cut -f1 -d'/')
+ SSH_KEY=$(head -1 /root/.ssh/authorized_keys||head -1 "${HOME}/.ssh/authorized_keys")
sed -e "s,LAVA_KEY,$SSH_KEY,g" -e "s,LOCALIP,$IP,g" cloudinit.txt > cloudinit.tmp
cat cloudinit.tmp
cloud-localds cloud.img cloudinit.tmp
@@ -33,33 +33,36 @@ download_file()
{
local _outvar=$1
local url=$2
- local filename=`basename $url`
- if [ ! -e $filename ]
+ local filename
+ filename=$(basename "${url}")
+ if [ ! -e "${filename}" ]
then
- if [ -z $url -o $url = none ]
+ if [ -z "${url}" ] || [ "${url}" = none ]
then
>&2 echo "Error, url for $_outvar not set!"
exit 2
fi
- if ! curl --retry 3 -SsOL $url
+ if ! curl --retry 3 -SsOL "${url}"
then
>&2 echo "Error downloading $url for $_outvar"
exit 3
fi
fi
+ # shellcheck disable=SC2086
eval $_outvar=\$filename
}
start_qemu_x86_64_aarch64()
{
image=$1
- download_file efi $GUEST_FIRMWARE
+ download_file efi "${GUEST_FIRMWARE}"
set -x
- qemu-system-aarch64 -smp $GUEST_CORES -m ${GUEST_RAM} -cpu cortex-a57 -M virt \
- -bios $efi \
+ # shellcheck disable=SC2154
+ qemu-system-aarch64 -smp "${GUEST_CORES}" -m "${GUEST_RAM}" -cpu cortex-a57 -M virt \
+ -bios "${efi}" \
-device virtio-blk-device,drive=image \
- -drive if=none,id=image,file=$image \
+ -drive if=none,id=image,file="${image}" \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-net-device,netdev=tap0 -netdev tap,id=tap0,script=no,downscript=no,ifname=tap0 \
@@ -71,13 +74,14 @@ start_qemu_x86_64_aarch64()
start_qemu_aarch64_aarch64()
{
image=$1
- download_file efi $GUEST_FIRMWARE
+ download_file efi "${GUEST_FIRMWARE}"
set -x
- qemu-system-aarch64 -smp $GUEST_CORES -m ${GUEST_RAM} -cpu host -M virt \
- -bios $efi \
+ # shellcheck disable=SC2154
+ qemu-system-aarch64 -smp "${GUEST_CORES}" -m "${GUEST_RAM}" -cpu host -M virt \
+ -bios "${efi}" \
-device virtio-blk-device,drive=image \
- -drive if=none,id=image,file=$image \
+ -drive if=none,id=image,file="${image}" \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-net-device,netdev=tap0 -netdev tap,id=tap0,script=no,downscript=no,ifname=tap0 \
@@ -89,14 +93,15 @@ start_qemu_aarch64_aarch64()
start_qemu_x86_64_armv7l()
{
image=$1
- download_file kernel $GUEST_KERNEL
+ download_file kernel "${GUEST_KERNEL}"
set -x
- qemu-system-arm -smp $GUEST_CORES -m ${GUEST_RAM} -cpu cortex-a15 -M virt \
- -kernel $kernel \
+ # shellcheck disable=SC2154
+ qemu-system-arm -smp "${GUEST_CORES}" -m "${GUEST_RAM}" -cpu cortex-a15 -M virt \
+ -kernel "${kernel}" \
-append "root=/dev/vdb1 rw rootwait mem=${GUEST_RAM}M console=ttyAMA0,38400n8" \
-device virtio-blk-device,drive=image \
- -drive if=none,id=image,file=$image \
+ -drive if=none,id=image,file="${image}" \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-net-device,netdev=tap0 -netdev tap,id=tap0,script=no,downscript=no,ifname=tap0 \
@@ -107,14 +112,15 @@ start_qemu_x86_64_armv7l()
start_qemu_aarch64_armv7l()
{
image=$1
- download_file kernel $GUEST_KERNEL
+ download_file kernel "${GUEST_KERNEL}"
set -x
- qemu-system-aarch64 -smp $GUEST_CORES -m ${GUEST_RAM} -cpu host,aarch64=off -M virt \
- -kernel $kernel \
+ # shellcheck disable=SC2154
+ qemu-system-aarch64 -smp "${GUEST_CORES}" -m "${GUEST_RAM}" -cpu host,aarch64=off -M virt \
+ -kernel "${kernel}" \
-append "root=/dev/vdb1 rw rootwait mem=${GUEST_RAM}M console=ttyAMA0,38400n8" \
-device virtio-blk-device,drive=image \
- -drive if=none,id=image,file=$image \
+ -drive if=none,id=image,file="${image}" \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-net-device,netdev=tap0 -netdev tap,id=tap0,script=no,downscript=no,ifname=tap0 \
@@ -126,14 +132,15 @@ start_qemu_aarch64_armv7l()
start_qemu_armv7l_armv7l()
{
image=$1
- download_file kernel $GUEST_KERNEL
+ download_file kernel "${GUEST_KERNEL}"
set -x
- qemu-system-arm -smp $GUEST_CORES -m ${GUEST_RAM} -cpu cortex-a15 -M vexpress-a15 \
- -kernel $kernel \
+ # shellcheck disable=SC2154
+ qemu-system-arm -smp "${GUEST_CORES}" -m "${GUEST_RAM}" -cpu cortex-a15 -M vexpress-a15 \
+ -kernel "${kernel}" \
-append "root=/dev/vdb1 rw rootwait mem=${GUEST_RAM}M console=ttyAMA0,38400n8" \
-device virtio-blk-device,drive=image \
- -drive if=none,id=image,file=$image \
+ -drive if=none,id=image,file="${image}" \
-device virtio-blk-device,drive=cloud \
-drive if=none,id=cloud,file=cloud.img \
-device virtio-net-device,netdev=tap0 -netdev tap,id=tap0,script=no,downscript=no,ifname=tap0 \
@@ -147,7 +154,7 @@ tunctl -u root
ifconfig tap0 0.0.0.0 up
brctl addif br0 tap0
-ARCH=`uname -m`
+ARCH=$(uname -m)
GUEST_ARCH=$1
GUEST_IMAGE=$2
GUEST_FIRMWARE=$3
@@ -155,7 +162,7 @@ GUEST_KERNEL=$4
GUEST_CORES=${5:-2}
GUEST_RAM=${6:-1024}
-download_file IMAGE $GUEST_IMAGE
+download_file IMAGE "${GUEST_IMAGE}"
configure_guest
if grep -q Juno /proc/device-tree/model
@@ -164,6 +171,8 @@ then
hwloc-bind socket:0 --pid $$
fi
-start_qemu_${ARCH}_${GUEST_ARCH} ${IMAGE}
+# shellcheck disable=SC2153,SC2086
+start_qemu_${ARCH}_${GUEST_ARCH} "${IMAGE}"
sleep 10
+# shellcheck disable=SC2035
tail *.log
diff --git a/automated/linux/kvm/wait-ip.py b/automated/linux/kvm/wait-ip.py
index 392fc8c..6ace09a 100755
--- a/automated/linux/kvm/wait-ip.py
+++ b/automated/linux/kvm/wait-ip.py
@@ -3,6 +3,7 @@
from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer
+
class MyHandler(BaseHTTPRequestHandler):
def returnIP(self):
self.send_response(200)
@@ -19,6 +20,6 @@ class MyHandler(BaseHTTPRequestHandler):
def do_GET(self):
self.returnIP()
+
server = HTTPServer(('', 8080), MyHandler)
server.handle_request()
-
diff --git a/automated/linux/kvm/wait-kvm.sh b/automated/linux/kvm/wait-kvm.sh
index 1ba1d07..df2a6ff 100755
--- a/automated/linux/kvm/wait-kvm.sh
+++ b/automated/linux/kvm/wait-kvm.sh
@@ -2,6 +2,7 @@
[ -r "$1" ]||exit 0
+# shellcheck disable=SC2086
while [ -d "/proc/$(cat $1)/" ]
do
sleep 10
diff --git a/automated/linux/lapack/lapack.sh b/automated/linux/lapack/lapack.sh
index f7979ee..4ee1d0c 100755
--- a/automated/linux/lapack/lapack.sh
+++ b/automated/linux/lapack/lapack.sh
@@ -24,21 +24,21 @@ done
parse_output() {
# Parse each type of results
- egrep "passed" "${RESULT_LOG}" | tee -a "${TEST_PASS_LOG}"
+ grep -E "passed" "${RESULT_LOG}" | tee -a "${TEST_PASS_LOG}"
sed -i -e 's/: /:/g' "${TEST_PASS_LOG}"
sed -i -e 's/ \+/-/g' "${TEST_PASS_LOG}"
sed -i -e 's/-passed:/ pass /g' "${TEST_PASS_LOG}"
cat "${TEST_PASS_LOG}" >> "${RESULT_FILE}"
- egrep "failing" "${RESULT_LOG}" | tee -a "${TEST_FAIL_LOG}"
+ grep -E "failing" "${RESULT_LOG}" | tee -a "${TEST_FAIL_LOG}"
sed -i -e 's/failing to pass the threshold:/FAIL:/g' "${TEST_FAIL_LOG}"
sed -i -e 's/: /:/g' "${TEST_FAIL_LOG}"
sed -i -e 's/ \+/-/g' "${TEST_FAIL_LOG}"
sed -i -e 's/-FAIL:/ fail /g' "${TEST_FAIL_LOG}"
cat "${TEST_FAIL_LOG}" >> "${RESULT_FILE}"
- egrep "Illegal Error:" "${RESULT_LOG}" | tee -a "${TEST_SKIP_LOG}"
- egrep "Info Error:" "${RESULT_LOG}" | tee -a "${TEST_SKIP_LOG}"
+ grep -E "Illegal Error:" "${RESULT_LOG}" | tee -a "${TEST_SKIP_LOG}"
+ grep -E "Info Error:" "${RESULT_LOG}" | tee -a "${TEST_SKIP_LOG}"
sed -i -e 's/Illegal Error:/SKIP:/g' "${TEST_SKIP_LOG}"
sed -i -e 's/Info Error:/SKIP:/g' "${TEST_SKIP_LOG}"
sed -i -e 's/: /:/g' "${TEST_SKIP_LOG}"
diff --git a/automated/linux/linpack/linpack.sh b/automated/linux/linpack/linpack.sh
index 128240b..23e49c5 100755
--- a/automated/linux/linpack/linpack.sh
+++ b/automated/linux/linpack/linpack.sh
@@ -30,7 +30,7 @@ detect_abi
# Parse output.
echo
-egrep "^ +[0-9]+ " "${TEST_LOG}" \
+grep -E "^ +[0-9]+ " "${TEST_LOG}" \
| awk -v array_size="${ARRAY_SIZE}" \
'END{printf("linpack-%s pass %s flops\n", array_size, $NF)}' \
| tee -a "${RESULT_FILE}"
diff --git a/automated/linux/ltp-open-posix/ltp-open-posix.sh b/automated/linux/ltp-open-posix/ltp-open-posix.sh
index 07137f7..8ec450e 100755
--- a/automated/linux/ltp-open-posix/ltp-open-posix.sh
+++ b/automated/linux/ltp-open-posix/ltp-open-posix.sh
@@ -24,6 +24,7 @@ while getopts "s:v:" arg; do
case "$arg" in
s) SKIP_INSTALL="${OPTARG}";;
v) LTP_VERSION="${OPTARG}";;
+ *) ;;
esac
done
diff --git a/automated/linux/ltp-realtime/ltp-realtime.py b/automated/linux/ltp-realtime/ltp-realtime.py
index 8a5cda7..dc089a5 100755
--- a/automated/linux/ltp-realtime/ltp-realtime.py
+++ b/automated/linux/ltp-realtime/ltp-realtime.py
@@ -6,37 +6,49 @@ import fileinput
# extract a standard results block from the stream
def standard_results():
- minimum = re.compile("^Min:\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
- maximum = re.compile("^Max:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
- average = re.compile("^Avg:\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
- standarddev = re.compile("^StdDev:\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)")
+ minimum = re.compile(r"^Min:\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
+ maximum = re.compile(r"^Max:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ average = re.compile(r"^Avg:\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
+ standarddev = re.compile(r"^StdDev:\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)")
finished = 0
for line in sys.stdin:
for parser in [maximum, minimum, average, standarddev]:
result = parser.search(line)
if result is not None:
if parser is minimum:
- test_min = result.group('min')
- units = result.group('units')
- print "%s%s_min pass %s %s " % (test_name, test_args, test_min, units)
+ test_min = result.group("min")
+ units = result.group("units")
+ print(
+ "%s%s_min pass %s %s "
+ % (test_name, test_args, test_min, units)
+ )
finished += 1
break
if parser is maximum:
- test_max = result.group('max')
- units = result.group('units')
+ test_max = result.group("max")
+ units = result.group("units")
finished += 1
- print "%s%s_max pass %s %s " % (test_name, test_args, test_max, units)
+ print(
+ "%s%s_max pass %s %s "
+ % (test_name, test_args, test_max, units)
+ )
break
if parser is average:
- test_avg = result.group('average')
- units = result.group('units')
- print "%s%s_avg pass %s %s " % (test_name, test_args, test_avg, units)
+ test_avg = result.group("average")
+ units = result.group("units")
+ print(
+ "%s%s_avg pass %s %s "
+ % (test_name, test_args, test_avg, units)
+ )
finished += 1
break
if parser is standarddev:
- test_stddev = result.group('stddev')
- units = result.group('units')
- print "%s%s_stddev pass %s %s " % (test_name, test_args, test_stddev, units)
+ test_stddev = result.group("stddev")
+ units = result.group("units")
+ print(
+ "%s%s_stddev pass %s %s "
+ % (test_name, test_args, test_stddev, units)
+ )
finished += 1
break
else:
@@ -44,20 +56,20 @@ def standard_results():
if finished == 4:
return
- print "ERROR: Parser failed and ran to EOF"
+ print("ERROR: Parser failed and ran to EOF")
sys.exit(-1)
def result_results():
- results = re.compile("Result:\s+(?P<result>\w+)")
+ results = re.compile(r"Result:\s+(?P<result>\w+)")
finished = 0
for line in sys.stdin:
for parser in [results]:
result = parser.search(line)
if result is not None:
if parser is results:
- test_result = result.group('result')
- print "%s-%s %s" % (test_name, test_args, test_result)
+ test_result = result.group("result")
+ print("%s-%s %s" % (test_name, test_args, test_result))
finished += 1
break
else:
@@ -65,21 +77,24 @@ def result_results():
if finished == 1:
return
- print "ERROR: Parser failed and ran to EOF"
+ print("ERROR: Parser failed and ran to EOF")
sys.exit(-1)
def sched_jitter_results():
- maximum = re.compile("^max jitter:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ maximum = re.compile(r"^max jitter:\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
finished = 0
for line in sys.stdin:
for parser in [maximum]:
result = parser.search(line)
if result is not None:
if parser is maximum:
- test_max = result.group('max')
- units = result.group('units')
- print "%s%s_max_jitter pass %s %s" % (test_name, test_args, test_max, units)
+ test_max = result.group("max")
+ units = result.group("units")
+ print(
+ "%s%s_max_jitter pass %s %s"
+ % (test_name, test_args, test_max, units)
+ )
finished += 1
break
else:
@@ -88,42 +103,53 @@ def sched_jitter_results():
# print "min:%s max:%s avg:%s stddev:%s" % (test_min, test_max, test_avg, test_stddev)
return
- print "ERROR: Parser failed and ran to EOF"
+ print("ERROR: Parser failed and ran to EOF")
sys.exit(-1)
def pi_perf_results():
- minimum = re.compile("^Min delay =\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
- maximum = re.compile("^Max delay =\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
- average = re.compile("^Average delay =\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
- standarddev = re.compile("^Standard Deviation =\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)")
+ minimum = re.compile(r"^Min delay =\s+(?P<min>[\d\.]+)\s+(?P<units>\w+)")
+ maximum = re.compile(r"^Max delay =\s+(?P<max>[\d\.]+)\s+(?P<units>\w+)")
+ average = re.compile(r"^Average delay =\s+(?P<average>[\d\.]+)\s+(?P<units>\w+)")
+ standarddev = re.compile(
+ r"^Standard Deviation =\s+(?P<stddev>[\d\.]+)\s+(?P<units>\w+)"
+ )
finished = 0
for line in sys.stdin:
for parser in [maximum, minimum, average, standarddev]:
result = parser.search(line)
if result is not None:
if parser is minimum:
- test_min = result.group('min')
- units = result.group('units')
- print "%s%s_min pass %s %s" % (test_name, test_args, test_min, units)
+ test_min = result.group("min")
+ units = result.group("units")
+ print(
+ "%s%s_min pass %s %s" % (test_name, test_args, test_min, units)
+ )
finished += 1
break
if parser is maximum:
- test_max = result.group('max')
- units = result.group('units')
- print "%s%s_max pass %s %s" % (test_name, test_args, test_max, units)
+ test_max = result.group("max")
+ units = result.group("units")
+ print(
+ "%s%s_max pass %s %s" % (test_name, test_args, test_max, units)
+ )
finished += 1
break
if parser is average:
- test_avg = result.group('average')
- units = result.group('units')
- print "%s%s_avg pass %s %s" % (test_name, test_args, test_avg, units)
+ test_avg = result.group("average")
+ units = result.group("units")
+ print(
+ "%s%s_avg pass %s %s" % (test_name, test_args, test_avg, units)
+ )
finished += 1
break
if parser is standarddev:
- test_stddev = result.group('stddev')
- units = result.group('units')
- print "%s%s_stddev pass %s %s" % (test_name, test_args, test_stddev, units)
+ test_stddev = result.group("stddev")
+ units = result.group("units")
+ print(
+ "%s%s_stddev pass %s %s"
+ % (test_name, test_args, test_stddev, units)
+ )
finished += 1
break
else:
@@ -131,7 +157,7 @@ def pi_perf_results():
if finished == 4:
return
- print "ERROR: Parser failed and ran to EOF"
+ print("ERROR: Parser failed and ran to EOF")
sys.exit(-1)
@@ -201,29 +227,32 @@ def periodic_cpu_load():
def async_handler_jk():
result_results()
+
# Parse the input stream and tuen test names into function calls to parse their
# details
-test_start = re.compile("--- Running testcase (?P<name>[a-zA-Z0-9_-]+)\s+(?P<args>[a-zA-Z0-9_.\- ]*?)\s*---")
-test_finish = re.compile("The .* test appears to have completed.")
+test_start = re.compile(
+ r"--- Running testcase (?P<name>[a-zA-Z0-9_-]+)\s+(?P<args>[a-zA-Z0-9_.\- ]*?)\s*---"
+)
+test_finish = re.compile(r"The .* test appears to have completed.")
for line in sys.stdin:
for parser in [test_start, test_finish]:
result = parser.search(line)
if result is not None:
if parser is test_start:
- test_name = result.group('name')
- func_name = result.group('name')
+ test_name = result.group("name")
+ func_name = result.group("name")
func_name = func_name.replace("-", "_")
- test_args = result.group('args')
+ test_args = result.group("args")
test_args = test_args.replace(" ", "-")
- print
- print "test_start = " + test_name + test_args
+ print("")
+ print("test_start = " + test_name + test_args)
globals()[func_name]()
break
if parser is test_finish:
- print "test_finished = " + test_name + test_args
+ print("test_finished = " + test_name + test_args)
break
else:
continue
diff --git a/automated/linux/ltp-realtime/ltp-realtime.sh b/automated/linux/ltp-realtime/ltp-realtime.sh
index f8dc262..df17157 100755
--- a/automated/linux/ltp-realtime/ltp-realtime.sh
+++ b/automated/linux/ltp-realtime/ltp-realtime.sh
@@ -32,6 +32,7 @@ while getopts "T:s:v:" arg; do
# SKIP_INSTALL is false in case of Debian builds
s) SKIP_INSTALL="${OPTARG}";;
v) LTP_VERSION="${OPTARG}";;
+ *) ;;
esac
done
diff --git a/automated/linux/mmc/mmc-test.sh b/automated/linux/mmc/mmc-test.sh
index 6736056..341f941 100755
--- a/automated/linux/mmc/mmc-test.sh
+++ b/automated/linux/mmc/mmc-test.sh
@@ -55,7 +55,7 @@ else
exit_on_skip "mmc-pre-requirements" "Kernel config file not available"
fi
-( [ "${CONFIG_MMC}" = "CONFIG_MMC=y" ] || [ "${CONFIG_MMC}" = "CONFIG_MMC=m" ] ) && ( [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=y" ] || [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=m" ] )
+{ [ "${CONFIG_MMC}" = "CONFIG_MMC=y" ] || [ "${CONFIG_MMC}" = "CONFIG_MMC=m" ]; } && { [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=y" ] || [ "${CONFIG_MMC_SDHCI}" = "CONFIG_MMC_SDHCI=m" ]; }
exit_on_skip "mmc-pre-requirements" "Kernel config CONFIG_MMC=y or CONFIG_MMC=m and CONFIG_MMC_SDHCI=y or CONFIG_MMC_SDHCI=m not enabled"
list_all_mmc_devices
diff --git a/automated/linux/nginx-server/linux-ip.sh b/automated/linux/nginx-server/linux-ip.sh
index a8937ce..c2174a3 100644
--- a/automated/linux/nginx-server/linux-ip.sh
+++ b/automated/linux/nginx-server/linux-ip.sh
@@ -23,7 +23,7 @@ do_configure_system() {
WRITE_CONFIG_CORE="worker_cpu_affinity auto;"
WRITE_CONFIG_EVENTS=""
WRITE_CONFIG_LISTEN="listen $server_ip:80 default_server reuseport so_keepalive=off;"
- echo <<-EOF
+ cat <<-EOF
WRITE_CONFIG_CORE=$WRITE_CONFIG_CORE
WRITE_CONFIG_EVENTS=$WRITE_CONFIG_EVENTS
WRITE_CONFIG_LISTEN=$WRITE_CONFIG_LISTEN
diff --git a/automated/linux/nginx-server/odp-dpdk-git.sh b/automated/linux/nginx-server/odp-dpdk-git.sh
index 9838f74..0525a29 100644
--- a/automated/linux/nginx-server/odp-dpdk-git.sh
+++ b/automated/linux/nginx-server/odp-dpdk-git.sh
@@ -34,7 +34,7 @@ do_configure_system() {
WRITE_CONFIG_CORE=""
WRITE_CONFIG_EVENTS="use select;"
WRITE_CONFIG_LISTEN="listen $server_ip:80 default_server so_keepalive=off;"
- echo <<-EOF
+ cat <<-EOF
WRITE_CONFIG_CORE=$WRITE_CONFIG_CORE
WRITE_CONFIG_EVENTS=$WRITE_CONFIG_EVENTS
WRITE_CONFIG_LISTEN=$WRITE_CONFIG_LISTEN
diff --git a/automated/linux/nginx-server/odp-dpdk.sh b/automated/linux/nginx-server/odp-dpdk.sh
index f078e05..f79b148 100644
--- a/automated/linux/nginx-server/odp-dpdk.sh
+++ b/automated/linux/nginx-server/odp-dpdk.sh
@@ -41,7 +41,7 @@ do_configure_system() {
echo "-- NOTICE: setting MAX_CORES to 1"
MAX_CORES=1
- echo <<-EOF
+ cat <<-EOF
WRITE_CONFIG_CORE=$WRITE_CONFIG_CORE
WRITE_CONFIG_EVENTS=$WRITE_CONFIG_EVENTS
WRITE_CONFIG_LISTEN=$WRITE_CONFIG_LISTEN
diff --git a/automated/linux/openjdk/openjdk-smoke.sh b/automated/linux/openjdk/openjdk-smoke.sh
index a31299d..85509f8 100755
--- a/automated/linux/openjdk/openjdk-smoke.sh
+++ b/automated/linux/openjdk/openjdk-smoke.sh
@@ -50,7 +50,7 @@ fi
# Set the specific version as default in case more than one jdk installed.
for link in java javac; do
path="$(update-alternatives --display "${link}" \
- | egrep "^/usr/lib/jvm/java-(${VERSION}|1.${VERSION}.0)" \
+ | grep -E "^/usr/lib/jvm/java-(${VERSION}|1.${VERSION}.0)" \
| awk '{print $1}')"
update-alternatives --set "${link}" "${path}"
done
diff --git a/automated/linux/openssh/openssh-debian.sh b/automated/linux/openssh/openssh-debian.sh
index 0053118..f079108 100755
--- a/automated/linux/openssh/openssh-debian.sh
+++ b/automated/linux/openssh/openssh-debian.sh
@@ -13,7 +13,7 @@ usage() {
}
parse_output() {
- egrep "^failed|^ok" "${TEST_LOG}" 2>&1 | tee -a "${RESULT_LOG}"
+ grep -E "^failed|^ok" "${TEST_LOG}" 2>&1 | tee -a "${RESULT_LOG}"
sed -i -e 's/ok/pass/g' "${RESULT_LOG}"
sed -i -e 's/failed/fail/g' "${RESULT_LOG}"
awk '{for (i=2; i<NF; i++) printf $i "-"; print $NF " " $1}' "${RESULT_LOG}" 2>&1 | tee -a "${RESULT_FILE}"
diff --git a/automated/linux/ota-update/ota-update.py b/automated/linux/ota-update/ota-update.py
index 9668f92..399c67d 100644
--- a/automated/linux/ota-update/ota-update.py
+++ b/automated/linux/ota-update/ota-update.py
@@ -42,6 +42,7 @@ def match_sha_on_server(sha):
print "FAIL: Installed sha on device did not match"
return -1
+
if match_sha_on_server(args.installed_sha) == 0:
py_test_lib.add_result(RESULT_FILE, "installed-device-sha-match-server pass")
r = requests.put(url, data=data, headers=headers)
diff --git a/automated/linux/ptest/ptest.py b/automated/linux/ptest/ptest.py
index 384e748..90fc45d 100755
--- a/automated/linux/ptest/ptest.py
+++ b/automated/linux/ptest/ptest.py
@@ -93,9 +93,9 @@ def parse_line(line):
}
for test_status, status_regex in test_status_list.items():
- test_name = status_regex.search(line)
- if test_name:
- return [test_name.group(1), test_status]
+ test_name = status_regex.search(line)
+ if test_name:
+ return [test_name.group(1), test_status]
return None
@@ -109,8 +109,8 @@ def run_ptest(command):
while True:
output = process.stdout.readline()
try:
- output = unicode(output, "utf-8").strip()
- except:
+ output = str(output, "utf-8").strip()
+ except TypeError:
output = output.decode("utf-8", errors="replace").strip()
if len(output) == 0 and process.poll() is not None:
break
@@ -191,7 +191,7 @@ if __name__ == '__main__':
ret = main()
except SystemExit as e:
ret = e.code
- except:
+ except Exception:
ret = 1
import traceback
traceback.print_exc()
diff --git a/automated/linux/ui-browser-test/install.sh b/automated/linux/ui-browser-test/install.sh
index d7f0e43..9d7d1dd 100755
--- a/automated/linux/ui-browser-test/install.sh
+++ b/automated/linux/ui-browser-test/install.sh
@@ -57,8 +57,8 @@ dist_name
# Consider Ubuntu as a Debian distribution
dist=${dist/ubuntu/debian}
-type install_chromedriver_"${dist}"
-if [ $? -ne 0 ]; then
+if ! type install_chromedriver_"${dist}"
+then
echo "Distro not supported: ${dist}"
echo " $0 : failed"
exit 1
diff --git a/automated/linux/unixbench/unixbench.sh b/automated/linux/unixbench/unixbench.sh
index 73b7c83..f89b815 100755
--- a/automated/linux/unixbench/unixbench.sh
+++ b/automated/linux/unixbench/unixbench.sh
@@ -35,12 +35,12 @@ log_parser() {
logfile="$2"
# Test Result.
- egrep "[0-9.]+ [a-zA-Z]+ +\([0-9.]+ s," "${logfile}" \
+ grep -E "[0-9.]+ [a-zA-Z]+ +\([0-9.]+ s," "${logfile}" \
| awk -v prefix="${prefix}" '{printf(prefix)};{for (i=1;i<=(NF-6);i++) printf("-%s",$i)};{printf(" pass %s %s\n"),$(NF-5),$(NF-4)}' \
| tee -a "${RESULT_FILE}"
# Index Values.
- egrep "[0-9]+\.[0-9] +[0-9]+\.[0-9] +[0-9]+\.[0-9]" "${logfile}" \
+ grep -E "[0-9]+\.[0-9] +[0-9]+\.[0-9] +[0-9]+\.[0-9]" "${logfile}" \
| awk -v prefix="${prefix}" '{printf(prefix)};{for (i=1;i<=(NF-3);i++) printf("-%s",$i)};{printf(" pass %s index\n"),$NF}' \
| tee -a "${RESULT_FILE}"
diff --git a/automated/linux/wlan-download/wlan-download-test.sh b/automated/linux/wlan-download/wlan-download-test.sh
index 26c1804..bd7d8ee 100755
--- a/automated/linux/wlan-download/wlan-download-test.sh
+++ b/automated/linux/wlan-download/wlan-download-test.sh
@@ -82,7 +82,7 @@ test_wlan_connection() {
echo "IP Route:"
ip route
- if [ ! -z "${NAMESERVER}" ]; then
+ if [ -n "${NAMESERVER}" ]; then
mv /etc/resolv.conf /etc/resolv.conf.backup
echo "nameserver ${NAMESERVER}" > /etc/resolv.conf
fi
@@ -111,7 +111,7 @@ create_out_dir "${OUTPUT}"
info_msg "About to run wlan download test..."
info_msg "Output directory: ${OUTPUT}"
-if [ ! -z "${ETHERNET_DEVICE}" ]; then
+if [ -n "${ETHERNET_DEVICE}" ]; then
ip link set "${ETHERNET_DEVICE}" down
check_return "eth-down"
fi
@@ -122,7 +122,7 @@ sleep "${TIME_DELAY}" # XXX: some devices needs a wait after up to be ready, def
iw dev "${DEVICE}" scan
exit_on_fail "wlan-scan"
test_wlan_connection
-if [ ! -z "${FILE_URL}" ]; then
+if [ -n "${FILE_URL}" ]; then
test_wlan_download
fi
@@ -132,11 +132,11 @@ ip link set "${DEVICE}" down
kill -9 "$(cat /tmp/wpa_supplicant.pid)"
kill -9 "$(cat /tmp/dhclient.pid)"
-if [ ! -z "${NAMESERVER}" ]; then
+if [ -n "${NAMESERVER}" ]; then
mv /etc/resolv.conf.backup /etc/resolv.conf
fi
-if [ ! -z "${ETHERNET_DEVICE}" ]; then
+if [ -n "${ETHERNET_DEVICE}" ]; then
ip link set "${ETHERNET_DEVICE}" up
check_return "eth-up"
fi
diff --git a/automated/linux/workload-automation3/workload-automation.sh b/automated/linux/workload-automation3/workload-automation.sh
index e887c53..b77c3f5 100755
--- a/automated/linux/workload-automation3/workload-automation.sh
+++ b/automated/linux/workload-automation3/workload-automation.sh
@@ -39,7 +39,7 @@ done
! check_root && error_msg "Please run this test as root."
cd "${TEST_DIR}"
-if [ ! -z "${NEW_OUTPUT}" ]; then
+if [ -n "${NEW_OUTPUT}" ]; then
OUTPUT="${NEW_OUTPUT}"
fi
create_out_dir "${OUTPUT}"
diff --git a/automated/utils/httperf/httperf-runner.py b/automated/utils/httperf/httperf-runner.py
index ab4f1fd..90bba64 100755
--- a/automated/utils/httperf/httperf-runner.py
+++ b/automated/utils/httperf/httperf-runner.py
@@ -255,7 +255,7 @@ class ParseTolerance(argparse.Action):
for key in ret:
try:
ret[key] = int(ret[key])
- except:
+ except ValueError:
print("Warning: Ignoring value", ret[key], "for", key,
": not an integer", file=sys.stderr)
ret[key] = 0
@@ -267,10 +267,10 @@ parser = argparse.ArgumentParser(description='Find highest rate using httperf')
parser.add_argument('--attempts', '-a', type=int, default=[2], nargs=1,
help='Number of attempts for each rate under test (default 2)')
parser.add_argument('--csv', nargs=1,
- help='Save the results in the given file. The file will ' +
- 'have one column which is later easy to import in a ' +
- 'spreadsheet. If the file exists, data will be ' +
- 'appended to it.')
+ help='Save the results in the given file. The file will '
+ + 'have one column which is later easy to import in a '
+ + 'spreadsheet. If the file exists, data will be '
+ + 'appended to it.')
parser.add_argument('--dir', '-d', nargs=1, default=None,
help='Put all output files in this directory (default CWD)')
parser.add_argument('--duration', nargs=1, default=[5], type=int,
@@ -280,8 +280,8 @@ parser.add_argument('--iterations', '-i', default=[1], nargs=1, type=int,
parser.add_argument('--min-step', '-m', nargs=1, default=[200], type=int,
help='The minimum step to consider (default 200)')
parser.add_argument('--output', '-o', default='httperf_max_rate',
- help='Stores the result in the OUTPUT file, with the ' +
- 'iteration number appended (default httperf_max_rate)')
+ help='Stores the result in the OUTPUT file, with the '
+ + 'iteration number appended (default httperf_max_rate)')
parser.add_argument('--rate', '-r', type=int, default=[10000], nargs=1,
help='The initial request rate to try (default 10000)')
parser.add_argument('--step', '-s', type=int, default=[10000], nargs=1,
@@ -290,8 +290,8 @@ parser.add_argument('--server', default='localhost',
help='Server to connet to (defaut localhost)')
parser.add_argument('--tolerance', nargs='+', action=ParseTolerance,
default={'client-timo': 20},
- help='list of key value pairs of errors accepted by ' +
- 'httperf. Ex: --tolerance client-timo 20 other 5')
+ help='list of key value pairs of errors accepted by '
+ + 'httperf. Ex: --tolerance client-timo 20 other 5')
args = parser.parse_args()
diff --git a/automated/utils/post-to-squad.py b/automated/utils/post-to-squad.py
index 07fa454..7ba4e0c 100755
--- a/automated/utils/post-to-squad.py
+++ b/automated/utils/post-to-squad.py
@@ -107,6 +107,7 @@ def main():
r = requests.post(url, headers=headers, files=files)
print(r.text)
+
if __name__ == "__main__":
args = parse_args()
diff --git a/automated/utils/send-to-lava.sh b/automated/utils/send-to-lava.sh
index fdfdf78..3d57739 100755
--- a/automated/utils/send-to-lava.sh
+++ b/automated/utils/send-to-lava.sh
@@ -9,7 +9,7 @@ lava_test_set="$?"
if [ -f "${RESULT_FILE}" ]; then
while read -r line; do
- if echo "${line}" | egrep -iq ".* +(pass|fail|skip)$"; then
+ if echo "${line}" | grep -iq -E ".* +(pass|fail|skip)$"; then
test="$(echo "${line}" | awk '{print $1}')"
result="$(echo "${line}" | awk '{print $2}')"
@@ -18,7 +18,7 @@ if [ -f "${RESULT_FILE}" ]; then
else
echo "<TEST_CASE_ID=${test} RESULT=${result}>"
fi
- elif echo "${line}" | egrep -iq ".*+ (pass|fail|skip)+ .*+"; then
+ elif echo "${line}" | grep -iq -E ".*+ (pass|fail|skip)+ .*+"; then
test="$(echo "${line}" | awk '{print $1}')"
result="$(echo "${line}" | awk '{print $2}')"
measurement="$(echo "${line}" | awk '{print $3}')"
@@ -33,7 +33,7 @@ if [ -f "${RESULT_FILE}" ]; then
else
echo "<TEST_CASE_ID=${test} RESULT=${result} MEASUREMENT=${measurement} UNITS=${units}>"
fi
- elif echo "${line}" | egrep -iq "^lava-test-set.*"; then
+ elif echo "${line}" | grep -iq -E "^lava-test-set.*"; then
test_set_status="$(echo "${line}" | awk '{print $2}')"
test_set_name="$(echo "${line}" | awk '{print $3}')"
if [ "${lava_test_set}" -eq 0 ]; then
diff --git a/manual/generic/linux/openssh-centos.sh b/manual/generic/linux/openssh-centos.sh
index dfe2131..b9234a1 100755
--- a/manual/generic/linux/openssh-centos.sh
+++ b/manual/generic/linux/openssh-centos.sh
@@ -7,7 +7,7 @@ TEST_LOG="${OUTPUT}/test_log.txt"
parse_output() {
- egrep "^failed|^ok" "${TEST_LOG}" | tee -a "${RESULT_LOG}"
+ grep -E "^failed|^ok" "${TEST_LOG}" | tee -a "${RESULT_LOG}"
sed -i -e 's/ok/pass/g' "${RESULT_LOG}"
sed -i -e 's/failed/fail/g' "${RESULT_LOG}"
echo "=== Openssh results summary ==="
diff --git a/plans/testplan2html.py b/plans/testplan2html.py
index 872eae7..b463492 100644
--- a/plans/testplan2html.py
+++ b/plans/testplan2html.py
@@ -271,5 +271,6 @@ def main():
# render test plan with links to test files
# add option to render as single file (for pdf generation)
+
if __name__ == "__main__":
main()