diff options
author | Ryan Harkin <ryan.harkin@linaro.org> | 2021-01-09 15:29:23 +0000 |
---|---|---|
committer | Ryan Harkin <ryan.harkin@linaro.org> | 2021-01-13 17:16:40 +0000 |
commit | 2f180f39e095729b835c93aaec84e7f2aa06594f (patch) | |
tree | 0456c6b264d95d58bd70a1fbb2e7990ea12ceead | |
parent | 936627bef239943ef599cbefc04b854721ec76bb (diff) |
tpm test addedlinaro-20210113-004
Signed-off-by: Ryan Harkin <ryan.harkin@linaro.org>
-rwxr-xr-x | automated/linux/tpm/tpm.sh | 94 | ||||
-rw-r--r-- | automated/linux/tpm/tpm.yaml | 18 | ||||
-rw-r--r-- | plans/output/se-all-tests.html | 124 | ||||
-rw-r--r-- | plans/se-auto.yaml | 7 |
4 files changed, 243 insertions, 0 deletions
diff --git a/automated/linux/tpm/tpm.sh b/automated/linux/tpm/tpm.sh new file mode 100755 index 0000000..2f2cc68 --- /dev/null +++ b/automated/linux/tpm/tpm.sh @@ -0,0 +1,94 @@ +#!/bin/bash +# shellcheck disable=SC1091 + +OUTPUT="$(pwd)/output" +RESULT_FILE="${OUTPUT}/result.txt" + +#. ../../lib/sh-test-lib +#create_out_dir "${OUTPUT}" +mkdir -p ${OUTPUT} + +usage() { + echo "Usage: $0" 1>&2 + exit 1 +} + +################################################################################ +# Copied from automated/linux/spectre-meltdown-checker-test/bin/spectre-meltdown-checker.sh +# example usage: +# dmesg_grep 'Xen HVM callback vector for event delivery is enabled$'; ret=$? +################################################################################ +dmesg_grep() +{ + # grep for something in dmesg, ensuring that the dmesg buffer + # has not been truncated + dmesg_grepped='' + if ! dmesg | grep -qE -e '(^|\] )Linux version [0-9]' ; then + # dmesg truncated + return 2 + fi + dmesg_grepped=$(dmesg | grep -E "$1" | head -1) + # not found: + [ -z "$dmesg_grepped" ] && return 1 + # found, output is in $dmesg_grepped + return 0 +} + +################################################################################ +# +################################################################################ +sha="22a6ae81ea7162e91ca5623e227ff7fbfa66049c" +url="https://raw.githubusercontent.com/tpm2-software/tpm2-tss-engine/${sha}/test/" + +################################################################################ +# +################################################################################ +tpm_test() +{ + local file="$1" + local success_string="$2" + local result=fail + + echo "################################################################################" + echo "test: $file success_string: ${success_string}" + echo "################################################################################" + + #wget -q ${url}/${file} || echo "ERROR: wget ${file} failed" + testscript="/usr/share/installed-tests/tpm/${file}" + if [ -e "${testscript}" ]; then + rm -f /tmp/tpm.log || true + bash ${testscript} 2>&1 | tee /tmp/tpm.log + grep -e "${success_string}" /tmp/tpm.log && result=pass + else + echo "ERROR: ${testscript} does not exist" + fi + echo "$file $result" | tee -a ${RESULT_FILE} +} + +################################################################################ +################################################################################ +################################################################################ +################################################################################ +################################################################################ +################################################################################ +test_matrix=( + ecdsa-emptyauth.sh "Signature Verified Successfully" + ecdsa.sh "Signature Verified Successfully" + ecdsa-handle-flush.sh "Signature Verified Successfully" + rand.sh "engine \"tpm2tss\" set." + rsadecrypt.sh "test xabcde12345abcde12345 = xabcde12345abcde12345" + rsasign.sh "Signature Verified Successfully" + rsasign_parent.sh "Signature Verified Successfully" + rsasign_parent_pass.sh "Signature Verified Successfully" + rsasign_persistent.sh "Signature Verified Successfully" + rsasign_persistent_emptyauth.sh "Signature Verified Successfully" + sclient.sh "SUCCESS" + sserver.sh "Verify return code: 0 (ok)" +) + +for ((i=0;i<${#test_matrix[@]};i=$i+2)); do + tpm_test "${test_matrix[${i}]}" "${test_matrix[${i}+1]}" +done + +echo "################################################################################" +cat ${RESULT_FILE} diff --git a/automated/linux/tpm/tpm.yaml b/automated/linux/tpm/tpm.yaml new file mode 100644 index 0000000..da57ee0 --- /dev/null +++ b/automated/linux/tpm/tpm.yaml @@ -0,0 +1,18 @@ +metadata: + name: meminfo + format: "Lava-Test-Shell Test Definition 1.0" + description: "TPM test. Run the Schneider version of the ECDSA tests from https://github.com/tpm2-software/tpm2-tss-engine" + maintainer: + - ryan.harkin@linaro.org + os: + - oe + scope: + - functional + devices: + - rzn1d + +run: + steps: + - cd ./automated/linux/tpm + - ./tpm.sh + - ../../utils/send-to-lava.sh ./output/result.txt diff --git a/plans/output/se-all-tests.html b/plans/output/se-all-tests.html index f1e7851..373fb9f 100644 --- a/plans/output/se-all-tests.html +++ b/plans/output/se-all-tests.html @@ -11716,6 +11716,130 @@ Check that files can be written and read reliably, measure the timings for read </div> + <div > + <h3>Automated Testcase 17</h3> + <table class="table table-striped"> + <tbody> + + + <tr> + <td>name</td> + <td> + + tpm + + </tr> + + + + <tr> + <td>description</td> + <td> + + TPM test. Run the Schneider version of the ECDSA tests from https://github.com/tpm2-software/tpm2-tss-engine + + </tr> + + + + <tr> + <td>scope</td> + <td> + + <ul> + + <li>functional </li> + + </ul> + + </tr> + + + + <tr> + <td>os</td> + <td> + + <ul> + + <li>oe </li> + + </ul> + + </tr> + + + + <tr> + <td>from</td> + <td> + + git + + </tr> + + + + <tr> + <td>history</td> + <td> + + False + + </tr> + + + + <tr> + <td>repository</td> + <td> + + https://git.linaro.org/landing-teams/working/schneider/test-definitions.git + + </tr> + + + + <tr> + <td>branch</td> + <td> + + linaro + + </tr> + + + + <tr> + <td>path</td> + <td> + + automated/linux/tpm/tpm.yaml + + </tr> + + + + + + + </tbody> +</table> + + <h4>Steps to execute</h4> + <ol> + + <li>cd ./automated/linux/tpm </li> + + <li>./tpm.sh </li> + + <li>../../utils/send-to-lava.sh ./output/result.txt </li> + + </ol> + + + </div> + </div> diff --git a/plans/se-auto.yaml b/plans/se-auto.yaml index 1c7a931..f96ef65 100644 --- a/plans/se-auto.yaml +++ b/plans/se-auto.yaml @@ -167,3 +167,10 @@ tests: repository: https://git.linaro.org/landing-teams/working/schneider/test-definitions.git branch: linaro path: automated/linux/network-test/network-test.yaml + + - name: tpm + from: git + history: false + repository: https://git.linaro.org/landing-teams/working/schneider/test-definitions.git + branch: linaro + path: automated/linux/tpm/tpm.yaml |