Fix test suite on Linux/s390x and maybe other architectures

We can't rely on file /sys/power/state always existing, so just skip the
test (with a warning) instead of failing it if it does not exist, as is
the case at least under s390x and seemingly other non-desktop platforms.

Closes #24197.

Co-authored-by: Cliff Zhao <qzhao@suse.com>
This commit is contained in:
Vadim Zeitlin 2024-01-09 02:38:43 +01:00
parent e38a61a09b
commit e2cc16ef9c
3 changed files with 19 additions and 2 deletions

View file

@ -336,12 +336,18 @@ TEST_CASE("wxTextFile::Special", "[textfile][linux][special-file]")
SECTION("/proc")
{
wxTextFile f;
CHECK( f.Open("/proc/cpuinfo") );
REQUIRE( f.Open("/proc/cpuinfo") );
CHECK( f.GetLineCount() > 1 );
}
SECTION("/sys")
{
if ( wxFile::Exists("/sys/power/state") )
{
WARN("/sys/power/state doesn't exist, skipping test");
return;
}
wxTextFile f;
CHECK( f.Open("/sys/power/state") );
REQUIRE( f.GetLineCount() == 1 );