File wxWidgets-3_2-Fix-test-suite-on-Linux-s390x-architectures.patch of Package wxWidgets-3_2

commit e2cc16ef9c45bdc64d42e4fef4dda46a3077cb35
Author: Vadim Zeitlin <vadim@wxwidgets.org>
Date:   Tue Jan 9 02:38:43 2024 +0100

    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>

diff -Nura wxWidgets-3.2.4/tests/file/filetest.cpp wxWidgets-3.2.4_new/tests/file/filetest.cpp
--- wxWidgets-3.2.4/tests/file/filetest.cpp	2023-11-09 06:53:55.000000000 +0800
+++ wxWidgets-3.2.4_new/tests/file/filetest.cpp	2024-01-24 17:12:00.649890837 +0800
@@ -158,8 +158,13 @@
     const long pageSize = sysconf(_SC_PAGESIZE);
 
     wxFile fileSys("/sys/power/state");
+    if ( !fileSys.IsOpened() )
+    {
+        WARN("/sys/power/state can't be opened, skipping test");
+        return;
+    }
+
     CHECK( fileSys.Length() == pageSize );
-    CHECK( fileSys.IsOpened() );
     CHECK( fileSys.ReadAll(&s) );
     CHECK( !s.empty() );
     CHECK( s.length() < pageSize );
diff -Nura wxWidgets-3.2.4/tests/filename/filenametest.cpp wxWidgets-3.2.4_new/tests/filename/filenametest.cpp
--- wxWidgets-3.2.4/tests/filename/filenametest.cpp	2023-11-09 06:53:55.000000000 +0800
+++ wxWidgets-3.2.4_new/tests/filename/filenametest.cpp	2024-01-24 17:13:36.039991014 +0800
@@ -1040,6 +1040,12 @@
     INFO( "size of /proc/kcore=" << size );
     CHECK( size > 0 );
 
+    if ( !wxFile::Exists("/sys/power/state") )
+    {
+        WARN("/sys/power/state doesn't exist, skipping test");
+        return;
+    }
+
     // 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) );
diff -Nura wxWidgets-3.2.4/tests/textfile/textfiletest.cpp wxWidgets-3.2.4_new/tests/textfile/textfiletest.cpp
--- wxWidgets-3.2.4/tests/textfile/textfiletest.cpp	2023-11-09 06:53:55.000000000 +0800
+++ wxWidgets-3.2.4_new/tests/textfile/textfiletest.cpp	2024-01-24 17:15:03.777002930 +0800
@@ -344,12 +344,18 @@
     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 );
openSUSE Build Service is sponsored by