[test] do not parse ls output for file size; NFCI

Parsing `ls -l` output to obtain the size of a file is unreliable; the
exact output format is not specified, and some user or group names may
contain multiple words, causing `cut -f5 -d' '` to extract an incorrect
value. `wc -c`, on the other hand, is portable, and there are precendents
of its use in test cases.
This commit is contained in:
Bryan Chan 2019-12-27 17:26:24 -05:00
parent 4369417d82
commit da1328600f
2 changed files with 3 additions and 3 deletions

View File

@ -1,5 +1,5 @@
; RUN: llvm-profdata merge -sample -extbinary -prof-sym-list=%S/Inputs/profile-symbol-list-1.text %S/Inputs/sample-profile.proftext -o %t.1.output
; RUN: ls -l %t.1.output |tr -s ' ' |cut -f5 -d ' ' > %t.txt
; RUN: wc -c < %t.1.output > %t.txt
; RUN: llvm-profdata show -sample -show-sec-info-only %t.1.output >> %t.txt
; RUN: FileCheck %s --input-file=%t.txt
; Check llvm-profdata shows the correct file size.

View File

@ -71,8 +71,8 @@ Sections:
## of the first SHT_NULL section.
# RUN: yaml2obj --docnum=4 %s -o %t4
# RUN: ls -l %t3 | tr -s ' ' | cut -d ' ' -f 5 > %t.txt
# RUN: ls -l %t4 | tr -s ' ' | cut -d ' ' -f 5 >> %t.txt
# RUN: wc -c < %t3 > %t.txt
# RUN: wc -c < %t4 >> %t.txt
# RUN: FileCheck %s --input-file=%t.txt --check-prefix=SIZE
# SIZE: [[FILESIZE:.*]]