[compiler-rt] 121798f - [sanitizer] Fix dn_expand test

Vitaly Buka via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 6 18:46:13 PDT 2022


Author: Vitaly Buka
Date: 2022-07-06T18:46:04-07:00
New Revision: 121798fdb5561bc8e9c6a56d18a7edc7b7d2d53d

URL: https://github.com/llvm/llvm-project/commit/121798fdb5561bc8e9c6a56d18a7edc7b7d2d53d
DIFF: https://github.com/llvm/llvm-project/commit/121798fdb5561bc8e9c6a56d18a7edc7b7d2d53d.diff

LOG: [sanitizer] Fix dn_expand test

res is not the size of expanded string.

Added: 
    

Modified: 
    compiler-rt/test/msan/Linux/dn_expand.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/test/msan/Linux/dn_expand.cpp b/compiler-rt/test/msan/Linux/dn_expand.cpp
index a7b2b37562edd..79399bf22c231 100644
--- a/compiler-rt/test/msan/Linux/dn_expand.cpp
+++ b/compiler-rt/test/msan/Linux/dn_expand.cpp
@@ -17,7 +17,8 @@ void testWrite() {
                       sizeof(output));
 
   assert(res >= 0);
-  __msan_check_mem_is_initialized(output, res);
+  assert(strlen(output) == 11);
+  __msan_check_mem_is_initialized(output, strlen(output) + 1);
 }
 
 void testWriteZeroLength() {
@@ -31,6 +32,8 @@ void testWriteZeroLength() {
                       sizeof(output));
 
   assert(res >= 0);
+  assert(strlen(output) == 0);
+  __msan_check_mem_is_initialized(output, strlen(output) + 1);
   __msan_check_mem_is_initialized(output, res);
 }
 


        


More information about the llvm-commits mailing list