Use printf instead of "echo -e" or "echo -n".
authorRui Ueyama <ruiu@google.com>
Wed, 26 Oct 2016 01:07:26 +0000 (01:07 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 26 Oct 2016 01:07:26 +0000 (01:07 +0000)
Not all echo commands support "-e". On the other hand, printf
command is in POSIX, so it's more portable than "echo -e".

llvm-svn: 285151

llvm/test/Object/archive-format.test
llvm/test/tools/sanstats/elf.test

index 70458d5..b9562a3 100644 (file)
@@ -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
index 91651bc..ab90b50 100644 (file)
@@ -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