From ea2170fd2076a7b693eaf50340a8d0a9087dfda1 Mon Sep 17 00:00:00 2001 From: Brian Cox Date: Tue, 21 Mar 2017 23:36:26 -0700 Subject: [PATCH] Tweak a memory alignment unit test that doesn't (and should not be expected to) work on HP-UX. --- src/twtest/platform_t.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/twtest/platform_t.cpp b/src/twtest/platform_t.cpp index bf8cf2d..742fb24 100644 --- a/src/twtest/platform_t.cpp +++ b/src/twtest/platform_t.cpp @@ -85,6 +85,13 @@ void TestPlatform() template AlignMe::AlignMe() { +// HP-UX does not play your silly alignment games, at least unless you +// first invoke something called "allow_unaligned_data_access()", which +// apparently incurs a substantial perf penalty. Luckily we don't appear +// to have any need for that behavior, which begs the question of why +// this test exists in the first place. +// -bcox +#if (!IS_HPUX) TCOUT << _T("Testing alignment of size ") << ALIGN_SIZE << std::endl; // access a double in the byte array to see if it is aligned. if it isn't and the CPU @@ -101,6 +108,7 @@ AlignMe::AlignMe() *pi = i; // access memory for write TCOUT << _T("Write succeeded.") << std::endl; + // this should choke if the CPU can't // handle misaligned memory access int64* pb = (int64*)&a[ALIGN_SIZE]; @@ -111,6 +119,7 @@ AlignMe::AlignMe() TCOUT << _T("Writing...") << std::endl; *pb = I; // access memory for write TCOUT << _T("Write succeeded.") << std::endl; +#endif TCOUT << _T("Alignment of ") << ALIGN_SIZE << _T(" ") << ( ALIGN_SIZE == 1 ? _T("byte") : _T("bytes") ) << _T(" is OK") << std::endl << _T("=========================================\n");