tests: Add tests for missing image, cert & key files

Currently causes a segfault in verify-missing-image.sh.

Signed-off-by: Jeremy Kerr <jeremy.kerr@canonical.com>
This commit is contained in:
Jeremy Kerr 2012-06-13 17:25:47 +08:00
parent b3edb1fb72
commit 0568983fab
6 changed files with 68 additions and 1 deletions

View file

@ -37,7 +37,12 @@ $(test_cert): $(test_key) Makefile
TESTS = sign-verify.sh \ TESTS = sign-verify.sh \
sign-verify-detached.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) EXTRA_DIST = $(test_lds) test.S $(TESTS) $(check_SCRIPTS)
CLEANFILES = $(test_key) $(test_cert) $(test_image) CLEANFILES = $(test_key) $(test_cert) $(test_image)

12
tests/sign-missing-cert.sh Executable file
View file

@ -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

12
tests/sign-missing-image.sh Executable file
View file

@ -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

12
tests/sign-missing-key.sh Executable file
View file

@ -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

14
tests/verify-missing-cert.sh Executable file
View file

@ -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

12
tests/verify-missing-image.sh Executable file
View file

@ -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