Chromium Code Reviews| Index: tests/tpm_lite/timing.c |
| diff --git a/tests/tpm_lite/timing.c b/tests/tpm_lite/timing.c |
| index 9300d0ccaace68b1dc9a6f1d6d7a5a2a1e9600d7..d18ce05b0df74a363e702405da083c1272bd70e7 100644 |
| --- a/tests/tpm_lite/timing.c |
| +++ b/tests/tpm_lite/timing.c |
| @@ -29,7 +29,6 @@ |
| __result = op; \ |
| if (__result != TPM_SUCCESS) { \ |
| printf(#op ": error 0x%x\n", __result); \ |
|
Randall Spangler
2011/02/08 23:03:44
Suggest incrementing an errors count here.
errors
|
| - exit(1); \ |
| } \ |
| gettimeofday(&after, NULL); \ |
| time = (int) ((after.tv_sec - before.tv_sec) * 1000 + \ |
| @@ -37,15 +36,17 @@ |
| printf(#op ": %d ms\n", time); \ |
| if (time > time_limit) { \ |
| printf(#op " exceeded " #time_limit " ms\n"); \ |
| - exit(1); \ |
| + time_limit_exceeded = 1; \ |
| } \ |
| } while (0) |
| int main(int argc, char** argv) { |
| uint32_t x; |
| uint8_t in[20], out[20]; |
| + int time_limit_exceeded = 0; |
|
Randall Spangler
2011/02/08 23:03:44
int errors = 0;
|
| TlclLibInit(); |
| + TTPM_CHECK(0, 50); |
| TTPM_CHECK(TlclStartupIfNeeded(), 50); |
| TTPM_CHECK(TlclContinueSelfTest(), 100); |
| TTPM_CHECK(TlclSelfTestFull(), 1000); |
| @@ -55,6 +56,11 @@ int main(int argc, char** argv) { |
| TTPM_CHECK(TlclExtend(0, in, out), 200); |
| TTPM_CHECK(TlclSetGlobalLock(), 50); |
| TTPM_CHECK(TlclLockPhysicalPresence(), 100); |
| - printf("TEST SUCCEEDED\n"); |
| - return 0; |
| + if (time_limit_exceeded) { |
|
Randall Spangler
2011/02/08 23:03:44
if (time_limit_exceeded || errors > 0)
This way y
|
| + printf("TEST FAILED\n"); |
| + exit(1); |
| + } else { |
| + printf("TEST SUCCEEDED\n"); |
| + return 0; |
| + } |
| } |