From 0568983fab8c1471085eb20d11d37bf52f21634b Mon Sep 17 00:00:00 2001 From: Jeremy Kerr Date: Wed, 13 Jun 2012 17:25:47 +0800 Subject: [PATCH] tests: Add tests for missing image, cert & key files Currently causes a segfault in verify-missing-image.sh. Signed-off-by: Jeremy Kerr --- tests/Makefile.am | 7 ++++++- tests/sign-missing-cert.sh | 12 ++++++++++++ tests/sign-missing-image.sh | 12 ++++++++++++ tests/sign-missing-key.sh | 12 ++++++++++++ tests/verify-missing-cert.sh | 14 ++++++++++++++ tests/verify-missing-image.sh | 12 ++++++++++++ 6 files changed, 68 insertions(+), 1 deletion(-) create mode 100755 tests/sign-missing-cert.sh create mode 100755 tests/sign-missing-image.sh create mode 100755 tests/sign-missing-key.sh create mode 100755 tests/verify-missing-cert.sh create mode 100755 tests/verify-missing-image.sh diff --git a/tests/Makefile.am b/tests/Makefile.am index 8c16178..29adb2c 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -37,7 +37,12 @@ $(test_cert): $(test_key) Makefile TESTS = sign-verify.sh \ sign-verify-detached.sh \ - sign-attach-verify.sh + sign-attach-verify.sh \ + sign-missing-image.sh \ + sign-missing-cert.sh \ + sign-missing-key.sh \ + verify-missing-image.sh \ + verify-missing-cert.sh EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS) CLEANFILES = $(test_key) $(test_cert) $(test_image) diff --git a/tests/sign-missing-cert.sh b/tests/sign-missing-cert.sh new file mode 100755 index 0000000..42fc548 --- /dev/null +++ b/tests/sign-missing-cert.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +signed="test.signed" + +set +e +"$sbsign" --cert "missing-cert" --key "$key" --output "$signed" "$image" +rc=$? +set -e + +test $rc -eq 1 diff --git a/tests/sign-missing-image.sh b/tests/sign-missing-image.sh new file mode 100755 index 0000000..e685ca1 --- /dev/null +++ b/tests/sign-missing-image.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +signed="test.signed" + +set +e +"$sbsign" --cert "$cert" --key "$key" --output "$signed" "missing-image" +rc=$? +set -e + +test $rc -eq 1 diff --git a/tests/sign-missing-key.sh b/tests/sign-missing-key.sh new file mode 100755 index 0000000..d9dceb5 --- /dev/null +++ b/tests/sign-missing-key.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +signed="test.signed" + +set +e +"$sbsign" --cert "$cert" --key "missing-key" --output "$signed" "$image" +rc=$? +set -e + +test $rc -eq 1 diff --git a/tests/verify-missing-cert.sh b/tests/verify-missing-cert.sh new file mode 100755 index 0000000..cb4fcab --- /dev/null +++ b/tests/verify-missing-cert.sh @@ -0,0 +1,14 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +signed="test.signed" + +"$sbsign" --cert "$cert" --key "$key" --output "$signed" "$image" + +set +e +"$sbverify" --cert "missing-cert" "$signed" +rc=$? +set -e + +test $rc -eq 1 diff --git a/tests/verify-missing-image.sh b/tests/verify-missing-image.sh new file mode 100755 index 0000000..cf0652c --- /dev/null +++ b/tests/verify-missing-image.sh @@ -0,0 +1,12 @@ +#!/bin/bash -e + +. "$srcdir/common.sh" + +signed="test.signed" + +set +e +"$sbverify" "missing-image" +rc=$? +set -e + +test $rc -eq 1