Skip to content

Commit

Permalink
ENH: fixed failing test with macOS Rosetta emulation by increasing bu…
Browse files Browse the repository at this point in the history
…ffer size

Increased buffer size from 1 MiB to 256 MiB.

Before this, on an arm64 Mac, this test would usually fail when run under Rosetta emulation. No idea why. Probably some caching effect, or other effect of emulation.  Making the buffer bigger seems to allow it to pass always.
  • Loading branch information
seanm authored and hjmjohnson committed Mar 7, 2021
1 parent a44407b commit bca298a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions Modules/Core/Common/test/itkMemoryProbesCollecterBaseTest.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
# else
# include <unistd.h>
inline void
Sleep(unsigned int milleseconds)
Sleep(unsigned int milliseconds)
{
sleep(milleseconds / 1000);
sleep(milliseconds / 1000);
}
# endif
#else
Expand All @@ -36,7 +36,7 @@ Sleep(unsigned int milleseconds)
int
itkMemoryProbesCollecterBaseTest(int, char *[])
{
const size_t mebibyte = 1024L * 1024L;
const size_t bufsize = 256L * 1024L * 1024L; // 256 MiB

itk::MemoryProbesCollectorBase mcollecter;
itk::MemoryProbe probe;
Expand All @@ -47,8 +47,8 @@ itkMemoryProbesCollecterBaseTest(int, char *[])
mcollecter.Clear();
mcollecter.Start("Update");
probe.Start();
auto * buf = new char[mebibyte];
for (unsigned int i = 0; i < mebibyte; i++)
auto * buf = new char[bufsize];
for (unsigned int i = 0; i < bufsize; i++)
{
buf[i] = static_cast<char>(i & 0xff);
}
Expand Down

0 comments on commit bca298a

Please sign in to comment.