Closed Bug 1790905 Opened 2 years ago Closed 2 years ago

ASan build cannot find ASAN symbolizer when running test

Categories

(Testing :: Mozbase, defect)

Default
Desktop
Linux
defect

Tracking

(firefox107 fixed)

RESOLVED FIXED
107 Branch
Tracking Status
firefox107 --- fixed

People

(Reporter: allstars.chh, Assigned: gbrown)

Details

Attachments

(2 files)

Build ASAN on Linux64 according to https://firefox-source-docs.mozilla.org/tools/sanitizer/asan.html

And export ASAN_SYMBOLIZER_PATH='path to llvm-symbolizer'
as mentioned in the doc.

To use it, just set the environment variable ASAN_SYMBOLIZER_PATH to reflect the location of your llvm-symbolizer binary, before running the process.

(My llvm-symbolizer is located in $HOME/.mozbuild/clang/bin/llvm-symbolizer)

Run now ./mach mochitest, or ./mach wpt

There will be an error message:

ERROR TEST-UNEXPECTED-FAIL | runtests.py | Failed to find ASan symbolizer at 'my_obj_dir'/dist/bin/llvm-symbolizer

('my_obj_dir' is the absolute path of the object directory)

The error message is from
https://searchfox.org/mozilla-central/rev/0948667bc62415d48abff27e1405fb4ab4d65d75/testing/mozbase/mozrunner/mozrunner/utils.py#162-169

And the code also looks strange, as it doesn't get the symbolzier path from the env variable 'ASAN_SYMBOLIZER_PATH', instead it uses $objdir/dist/bin/llvm-symbolizer directly.

Assignee: nobody → gbrown

:allstars.chh - Does this work for you? It should use ASAN_SYMBOLIZER_PATH, if set.

Flags: needinfo?(allstars.chh)

Yes, it fixes the problem, thanks.
BTW, you could find similar problems in other testing scripts, like gtest, cppunit, and xpcshell
see https://searchfox.org/mozilla-central/search?q=ASAN_SYMBOLIZER_PATH&path=testing%2F&case=false&regexp=false
might be worthwhile to fix them at once.

I have a question regarding to the llvm-symbolizer, how come I don't have <objdir>/dist/bin/llvm-symbolizer. in my obj dir?
Do I need some special setup to have it installed in objdir?

And if I switch ASAN_SYMBOLIZER_PATH to asan_symbolize.py, the test won't run at all,
(the script is from https://github.com/llvm-mirror/compiler-rt/blob/master/lib/asan/scripts/asan_symbolize.py)

see https://pastebin.com/c6uEu3S0
Is this a known problem?

Thanks

Flags: needinfo?(allstars.chh)
Pushed by gbrown@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1bde82f6bf43
Respect ASAN_SYMBOLIZER_PATH when running asan tests; r=jmaher

(In reply to Yoshi Cheng-Hao Huang [:allstars.chh][:allstarschh] from comment #3)

Yes, it fixes the problem, thanks.

Great!

BTW, you could find similar problems in other testing scripts, like gtest, cppunit, and xpcshell
see https://searchfox.org/mozilla-central/search?q=ASAN_SYMBOLIZER_PATH&path=testing%2F&case=false&regexp=false
might be worthwhile to fix them at once.

I'll have a look and put together another patch.

I have a question regarding to the llvm-symbolizer, how come I don't have <objdir>/dist/bin/llvm-symbolizer. in my obj dir?
Do I need some special setup to have it installed in objdir?

I don't know. I used the mozconfig from https://firefox-source-docs.mozilla.org/tools/sanitizer/asan.html and it just worked.

And if I switch ASAN_SYMBOLIZER_PATH to asan_symbolize.py, the test won't run at all,
(the script is from https://github.com/llvm-mirror/compiler-rt/blob/master/lib/asan/scripts/asan_symbolize.py)

see https://pastebin.com/c6uEu3S0
Is this a known problem?

Sorry, I don't know. I'm not very familiar with asan.

Keywords: leave-open
Keywords: leave-open
Pushed by gbrown@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/e0e02468d526
Respect ASAN_SYMBOLIZER_PATH when running asan cppunit/xpcshell/gtests; r=jmaher
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 107 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: