[llvm] r286914 - llvm-strings: support the `-n` option

Filipe Cabecinhas via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 15 15:31:12 PST 2016


`sed` is failing on some buildbots:

http://lab.llvm.org:8011/builders/clang-ppc64be-linux/builds/1038
http://lab.llvm.org:8011/builders/llvm-clang-lld-x86_64-scei-ps4-ubuntu-fast/builds/1346

Both with:

Command Output (stderr):
--
sed: couldn't flush stdout: Broken pipe

Thank you,
  Filipe


On Tue, Nov 15, 2016 at 11:55 AM, Filipe Cabecinhas <filcab at gmail.com> wrote:
> On Tue, Nov 15, 2016 at 2:16 AM, Meador Inge via llvm-commits
> <llvm-commits at lists.llvm.org> wrote:
>> On Tue, Nov 15, 2016 at 12:43:52AM +0000, Saleem Abdulrasool via llvm-commits wrote:
>>
>>> Added: llvm/trunk/test/tools/llvm-strings/length.test
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-strings/length.test?rev=286914&view=auto
>>> ==============================================================================
>>> --- llvm/trunk/test/tools/llvm-strings/length.test (added)
>>> +++ llvm/trunk/test/tools/llvm-strings/length.test Mon Nov 14 18:43:52 2016
>>> @@ -0,0 +1,24 @@
>>> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings | FileCheck --check-prefix CHECK-DEFAULT %s
>>> +RUN: sed -n 's/^STDIN: //p' %s | not llvm-strings -n 0 2>&1 | FileCheck --check-prefix CHECK-0 %s
>>> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings -n 1 | FileCheck --check-prefix CHECK-1 %s
>>> +RUN: sed -n 's/^STDIN: //p' %s | llvm-strings -n 2 | FileCheck --check-prefix CHECK-2 %s
>>
>> Another option is `echo -e 'a\nbc\ndef\nghij'`.
>
> Not portable. I think `printf 'a\nbc\ndef\nghij\n'` should be, though.
> And much better than sed.
>
>>> Modified: llvm/trunk/tools/llvm-strings/llvm-strings.cpp
>>> URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-strings/llvm-strings.cpp?rev=286914&r1=286913&r2=286914&view=diff
>>> ==============================================================================
>>> --- llvm/trunk/tools/llvm-strings/llvm-strings.cpp (original)
>>> +++ llvm/trunk/tools/llvm-strings/llvm-strings.cpp Mon Nov 14 18:43:52 2016
>>> @@ -35,8 +35,15 @@ static cl::opt<bool>
>>>  static cl::alias PrintFileNameShort("f", cl::desc(""),
>>>                                      cl::aliasopt(PrintFileName));
>>>
>>> +static cl::opt<int>
>>> +    MinLength("bytes", cl::desc("Print sequences of the specified length"),
>>> +              cl::init(4));
>>
>> Isn't this really to print sequences of *at least* the specified length?
>>
>> --
>> Meador Inge
>> meadori at codesourcery.com
>> CodeSourcery / Mentor Embedded
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at lists.llvm.org
>> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits


More information about the llvm-commits mailing list