diff options
-rwxr-xr-x | automated/linux/hackbench/hackbench.sh | 9 | ||||
-rwxr-xr-x | automated/linux/iperf/iperf.sh | 1 | ||||
-rwxr-xr-x | automated/linux/pi-stress/pi-stress.sh | 9 | ||||
-rwxr-xr-x | automated/linux/pmqtest/pmqtest.sh | 9 | ||||
-rwxr-xr-x | automated/linux/rt-migrate-test/rt-migrate-test.sh | 9 | ||||
-rwxr-xr-x | automated/linux/signaltest/signaltest.sh | 9 | ||||
-rwxr-xr-x | validate.py | 100 |
7 files changed, 87 insertions, 59 deletions
diff --git a/automated/linux/hackbench/hackbench.sh b/automated/linux/hackbench/hackbench.sh index 48ded0f..e683f17 100755 --- a/automated/linux/hackbench/hackbench.sh +++ b/automated/linux/hackbench/hackbench.sh @@ -46,11 +46,14 @@ fi info_msg "Hackbench test options: ${OPTS}" # Test run. -detect_abi +if ! binary=$(which hackbench); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/hackbench" +fi for i in $(seq "${ITERATION}"); do info_msg "Running iteration [$i/${ITERATION}]" - # shellcheck disable=SC2154 - ./bin/"${abi}"/hackbench "${OPTS}" 2>&1 | tee -a "${TEST_LOG}" + "${binary}" "${OPTS}" 2>&1 | tee -a "${TEST_LOG}" done # Parse output. diff --git a/automated/linux/iperf/iperf.sh b/automated/linux/iperf/iperf.sh index 1abc8e1..525ff08 100755 --- a/automated/linux/iperf/iperf.sh +++ b/automated/linux/iperf/iperf.sh @@ -38,7 +38,6 @@ cd "${OUTPUT}" if [ "${SKIP_INSTALL}" = "true" ] || [ "${SKIP_INSTALL}" = "True" ]; then info_msg "iperf installation skipped" else - ! check_root && error_msg "You need to be root for installation!" dist_name # shellcheck disable=SC2154 case "${dist}" in diff --git a/automated/linux/pi-stress/pi-stress.sh b/automated/linux/pi-stress/pi-stress.sh index 390ffdc..40d5474 100755 --- a/automated/linux/pi-stress/pi-stress.sh +++ b/automated/linux/pi-stress/pi-stress.sh @@ -42,10 +42,13 @@ else RR="" fi -detect_abi +if ! binary=$(which pi_stress); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/pi_stress" +fi # pi_stress will send SIGTERM when test fails. The single will terminate the # test script. Catch and ignore it with trap. trap '' TERM -# shellcheck disable=SC2154 -./bin/"${abi}"/pi_stress --duration "${DURATION}" "${MLOCKALL}" "${RR}" +"${binary}" --duration "${DURATION}" "${MLOCKALL}" "${RR}" check_return 'pi-stress' diff --git a/automated/linux/pmqtest/pmqtest.sh b/automated/linux/pmqtest/pmqtest.sh index ae979b3..f48f946 100755 --- a/automated/linux/pmqtest/pmqtest.sh +++ b/automated/linux/pmqtest/pmqtest.sh @@ -28,8 +28,13 @@ done create_out_dir "${OUTPUT}" # Run pmqtest. -detect_abi -./bin/"${abi}"/pmqtest -S -l "${LOOPS}" | tee "${LOGFILE}" +if ! binary=$(which pmqtest); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/pmqtest" +fi + +"${binary}" -S -l "${LOOPS}" | tee "${LOGFILE}" # Parse test log. tail -n "$(nproc)" "${LOGFILE}" \ diff --git a/automated/linux/rt-migrate-test/rt-migrate-test.sh b/automated/linux/rt-migrate-test/rt-migrate-test.sh index 1c4ae68..e70e98d 100755 --- a/automated/linux/rt-migrate-test/rt-migrate-test.sh +++ b/automated/linux/rt-migrate-test/rt-migrate-test.sh @@ -25,9 +25,12 @@ done create_out_dir "${OUTPUT}" # Run rt-migrate-test. -detect_abi -# shellcheck disable=SC2154 -./bin/"${abi}"/rt-migrate-test -l "${LOOPS}" | tee "${LOGFILE}" +if ! binary=$(which rt-migrate-test); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/rt-migrate-test" +fi +"${binary}" -l "${LOOPS}" | tee "${LOGFILE}" # Parse test log. task_num=$(grep "Task" "${LOGFILE}" | tail -1 | awk '{print $2}') diff --git a/automated/linux/signaltest/signaltest.sh b/automated/linux/signaltest/signaltest.sh index 0e49c2f..1dd5678 100755 --- a/automated/linux/signaltest/signaltest.sh +++ b/automated/linux/signaltest/signaltest.sh @@ -30,9 +30,12 @@ done create_out_dir "${OUTPUT}" # Run signaltest. -detect_abi -# shellcheck disable=SC2154 -./bin/"${abi}"/signaltest -p "${PRIORITY}" -t "${THREADS}" -l "${LOOPS}" \ +if ! binary=$(which signaltest); then + detect_abi + # shellcheck disable=SC2154 + binary="./bin/${abi}/signaltest" +fi +"${binary}" -p "${PRIORITY}" -t "${THREADS}" -l "${LOOPS}" \ | tee "${LOGFILE}" # Parse test log. diff --git a/validate.py b/validate.py index 54edb75..3f127c4 100755 --- a/validate.py +++ b/validate.py @@ -64,57 +64,69 @@ def pep8_check(filepath, args): def metadata_check(filepath, args): if filepath.lower().endswith("yaml"): - with open(filepath, "r") as f: - result_message_list = [] - y = yaml.load(f.read()) - if 'metadata' not in y.keys(): - result_message_list.append("* METADATA [FAILED]: " + filepath) - result_message_list.append("\tmetadata section missing") - publish_result(result_message_list, args) - exit(1) - metadata_dict = y['metadata'] - mandatory_keys = set([ - 'name', - 'format', - 'description', - 'maintainer', - 'os', - 'devices']) - if not mandatory_keys.issubset(set(metadata_dict.keys())): + filecontent = None + try: + with open(filepath, "r") as f: + filecontent = f.read() + except FileNotFoundError: + publish_result(["* METADATA [PASSED]: " + filepath + " - deleted"], args) + return 0 + result_message_list = [] + y = yaml.load(filecontent) + if 'metadata' not in y.keys(): + result_message_list.append("* METADATA [FAILED]: " + filepath) + result_message_list.append("\tmetadata section missing") + publish_result(result_message_list, args) + exit(1) + metadata_dict = y['metadata'] + mandatory_keys = set([ + 'name', + 'format', + 'description', + 'maintainer', + 'os', + 'devices']) + if not mandatory_keys.issubset(set(metadata_dict.keys())): + result_message_list.append("* METADATA [FAILED]: " + filepath) + result_message_list.append("\tmandatory keys missing: %s" % + mandatory_keys.difference(set(metadata_dict.keys()))) + result_message_list.append("\tactual keys present: %s" % + metadata_dict.keys()) + publish_result(result_message_list, args) + return 1 + for key in mandatory_keys: + if len(metadata_dict[key]) == 0: result_message_list.append("* METADATA [FAILED]: " + filepath) - result_message_list.append("\tmandatory keys missing: %s" % - mandatory_keys.difference(set(metadata_dict.keys()))) - result_message_list.append("\tactual keys present: %s" % - metadata_dict.keys()) + result_message_list.append("\t%s has no content" % key) publish_result(result_message_list, args) return 1 - for key in mandatory_keys: - if len(metadata_dict[key]) == 0: - result_message_list.append("* METADATA [FAILED]: " + filepath) - result_message_list.append("\t%s has no content" % key) - publish_result(result_message_list, args) - return 1 - result_message_list.append("* METADATA [PASSED]: " + filepath) - publish_result(result_message_list, args) + result_message_list.append("* METADATA [PASSED]: " + filepath) + publish_result(result_message_list, args) return 0 def validate_yaml(filename, args): - with open(filename, "r") as f: - try: - y = yaml.load(f.read()) - message = "* YAMLVALID: [PASSED]: " + filename - print_stderr(message) - except: - message = "* YAMLVALID: [FAILED]: " + filename - result_message_list = [] - result_message_list.append(message) - result_message_list.append("\n\n") - exc_type, exc_value, exc_traceback = sys.exc_info() - for line in traceback.format_exception_only(exc_type, exc_value): - result_message_list.append(' ' + line) - publish_result(result_message_list, args) - return 1 + filecontent = None + try: + with open(filename, "r") as f: + filecontent = f.read() + except FileNotFoundError: + publish_result(["* YAMLVALID [PASSED]: " + filename + " - deleted"], args) + return 0 + try: + y = yaml.load(filecontent) + message = "* YAMLVALID: [PASSED]: " + filename + print_stderr(message) + except: + message = "* YAMLVALID: [FAILED]: " + filename + result_message_list = [] + result_message_list.append(message) + result_message_list.append("\n\n") + exc_type, exc_value, exc_traceback = sys.exc_info() + for line in traceback.format_exception_only(exc_type, exc_value): + result_message_list.append(' ' + line) + publish_result(result_message_list, args) + return 1 return 0 |