summaryrefslogtreecommitdiff
path: root/test/sanitizer_common
diff options
context:
space:
mode:
authorVitaly Buka <vitalybuka@google.com>2018-03-07 00:14:30 +0000
committerVitaly Buka <vitalybuka@google.com>2018-03-07 00:14:30 +0000
commite6fe6d618bcd23f8baa1d3b2bb38f236c019ba2d (patch)
treed6b17aedc134d41bdf2be96e27175fa06a08b3cd /test/sanitizer_common
parent4f09499dc766ec4ce5170f4553a6951a5e063c29 (diff)
[sanitizer] Move strxfrm interceptors into sanitizer_common
git-svn-id: https://llvm.org/svn/llvm-project/compiler-rt/trunk@326853 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/sanitizer_common')
-rw-r--r--test/sanitizer_common/TestCases/Posix/strxfrm.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/sanitizer_common/TestCases/Posix/strxfrm.c b/test/sanitizer_common/TestCases/Posix/strxfrm.c
new file mode 100644
index 000000000..8d067caf9
--- /dev/null
+++ b/test/sanitizer_common/TestCases/Posix/strxfrm.c
@@ -0,0 +1,19 @@
+// RUN: %clang -O0 %s -o %t && %run %t
+
+#include <assert.h>
+#include <locale.h>
+#include <wchar.h>
+
+int main(int argc, char **argv) {
+ char q[10];
+ size_t n = strxfrm(q, "abcdef", sizeof(q));
+ assert(n < sizeof(q));
+
+ char q2[10];
+ locale_t loc = newlocale(LC_ALL_MASK, "", (locale_t)0);
+ n = strxfrm_l(q2, L"qwerty", sizeof(q), loc);
+ assert(n < sizeof(q2));
+
+ freelocale(loc);
+ return 0;
+}