tst_bench_QCryptographicHash: QSKIP unsupported algorithms
With the OpenSSL 3 backend, some algorithms may not be available. Skip benchmarking them. Pick-to: 6.5 Change-Id: I1275332993fe15c007410e25acf59f5e3ec27894 Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
This commit is contained in:
parent
3aaae083f7
commit
f1b264f9ac
@ -87,11 +87,19 @@ void tst_QCryptographicHash::hash_data()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#define SKIP_IF_NOT_SUPPORTED(algo) do { \
|
||||||
|
if (!QCryptographicHash::supportsAlgorithm(algo)) \
|
||||||
|
QSKIP("This algorithm is not supported in this configuration"); \
|
||||||
|
} while (false) \
|
||||||
|
/* end */
|
||||||
|
|
||||||
void tst_QCryptographicHash::hash()
|
void tst_QCryptographicHash::hash()
|
||||||
{
|
{
|
||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
QFETCH(QByteArray, data);
|
QFETCH(QByteArray, data);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
[[maybe_unused]]
|
[[maybe_unused]]
|
||||||
auto r = QCryptographicHash::hash(data, algo);
|
auto r = QCryptographicHash::hash(data, algo);
|
||||||
@ -103,6 +111,8 @@ void tst_QCryptographicHash::addData()
|
|||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
QFETCH(QByteArray, data);
|
QFETCH(QByteArray, data);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
QCryptographicHash hash(algo);
|
QCryptographicHash hash(algo);
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
hash.reset();
|
hash.reset();
|
||||||
@ -117,6 +127,8 @@ void tst_QCryptographicHash::addDataChunked()
|
|||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
QFETCH(QByteArray, data);
|
QFETCH(QByteArray, data);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
QCryptographicHash hash(algo);
|
QCryptographicHash hash(algo);
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
hash.reset();
|
hash.reset();
|
||||||
@ -145,6 +157,8 @@ void tst_QCryptographicHash::hmac_hash()
|
|||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
QFETCH(const QByteArray, data);
|
QFETCH(const QByteArray, data);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
const auto key = hmacKey();
|
const auto key = hmacKey();
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
[[maybe_unused]]
|
[[maybe_unused]]
|
||||||
@ -157,6 +171,8 @@ void tst_QCryptographicHash::hmac_addData()
|
|||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
QFETCH(const QByteArray, data);
|
QFETCH(const QByteArray, data);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
const auto key = hmacKey();
|
const auto key = hmacKey();
|
||||||
QMessageAuthenticationCode mac(algo, key);
|
QMessageAuthenticationCode mac(algo, key);
|
||||||
QBENCHMARK {
|
QBENCHMARK {
|
||||||
@ -181,6 +197,8 @@ void tst_QCryptographicHash::hmac_setKey()
|
|||||||
{
|
{
|
||||||
QFETCH(const Algorithm, algo);
|
QFETCH(const Algorithm, algo);
|
||||||
|
|
||||||
|
SKIP_IF_NOT_SUPPORTED(algo);
|
||||||
|
|
||||||
const QByteArrayList keys = [] {
|
const QByteArrayList keys = [] {
|
||||||
QByteArrayList result;
|
QByteArrayList result;
|
||||||
const auto fullKey = hmacKey();
|
const auto fullKey = hmacKey();
|
||||||
@ -199,6 +217,7 @@ void tst_QCryptographicHash::hmac_setKey()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#undef SKIP_IF_NOT_SUPPORTED
|
||||||
|
|
||||||
QTEST_APPLESS_MAIN(tst_QCryptographicHash)
|
QTEST_APPLESS_MAIN(tst_QCryptographicHash)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user