summaryrefslogtreecommitdiff
path: root/test/dfsan
diff options
context:
space:
mode:
authorLorenzo Martignoni <martignlo@google.com>2015-04-10 20:58:28 +0000
committerLorenzo Martignoni <martignlo@google.com>2015-04-10 20:58:28 +0000
commit6f344e9bbc8fa322818b95f5ab35c8ef5ebfe0a9 (patch)
tree4b0515c597f71733047e039316cf67e62d8ea02a /test/dfsan
parent2f764d3535965d5678e5d146588cbe30b3c3aa50 (diff)
Extend s{,n}printf custom wrappers to support '*' in the format specifiers
Differential Revision: http://reviews.llvm.org/D8966 git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@234633 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/dfsan')
-rw-r--r--test/dfsan/custom.cc5
1 files changed, 5 insertions, 0 deletions
diff --git a/test/dfsan/custom.cc b/test/dfsan/custom.cc
index bdd7cf511..057b0608e 100644
--- a/test/dfsan/custom.cc
+++ b/test/dfsan/custom.cc
@@ -870,6 +870,11 @@ void test_sprintf() {
test_sprintf_chunk("z", "%c", 'z');
// %n, %s, %d, %f, and %% already tested
+
+ // Test formatting with width passed as an argument.
+ r = sprintf(buf, "hi %*d my %*s friend %.*f", 3, 1, 6, "dear", 4, 3.14159265359);
+ assert(r == 30);
+ assert(strcmp(buf, "hi 1 my dear friend 3.1416") == 0);
}
void test_snprintf() {