[PATCH] D20466: [MC/ELF] - Fixed incorrect compression.s test

George Rimar via llvm-commits llvm-commits at lists.llvm.org
Fri May 20 03:14:11 PDT 2016


grimar created this revision.
grimar added reviewers: rafael, davide, dblaikie.
grimar added subscribers: llvm-commits, grimar.

This test looks to be incorrect. 
Main problem that .debug_info
section was used to check that llvm-dwarfdump is able to decompress
data that was compressed with llvm-mc tool.

That was probably not noticable, so I slightly refactored whole one,
so test checkcases shows the internals in more obvious way now.

I changed testcase to use .debug_str section which is one that
is really compressed. So currently test do what is probably was expected to do:
checks that "data"->llvm-mc->llvm-dwarfdump->dumps back initial "data".


http://reviews.llvm.org/D20466

Files:
  compression.s

Index: compression.s
===================================================================
--- compression.s
+++ compression.s
@@ -1,30 +1,37 @@
 // RUN: llvm-mc -filetype=obj -compress-debug-sections -triple x86_64-pc-linux-gnu < %s -o %t
 // RUN: llvm-objdump -s %t | FileCheck %s
-// RUN: llvm-dwarfdump -debug-dump=info %t | FileCheck --check-prefix=INFO %s
+// RUN: llvm-dwarfdump -debug-dump=str %t | FileCheck --check-prefix=STR %s
 // RUN: llvm-mc -filetype=obj -compress-debug-sections -triple i386-pc-linux-gnu < %s \
 // RUN:     | llvm-readobj -symbols - | FileCheck --check-prefix=386-SYMBOLS %s
 
 // REQUIRES: zlib
 
-// CHECK: Contents of section .zdebug_line:
-// Check for the 'ZLIB' file magic at the start of the section only
-// CHECK-NEXT: ZLIB
-// CHECK-NOT: ZLIB
-
-// Don't compress small sections, such as this simple debug_abbrev example
-// CHECK: Contents of section .debug_abbrev:
-// CHECK-NOT: ZLIB
-// CHECK-NOT: Contents of
-
-// CHECK: Contents of section .debug_info:
-
+// Check what happens with debug sections. Small ones are not compressed, so
+// using of compression should not make result larger
 // FIXME: Handle compressing alignment fragments to support compressing debug_frame
-// CHECK: Contents of section .debug_frame:
-// CHECK-NOT: ZLIB
-// CHECK: Contents of
-
-// Decompress one valid dwarf section just to check that this roundtrips
-// INFO: 0x00000000: Compile Unit: length = 0x0000000c version = 0x0004 abbr_offset = 0x0000 addr_size = 0x08 (next unit at 0x00000010)
+//
+// CHECK:      Contents of section .zdebug_line:
+// CHECK-NEXT:  0000 5a4c4942 00000000 00000041 789cb365  ZLIB.......Ax..e
+// CHECK-NEXT:  0010 60606062 5000928c 8cbff978 81242323  ```bP......x.$##
+// CHECK-NEXT:  0020 8803422e 459965a9 457a9999 0c60c0c9  ..B.E.e.Ez...`..
+// CHECK-NEXT:  0030 c40005c2 8a60c0c4 08540e00 cbdf05d3  .....`...T......
+// CHECK:      Contents of section .debug_abbrev:
+// CHECK-NEXT:  0000 0111001b 0e0000                      .......
+// CHECK:      Contents of section .debug_info:
+// CHECK-NEXT:  0000 0c000000 04000000 00000801 00000000  ................
+// CHECK:      Contents of section .zdebug_str:
+// CHECK-NEXT:  0000 5a4c4942 00000000 0000004d 789c2b48  ZLIB.......Mx.+H
+// CHECK-NEXT:  0010 2d4a4b4d 2ec9a954 48cecf2d 284a2d2e  -JKM...TH..-(J-.
+// CHECK-NEXT:  0020 4e4cca49 5548492c 4954284e cc2d00b2  NL.IUHI,IT(N.-..
+// CHECK-NEXT:  0030 b588050c 00c17e14 25                 ......~.%
+// CHECK:      Contents of section .debug_frame:
+// CHECK-NEXT:  0000 14000000 ffffffff 04000800 0178100c  .............x..
+// CHECK-NEXT:  0010 07089001 00000000 14000000 00000000  ................
+// CHECK-NEXT:  0020 00000000 00000000 07000000 00000000  ................
+
+// Decompress one valid dwarf section just to check that this roundtrips,
+// we use .zdebug_str section for that
+// STR: perfectly compressable data sample *****************************************
 
 // In x86 32 bit named symbols are used for temporary symbols in merge
 // sections, so make sure we handle symbols inside compressed sections
@@ -74,6 +81,9 @@
 	.cfi_endproc
 	.cfi_sections .debug_frame
 
+# Below is the section we will use to check that after compression with llvm-mc,
+# llvm-dwarfdump tool will be able to decompress data back and dump it. Data sample
+# should be compressable enough, so it is filled with some amount of equal symbols at the end
 	.section        .debug_str,"MS", at progbits,1
 .Linfo_string0:
-        .asciz  "compress this                                    "
+        .asciz  "perfectly compressable data sample *****************************************"


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D20466.57920.patch
Type: text/x-patch
Size: 3651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160520/46ad6f8e/attachment.bin>


More information about the llvm-commits mailing list