summaryrefslogtreecommitdiff
path: root/automated/linux/openssh/openssh-debian.sh
diff options
context:
space:
mode:
authorNaresh Kamboju <naresh.kamboju@linaro.org>2016-11-05 15:10:51 +0530
committerMilosz Wasilewski <milosz.wasilewski@linaro.org>2016-11-07 15:58:38 +0000
commit4f7c7393b54afc17007b04f34129434e3d3e5e5d (patch)
tree29fde8046c6ebc7d2d500f77a0d17bee8c1de107 /automated/linux/openssh/openssh-debian.sh
parent08f5153fcb6c48abc7614a768ecadfd0f19f8588 (diff)
linux: openssh debian test
Change-Id: I63d8a44c0bf004da0547e1cb0b87d5afaa60a4fc Signed-off-by: Naresh Kamboju <naresh.kamboju@linaro.org>
Diffstat (limited to 'automated/linux/openssh/openssh-debian.sh')
-rwxr-xr-xautomated/linux/openssh/openssh-debian.sh45
1 files changed, 45 insertions, 0 deletions
diff --git a/automated/linux/openssh/openssh-debian.sh b/automated/linux/openssh/openssh-debian.sh
new file mode 100755
index 0000000..597f6bf
--- /dev/null
+++ b/automated/linux/openssh/openssh-debian.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+
+. ../../lib/sh-test-lib
+OUTPUT="$(pwd)/output"
+RESULT_FILE="${OUTPUT}/result.txt"
+RESULT_LOG="${OUTPUT}/result_log.txt"
+TEST_LOG="${OUTPUT}/test_log.txt"
+
+parse_output() {
+ egrep "^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}"
+}
+
+while getopts "s:" o; do
+ case "$o" in
+ s) SKIP_INSTALL="${OPTARG}" ;;
+ *) usage ;;
+ esac
+done
+
+# Test run.
+! check_root && error_msg "This script must be run as root"
+[ -d "${OUTPUT}" ] && mv "${OUTPUT}" "${OUTPUT}_$(date +%Y%m%d%H%M%S)"
+mkdir -p "${OUTPUT}"
+
+pkgs="build-essential"
+install_deps "${pkgs}" "${SKIP_INSTALL}"
+
+
+info_msg "About to run openssh test..."
+info_msg "Output directory: ${OUTPUT}"
+
+apt-get update
+apt-get source openssh
+VERSION=$(dpkg -l | grep openssh-client |awk '{print $3}'|cut -d- -f 1 | cut -d: -f2)
+# shellcheck disable=SC2164
+cd openssh-"${VERSION}"
+./configure
+make
+make install
+make tests 2>&1 | tee -a "${TEST_LOG}"
+
+parse_output