summaryrefslogtreecommitdiff
path: root/gnu/packages/patches/ilmbase-fix-test-arm.patch
blob: 2dbc55e8c45ecda2bd7857620b23f5dd9889414b (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
Fix a test failure on ARM platforms:

https://github.com/AcademySoftwareFoundation/openexr/issues/713

Taken from upstream:

https://github.com/AcademySoftwareFoundation/openexr/commit/76d9839cd1b300398f8b801dfcb4bcf2f8c0096f

diff --git a/OpenEXR/IlmImfTest/testHuf.cpp b/OpenEXR/IlmImfTest/testHuf.cpp
index 4c887ee8..a93b8ea9 100644
--- a/OpenEXR/IlmImfTest/testHuf.cpp
+++ b/OpenEXR/IlmImfTest/testHuf.cpp
@@ -181,9 +181,9 @@ compressUncompressSubset(const unsigned short raw[], int n)
 // This DEK hash is determined from an aprior initial run of this
 // test noting its value from the assert message compressVerify().
 // 
-#define  HUF_COMPRESS_DEK_HASH_FOR_FILL4_USHRT_MAX_PLUS_ONE 2956869585U
-#define  HUF_COMPRESS_DEK_HASH_FOR_FILL4_N 3414126535U
-#define  HUF_COMPRESS_DEK_HASH_FOR_FILL5_N 169791374U
+#define  HUF_COMPRESS_DEK_HASH_FOR_FILL4_USHRT_MAX_PLUS_ONE 2013380646U
+#define  HUF_COMPRESS_DEK_HASH_FOR_FILL4_N 213880353U
+#define  HUF_COMPRESS_DEK_HASH_FOR_FILL5_N 2492982090U
 
 void
 compressVerify (const unsigned short raw[], 
@@ -200,7 +200,7 @@ compressVerify (const unsigned short raw[],
     // under the topic of sorting and search chapter 6.4. 
     //
     unsigned int compressedHash = nCompressed;
-    const char* cptr = compressed;
+    const unsigned char* cptr = reinterpret_cast<const unsigned char*>( (const char*) compressed);
     for (int i = 0; i < nCompressed; ++i)
     {
         compressedHash = 
@@ -210,6 +210,25 @@ compressVerify (const unsigned short raw[],
     cout << "verifying compressed checksum hash = " 
         << compressedHash << std::endl;
 
+    if (compressedHash != dekHash)
+    {
+       cout << "hash verification failed. Got " << compressedHash << " expected " << dekHash << std::endl;
+       const unsigned char* cptr = reinterpret_cast<const unsigned char*>( (const char*) compressed);
+       for(int i = 0 ; i < nCompressed ; ++i )
+       {
+           cout << std::hex << (0xFF & (int) (*cptr++));
+           if ( (i & 0xF) ==0 )
+           {
+              cout << '\n';
+           }
+           else
+           {
+              cout << ' ';
+           }
+       }
+       cout << "\n";
+    }
+
     assert (compressedHash == dekHash);
 }