summaryrefslogtreecommitdiff
path: root/tests/tpm_lite/tpmtest_fastenable.c
diff options
context:
space:
mode:
authorJoel Kitching <kitching@google.com>2019-09-11 14:15:45 +0800
committerCommit Bot <commit-bot@chromium.org>2019-09-23 05:18:07 +0000
commitaaf394335cc4e287a1ffb6332311559b2b29c41f (patch)
tree3d552e3e22f530ba564654b6979a4009fbd53d68 /tests/tpm_lite/tpmtest_fastenable.c
parentd3efd73cbb1fb5cf133739622fe0bd49653fad2e (diff)
downloadvboot-aaf394335cc4e287a1ffb6332311559b2b29c41f.tar.gz
vboot: add VB2_ASSERT and VB2_DIE macros
Sometimes vboot needs to make assertions to work sanely without always having to return VB2_ERROR_* values. Add VB2_ASSERT and VB2_DIE macros to deal with these cases. Convert existing VbAssert macro to use either VB2_ASSERT or TEST_* macros depending on the case. Implement testing infrastructure to check that aborts are being triggered correctly. The TEST_ASSERT macro should be used. BUG=b:124141368, chromium:1005700 TEST=make clean && make runtests BRANCH=none Change-Id: I298384ba50842a94a311df7f868f807bf2109cff Signed-off-by: Joel Kitching <kitching@google.com> Cq-Depend: chromium:1813277 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1800112 Tested-by: Joel Kitching <kitching@chromium.org> Reviewed-by: Julius Werner <jwerner@chromium.org> Commit-Queue: Joel Kitching <kitching@chromium.org>
Diffstat (limited to 'tests/tpm_lite/tpmtest_fastenable.c')
-rw-r--r--tests/tpm_lite/tpmtest_fastenable.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/tests/tpm_lite/tpmtest_fastenable.c b/tests/tpm_lite/tpmtest_fastenable.c
index 72989c1d..a93dfd77 100644
--- a/tests/tpm_lite/tpmtest_fastenable.c
+++ b/tests/tpm_lite/tpmtest_fastenable.c
@@ -15,6 +15,7 @@
#include <stdio.h>
#include "host_common.h"
+#include "test_common.h"
#include "tlcl.h"
#include "tlcl_tests.h"
@@ -33,12 +34,14 @@ int main(int argc, char** argv) {
TPM_CHECK(TlclForceClear());
TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
printf("disable is %d, deactivated is %d\n", disable, deactivated);
- VbAssert(disable == 1 && deactivated == 1);
+ TEST_EQ(disable, 1, "after ForceClear, disable");
+ TEST_EQ(deactivated, 1, "after ForceClear, deactivated");
TPM_CHECK(TlclSetEnable());
TPM_CHECK(TlclSetDeactivated(0));
TPM_CHECK(TlclGetFlags(&disable, &deactivated, NULL));
printf("disable is %d, deactivated is %d\n", disable, deactivated);
- VbAssert(disable == 0 && deactivated == 0);
+ TEST_EQ(disable, 0, "after SetEnable, enabled");
+ TEST_EQ(deactivated, 0, "after SetDeactivated(0), activated");
}
printf("TEST SUCCEEDED\n");