[llvm] [llvm-strings] Use small buffer instead of reading whole file (PR #163073)

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 24 01:56:11 PDT 2026


================
@@ -51,57 +43,28 @@
 ## before the chunk start and one after its end. The string is printed
 ## intact, once. The expected output is generated rather than written as a
 ## CHECK line because it is a chunk long.
-# RUN: %python %s 16383 S M at 16384 E 4 > %t.6
-# RUN: %python %s --line S M at 16384 E > %t.6.expected
+# RUN: printf "%16383sS%.16384dE%4s" | tr " " "\0" > %t.6
+# RUN: printf "S%.16384dE\n" > %t.6.expected
 # RUN: llvm-strings %t.6 > %t.6.out
 # RUN: diff %t.6.expected %t.6.out
 
 ## Case 7: the minimum length is greater than the chunk size, so a candidate
 ## has to be buffered across more than one chunk before it is known to be long
 ## enough. A run of exactly the minimum length is printed, with the offset of
 ## its start, which lies in an earlier chunk than the one where it is printed.
-# RUN: %python %s 8 A at 20000 4 > %t.7
-# RUN: %python %s --line --offset=8 A at 20000 > %t.7.expected
+# RUN: printf "%8s%.20000d%4s" | tr " " "\0" > %t.7
+# RUN: printf "      8 %.20000d\n" > %t.7.expected
----------------
jh7370 wrote:

Are these `printf` statements actually generating the data you expect? I would expect this to produce a 20000 block of 0s (to match the minimum length), but when I open the file in my text editor, I only see 512...

https://github.com/llvm/llvm-project/pull/163073


More information about the llvm-commits mailing list