This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Asan/Tsan Unit/Regression testing (was [asan] Emit GIMPLE direclty, small cleanups)


On Tue, Nov 13, 2012 at 1:55 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Tue, Nov 13, 2012 at 1:24 PM, Konstantin Serebryany
> <konstantin.s.serebryany@gmail.com> wrote:
>>> I migrate a test in the third category. Please help to check whether
>>> it is ok. Then I will migrate the left. The files added are as follows
>>> and attached. (Please forgive I use -fasan in asan.exp because I use
>>> an old repository to try the migration)
>>>
>>> gcc/testsuite/lib/asan-dg.exp:
>>>         copy from libmudflap/lib/mfdg.exp, it rewrites the proc
>>> dg-test, to enable dg-output check in xfail status.  Existing
>>> dg-output check in /usr/share/dejagnu/dg.exp only work in pass status
>>> but not in xfail status.
>>> gcc/testsuite/g++.dg/asan/asan.exp
>>> gcc/testsuite/g++.dg/asan/memcmp_test.cc
>>>
>>> A problem: llvm provides llvm-symbolizer and asan_symbolize.py to map
>>> virtual address to its parent func name, which is used in "CHECK:
>>> {{#0.*memcmp}}" in llvm test below.  I don't know whether gcc provides
>>> similar tools. How to deal with it?
>>
>> You can not use llvm-symbolizer, but maybe you can use asan_symbolize.py?
>> asan_symbolize.py is basically a wrapper for addr2line, a libbfd-based tool.
>> Or is python not allowed in gcc testing infrastructure?
>> Then you can probably write a simple script in perl that does the same.
>
> Why not just use TCL for this.  Since there is already a scripting
> language with dejagnu via TCL.

Any scripting language will work.

>
> Thanks,
> Andrew Pinski
>
>>
>>>
>>> memcmp_test.cc in llvm:
>>>
>>>   1 // RUN: %clangxx_asan -m64 -O0 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   2 // RUN: %clangxx_asan -m64 -O1 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   3 // RUN: %clangxx_asan -m64 -O2 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   4 // RUN: %clangxx_asan -m64 -O3 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   5 // RUN: %clangxx_asan -m32 -O0 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   6 // RUN: %clangxx_asan -m32 -O1 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   7 // RUN: %clangxx_asan -m32 -O2 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   8 // RUN: %clangxx_asan -m32 -O3 %s -o %t %lib && %t 2>&1 |
>>> %symbolize | FileCheck %s
>>>   9
>>>  10 #include <string.h>
>>>  11 int main(int argc, char **argv) {
>>>  12   char a1[] = {argc, 2, 3, 4};
>>>  13   char a2[] = {1, 2*argc, 3, 4};
>>>  14   int res = memcmp(a1, a2, 4 + argc);  // BOOM
>>>  15   // CHECK: AddressSanitizer stack-buffer-overflow
>>>  16   // CHECK: {{#0.*memcmp}}
>>>  17   // CHECK: {{#1.*main}}
>>>  18   return res;
>>>  19 }
>>>
>>> memcmp_test.cc planed for gcc:
>>>
>>>   1 #include <string.h>
>>>   2 int main(int argc, char **argv) {
>>>   3   char a1[] = {argc, 2, 3, 4};
>>>   4   char a2[] = {1, 2*argc, 3, 4};
>>>   5   int res = memcmp(a1, a2, 4 + argc);  // BOOM
>>>   6   return res;
>>>   7 }
>>>   8
>>>   9 /*  { dg-output "AddressSanitizer stack-buffer-overflow.*" } */
>>>  10 /*  { dg-do run { xfail *-*-* } } */
>>
>> Will this run the test in all mode (O0 vs O2 and -m32 vs -m64)?
>>
>>
>> --kcc
>>
>>>  11
>>>
>>> Thanks,
>>> Wei.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]