This is an archive of the discontinued LLVM Phabricator instance.

Skip AsanTestCase and AsanTestReportDataCase on Darwin
ClosedPublic

Authored by ki.stfu on Feb 27 2015, 1:32 PM.

Details

Summary

This patch skips tests which cause the following error:

1: test_with_dsym (TestMemoryHistory.AsanTestCase) ... 
os command: make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" 
with pid: 9475
stdout: rm -f "a.out"  main.o main.d main.d.tmp  
rm -f -r "a.out.dSYM"
/Users/IliaK/p/llvm/build_ninja/bin/clang  -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64   -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include   -c -o main.o main.c
/Users/IliaK/p/llvm/build_ninja/bin/clang  main.o  -fsanitize=address -fsanitize-address-field-padding=1 -g -arch x86_64   -I/Users/IliaK/p/llvm/tools/lldb/test/make/../../include   -o "a.out"

stderr: clang: error: unknown argument: '-fsanitize-address-field-padding=1'
clang: error: unsupported argument 'address' to option 'fsanitize='
ld: file not found: /Users/IliaK/p/llvm/build_ninja/bin/../lib/clang/3.7.0/lib/darwin/libclang_rt.asan_osx_dynamic.dylib
clang-3.7: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [a.out] Error 1

retcode: 2


ERROR

os command: make clean 
with pid: 9521
stdout: rm -f "a.out"  main.o main.d main.d.tmp  
rm -f -r "a.out.dSYM"

stderr: 
retcode: 0


Restore dir to: /Users/IliaK/p/llvm/tools/lldb

======================================================================
ERROR: test_with_dsym (TestMemoryHistory.AsanTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 612, in wrapper
    func(*args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 456, in wrapper
    return func(self, *args, **kwargs)
  File "/Users/IliaK/p/llvm/tools/lldb/test/functionalities/asan/TestMemoryHistory.py", line 24, in test_with_dsym
    self.buildDsym (None, compiler)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 1496, in buildDsym
    if not module.buildDsym(self, architecture, compiler, dictionary, clean):
  File "/Users/IliaK/p/llvm/tools/lldb/test/plugins/builder_darwin.py", line 16, in buildDsym
    lldbtest.system(commands, sender=sender)
  File "/Users/IliaK/p/llvm/tools/lldb/test/lldbtest.py", line 370, in system
    raise CalledProcessError(retcode, cmd)
CalledProcessError: Command 'make clean ; make MAKE_DSYM=YES ARCH=x86_64 CC="/Users/IliaK/p/llvm/build_ninja/bin/clang" ' returned non-zero exit status 2
Config=x86_64-clang
----------------------------------------------------------------------

Also this patch fixes findBuiltClang() by looking a clang in the build folder.

BTW, another patch was made in October 2014, but it wasn't committed: http://reviews.llvm.org/D6272.

Diff Detail

Event Timeline

ki.stfu updated this revision to Diff 20890.Feb 27 2015, 1:32 PM
ki.stfu retitled this revision from to Skip AsanTestCase and AsanTestReportDataCase on Darwin.
ki.stfu updated this object.
ki.stfu edited the test plan for this revision. (Show Details)
ki.stfu added subscribers: clayborg, abidh, zturner and 6 others.

Friendly ping.

clayborg requested changes to this revision.Mar 3 2015, 12:59 PM
clayborg edited edge metadata.

This test works when LLDB builds it:

 % ./dotest.py functionalities/asan
LLDB library dir: /Volumes/work/gclayton/Documents/src/lldb/trunk/build/Debug
lldb-330.99.0
The 'lldb-mi' executable cannot be located.  Some of the tests may not be run as a result.
lldb.pre_flight: None
lldb.post_flight: None

Session logs for test failures/errors/unexpected successes will go into directory '2015-03-03-12_57_29'
Command invoked: ./dotest.py functionalities/asan
compilers=['clang']

Configuration: arch=x86_64 compiler=clang
----------------------------------------------------------------------
Collected 4 tests

.=success F=fail E=error s=skipped x=expected-fail u=unexpected-success

AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
.AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
.AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
.AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
.
----------------------------------------------------------------------
Ran 4 tests in 23.301s

OK

So please fix the test case so it works. It sounds like the search path for the libclang_rt.asan_osx_dynamic.dylib isn't being added to the link line. It works fine when lldb is built using xcodebuild.

This revision now requires changes to proceed.Mar 3 2015, 12:59 PM
ki.stfu updated this revision to Diff 21586.Mar 10 2015, 8:45 AM
ki.stfu edited edge metadata.

Enable AsanTestCase and AsanTestReportDataCase tests on Darwin

So please fix the test case so it works. It sounds like the search path for the libclang_rt.asan_osx_dynamic.dylib isn't being added to the link line. It works fine when lldb is built using xcodebuild.

You was right. I added compiler-rt project to llvm/projects and now these tests work on my side.

But I think we should add check for it to be able skip these tests when compiler-rt wasn't built. For example, we can do an alternative version of D6272 (or modify it). How you think?

Please do add a check for compiler-rt at testing startup and enable the tests if it is present.

ki.stfu planned changes to this revision.Mar 10 2015, 2:54 PM
ki.stfu updated this revision to Diff 21696.Mar 11 2015, 6:27 AM
ki.stfu edited edge metadata.

Add @skipUnlessCompilerRt decorator

I added @skipUnlessCompilerRt decorator. At the moment, if you have compiler-rt support then these tests pass:

$ ./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/asan/
...
1: test_with_dsym (TestMemoryHistory.AsanTestCase) ... AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
ok
2: test_with_dwarf (TestMemoryHistory.AsanTestCase) ... AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
ok
3: test_with_dsym (TestReportData.AsanTestReportDataCase) ... AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
ok
4: test_with_dwarf (TestReportData.AsanTestReportDataCase) ... AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer debugger support is active. Memory error breakpoint has been installed and you can now use the 'memory history' command.
AddressSanitizer report breakpoint hit. Use 'thread info -s' to get extended information about the report.
ok

----------------------------------------------------------------------
Ran 4 tests in 18.729s

OK

But if you don't then tests are ignored:

$ ./dotest.py -v --executable $BUILDDIR/bin/lldb functionalities/asan/
...
1: test_with_dsym (TestMemoryHistory.AsanTestCase) ... skipped 'skip if compiler-rt not found'
2: test_with_dwarf (TestMemoryHistory.AsanTestCase) ... skipped 'skip if compiler-rt not found'
3: test_with_dsym (TestReportData.AsanTestReportDataCase) ... skipped 'skip if compiler-rt not found'
4: test_with_dwarf (TestReportData.AsanTestReportDataCase) ... skipped 'skip if compiler-rt not found'

----------------------------------------------------------------------
Ran 4 tests in 0.071s

OK (skipped=4)
clayborg accepted this revision.Mar 11 2015, 10:39 AM
clayborg edited edge metadata.

Looks good.

This revision is now accepted and ready to land.Mar 11 2015, 10:39 AM
ki.stfu closed this revision.Mar 12 2015, 12:22 AM