This allow tests to opt out of pkcs11testmodule's current cyclic token
insertions and removals, which is useful for some tests, but an annoyance for
others.
MozReview-Commit-ID: 790uzLZkdtN
The string fields need to be padded with spaces, according to what
PK11_MakeString does to find the end of the string.
While here, factor all the string manipulations in the test module and
use some C++ template magic to do the right thing.
This changes the static asserts from (with clang):
pkcs11testmodule.cpp:45:3: error: static_assert failed
"TestManufacturerID too long - make it shorter"
static_assert(sizeof(TestManufacturerID) <= sizeof(pInfo->manufacturerID),
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
to:
pkcs11testmodule.cpp:46:3: error: static_assert failed
"DestSize >= SrcSize - 1"
static_assert(DestSize >= SrcSize - 1, "DestSize >= SrcSize - 1");
^ ~~~~~~~~~~~~~~~~~~~~~~~
pkcs11testmodule.cpp:58:3: note: in instantiation of function
template specialization 'CopyString<32, 63>' requested here
CopyString(pInfo->manufacturerID, TestManufacturerID);
^
which actually gives more information than before: it gives the length of
both buffers.