diff options
author | Jack Lloyd <[email protected]> | 2019-01-28 15:13:59 -0500 |
---|---|---|
committer | Jack Lloyd <[email protected]> | 2019-01-30 19:28:39 -0500 |
commit | d9a5ffe01f33d509afac68563dbb26a9dc8b9ef6 (patch) | |
tree | af3605c57ef457a2987b842908f702966082ec97 /src/tests | |
parent | 8c835b3b1238083c4b4bb4a90e4d9e9b38dffb11 (diff) |
Refactor CPUID to make it thread safe
Needed for #1819 and unfortunately Windows does not allow thread local
data to be stored as a member of a DLL exported class. So hide it
behind an accessor function instead.
This slows down CPUID test somewhat and I would like to address that
but it seems hard without breaking the CPUID API, which is for better
or worse public.
Diffstat (limited to 'src/tests')
-rw-r--r-- | src/tests/test_utils.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/tests/test_utils.cpp b/src/tests/test_utils.cpp index de9db6683..52d10058b 100644 --- a/src/tests/test_utils.cpp +++ b/src/tests/test_utils.cpp @@ -976,6 +976,12 @@ class CPUID_Tests final : public Test result.test_eq("If endian is big, it is not also little endian", Botan::CPUID::is_little_endian(), false); } + const size_t cache_line_size = Botan::CPUID::cache_line_size(); + + result.test_gte("Cache line size is >= 16", cache_line_size, 16); + result.test_lte("Cache line size is <= 256", cache_line_size, 256); + result.confirm("Cache line size is a power of 2", Botan::is_power_of_2(cache_line_size)); + const std::string cpuid_string = Botan::CPUID::to_string(); result.test_success("CPUID::to_string doesn't crash"); |