[llvm] r285151 - Use printf instead of "echo -e" or "echo -n".

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 25 18:07:26 PDT 2016


Author: ruiu
Date: Tue Oct 25 20:07:26 2016
New Revision: 285151

URL: http://llvm.org/viewvc/llvm-project?rev=285151&view=rev
Log:
Use printf instead of "echo -e" or "echo -n".

Not all echo commands support "-e". On the other hand, printf
command is in POSIX, so it's more portable than "echo -e".

Modified:
    llvm/trunk/test/Object/archive-format.test
    llvm/trunk/test/tools/sanstats/elf.test

Modified: llvm/trunk/test/Object/archive-format.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Object/archive-format.test?rev=285151&r1=285150&r2=285151&view=diff
==============================================================================
--- llvm/trunk/test/Object/archive-format.test (original)
+++ llvm/trunk/test/Object/archive-format.test Tue Oct 25 20:07:26 2016
@@ -4,11 +4,11 @@ string table or not.
 RUN: mkdir -p %t
 RUN: cd %t
 
-RUN: echo -n bar. > 0123456789abcde
-RUN: echo -n zed. > 0123456789abcdef
+RUN: printf bar. > 0123456789abcde
+RUN: printf zed. > 0123456789abcdef
 RUN: mkdir -p foo
-RUN: echo -n bar2 > foo/0123456789abcde
-RUN: echo -n zed2 > foo/0123456789abcdef
+RUN: printf bar2 > foo/0123456789abcde
+RUN: printf zed2 > foo/0123456789abcdef
 
 RUN: rm -f %t.a
 RUN: llvm-ar --format=gnu rc %t.a 0123456789abcde 0123456789abcdef foo/0123456789abcde foo/0123456789abcdef

Modified: llvm/trunk/test/tools/sanstats/elf.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/sanstats/elf.test?rev=285151&r1=285150&r2=285151&view=diff
==============================================================================
--- llvm/trunk/test/tools/sanstats/elf.test (original)
+++ llvm/trunk/test/tools/sanstats/elf.test Tue Oct 25 20:07:26 2016
@@ -1,27 +1,27 @@
 # RUN: yaml2obj %s > %t1.o
 # RUN: yaml2obj %s > %t2.o
 
-# RUN: echo -ne "\x04" > %t.stats
+# RUN: printf "\x04" > %t.stats
 
-# RUN: echo -n "%t1.o" >> %t.stats
-# RUN: echo -ne "\x00" >> %t.stats
-# RUN: echo -ne "\x01\x00\x00\x00\x01\x00\x00\x00" >> %t.stats
-# RUN: echo -ne "\x11\x00\x00\x00\x02\x00\x00\x20" >> %t.stats
-# RUN: echo -ne "\x21\x00\x00\x00\x03\x00\x00\x40" >> %t.stats
-# RUN: echo -ne "\x01\x00\x00\x00\x04\x00\x00\x60" >> %t.stats
-# RUN: echo -ne "\x11\x00\x00\x00\x05\x00\x00\x80" >> %t.stats
-# RUN: echo -ne "\x21\x00\x00\x00\x06\x00\x00\xa0" >> %t.stats
-# RUN: echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00" >> %t.stats
+# RUN: printf "%%s" "%t1.o" >> %t.stats
+# RUN: printf "\x00" >> %t.stats
+# RUN: printf "\x01\x00\x00\x00\x01\x00\x00\x00" >> %t.stats
+# RUN: printf "\x11\x00\x00\x00\x02\x00\x00\x20" >> %t.stats
+# RUN: printf "\x21\x00\x00\x00\x03\x00\x00\x40" >> %t.stats
+# RUN: printf "\x01\x00\x00\x00\x04\x00\x00\x60" >> %t.stats
+# RUN: printf "\x11\x00\x00\x00\x05\x00\x00\x80" >> %t.stats
+# RUN: printf "\x21\x00\x00\x00\x06\x00\x00\xa0" >> %t.stats
+# RUN: printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> %t.stats
 
-# RUN: echo -n "%t2.o" >> %t.stats
-# RUN: echo -ne "\x00" >> %t.stats
-# RUN: echo -ne "\x21\x00\x00\x00\x07\x00\x00\x00" >> %t.stats
-# RUN: echo -ne "\x11\x00\x00\x00\x08\x00\x00\x20" >> %t.stats
-# RUN: echo -ne "\x01\x00\x00\x00\x09\x00\x00\x40" >> %t.stats
-# RUN: echo -ne "\x21\x00\x00\x00\x0b\x00\x00\x60" >> %t.stats
-# RUN: echo -ne "\x11\x00\x00\x00\x0c\x00\x00\x80" >> %t.stats
-# RUN: echo -ne "\x01\x00\x00\x00\x0e\x00\x00\xa0" >> %t.stats
-# RUN: echo -ne "\x00\x00\x00\x00\x00\x00\x00\x00" >> %t.stats
+# RUN: printf "%%s" "%t2.o" >> %t.stats
+# RUN: printf "\x00" >> %t.stats
+# RUN: printf "\x21\x00\x00\x00\x07\x00\x00\x00" >> %t.stats
+# RUN: printf "\x11\x00\x00\x00\x08\x00\x00\x20" >> %t.stats
+# RUN: printf "\x01\x00\x00\x00\x09\x00\x00\x40" >> %t.stats
+# RUN: printf "\x21\x00\x00\x00\x0b\x00\x00\x60" >> %t.stats
+# RUN: printf "\x11\x00\x00\x00\x0c\x00\x00\x80" >> %t.stats
+# RUN: printf "\x01\x00\x00\x00\x0e\x00\x00\xa0" >> %t.stats
+# RUN: printf "\x00\x00\x00\x00\x00\x00\x00\x00" >> %t.stats
 
 # RUN: sanstats %t.stats | FileCheck %s
 




More information about the llvm-commits mailing list