diff options
author | Jakub Jelen <jjelen@redhat.com> | 2020-10-07 13:50:58 +0200 |
---|---|---|
committer | Jakub Jelen <jjelen@redhat.com> | 2021-01-04 17:33:22 +0100 |
commit | b2aa029c86ca155b19e6b799306335d6b8329d70 (patch) | |
tree | e475bb79bf56571e0a3eb3891d731f46e90c80f5 | |
parent | b298538fecaa48dd15af295cf962c28ed2ef21f7 (diff) |
Improve non-deterministic test to have lower chance to fail
Signed-off-by: Jakub Jelen <jjelen@redhat.com>
Acked-by: Frediano Ziglio <fziglio@redhat.com>
-rw-r--r-- | src/gp.c | 5 | ||||
-rw-r--r-- | tests/common.c | 11 |
2 files changed, 8 insertions, 8 deletions
@@ -35,8 +35,9 @@ static unsigned char cplp_data[] = { 0x40, 0x21, /* Operating System release date 21. 1. 2014 */ 0x01, 0x01, /* Operating System release level */ 0x07, 0x4F, /* IC Fabrication Date ??? */ - 0x00, 0x19, 0x00, 0x52, /* IC Serial Number */ - 0x89, 0x0E, /* IC Batch Identifier */ + /* The following 6 bytes are filled by unique hash from certificates */ + 0x00, 0x00, 0x00, 0x00, /* IC Serial Number */ + 0x00, 0x00, /* IC Batch Identifier */ 0x47, 0x92, /* IC Module Fabricator */ 0x72, 0x05, /* IC Module Packaging Date 205th day of 2017 */ 0x16, 0x73, /* ICC Manufacturer */ diff --git a/tests/common.c b/tests/common.c index d413017..38a6f89 100644 --- a/tests/common.c +++ b/tests/common.c @@ -908,6 +908,7 @@ void test_gp_applet(void) 0x00, 0xca, 0x9f, 0x7f, 0x00 }; VReader *reader = vreader_get_reader_by_id(0); + unsigned int equal_bytes = 0, n; /* select GP and wait for the response bytes */ select_aid_response(reader, gp_aid, sizeof(gp_aid), 0x1b); @@ -937,12 +938,10 @@ void test_gp_applet(void) g_assert_cmpint(pbRecvBuffer[dwRecvLength-1], ==, 0x00); /* This part should be generate from certificate hash, which should * overwrite default values in template */ - g_assert_cmpint(pbRecvBuffer[15], !=, 0x00); - g_assert_cmpint(pbRecvBuffer[16], !=, 0x19); - g_assert_cmpint(pbRecvBuffer[17], !=, 0x00); - g_assert_cmpint(pbRecvBuffer[18], !=, 0x52); - g_assert_cmpint(pbRecvBuffer[19], !=, 0x89); - g_assert_cmpint(pbRecvBuffer[20], !=, 0x0E); + for (n = 15; n <= 20; ++n) { + equal_bytes += (pbRecvBuffer[n] == 0x00); + } + g_assert_cmpint(equal_bytes, <, 6); vreader_free(reader); /* get by id ref */ } |