diff --git a/tests/file/filetest.cpp b/tests/file/filetest.cpp index 9692bd3c60..d418362875 100644 --- a/tests/file/filetest.cpp +++ b/tests/file/filetest.cpp @@ -156,14 +156,16 @@ TEST_CASE("wxFile::Special", "[file][linux][special-file]") CHECK( fileProc.ReadAll(&s) ); CHECK( !s.empty() ); - // All files in /sys seem to have size of 4KiB currently, even if they - // don't have that much data in them. + // All files in /sys have the size of one kernel page, even if they don't + // have that much data in them. + const long pageSize = sysconf(_SC_PAGESIZE); + wxFile fileSys("/sys/power/state"); - CHECK( fileSys.Length() == sysconf(_SC_PAGESIZE) ); + CHECK( fileSys.Length() == pageSize ); CHECK( fileSys.IsOpened() ); CHECK( fileSys.ReadAll(&s) ); CHECK( !s.empty() ); - CHECK( s.length() < 4096 ); + CHECK( s.length() < pageSize ); } #endif // __LINUX__ diff --git a/tests/filename/filenametest.cpp b/tests/filename/filenametest.cpp index 2928b8d4cb..1db0edc52d 100644 --- a/tests/filename/filenametest.cpp +++ b/tests/filename/filenametest.cpp @@ -1059,7 +1059,8 @@ TEST_CASE("wxFileName::GetSizeSpecial", "[filename][linux][special-file]") INFO( "size of /proc/kcore=" << size ); CHECK( size > 0 ); - // All files in /sys seem to have size of 4KiB currently. + // All files in /sys are one page in size, irrespectively of the size of + // their actual contents. CHECK( wxFileName::GetSize("/sys/power/state") == sysconf(_SC_PAGESIZE) ); }