ESYS TEST: Fix checking of esys return values.
* Return values of optional commands are checked to skip this
tests if the commands are not available.
* Return values of commands with platform authorization are checked
to skip this tests if platform hierarchy is disabled
* Only EXIT_SUCCESS (0), EXIT_FAILURE (1), or EXIT_SKIP(77)
will be returned by the test function. Erroneously return codes
of esys commands were returned before.
Signed-off-by: Juergen Repp <Juergen.Repp@sit.fraunhofer.de>
diff --git a/test/integration/esys-pcr-basic.int.c b/test/integration/esys-pcr-basic.int.c
index b547d86..877da6f 100644
--- a/test/integration/esys-pcr-basic.int.c
+++ b/test/integration/esys-pcr-basic.int.c
@@ -4,6 +4,8 @@
* All rights reserved.
*******************************************************************************/
+#include <stdlib.h>
+
#include "tss2_esys.h"
#include "esys_iutil.h"
@@ -18,7 +20,7 @@
int
test_invoke_esapi(ESYS_CONTEXT * esys_context)
{
- uint32_t r = 0;
+ TSS2_RC r;
ESYS_TR pcrHandle_handle = 16;
TPML_DIGEST_VALUES digests
@@ -114,11 +116,16 @@
&sizeNeeded,
&sizeAvailable);
+ if (r == (TPM2_RC_BAD_AUTH | TPM2_RC_S | TPM2_RC_1)) {
+ /* Platform authorization not possible test will be skipped */
+ LOG_WARNING("Platform authorization not possible.");
+ }
+
goto_if_error(r, "Error: PCR_Allocate", error);
- return 0;
+ return EXIT_SUCCESS;
error:
- return 1;
+ return EXIT_FAILURE;
}