Test filter for check-asan

Hey folks, relative noob here.

Right now running ninja check-asan takes about 12 minutes on my machine. I’m working on a test and want to only run that one test. I’m not seeing any easy way to run only my test. Any help on how to filter down to a single test (ex: compiler-rt/lib/asan/tests/asan_internal_interface_test.cpp) would be appreciated.


The unittests use Google Test (GoogleTest User’s Guide | GoogleTest).

I don’t know the asan test structure, but you should be able to build and run a unittest binary by itself. You can also use --gtest_filter=<testname-regex> to further filter.

e.g. for the LLVM IR tests:

# Build the IR unittest binary:
$ ninja unittests/IR/IRTests

# Run the IR unittest, filtering to only run ones with names matching "AssignmentTracking*":
$ ./unittests/IR/IRTests --gtest_filter="AssignmentTracking*"
Note: Google Test filter = AssignmentTracking*
[==========] Running 2 tests from 1 test suite.
[----------] Global test environment set-up.
[----------] 2 tests from AssignmentTrackingTest
[ RUN      ] AssignmentTrackingTest.Utils
[       OK ] AssignmentTrackingTest.Utils (1 ms)
[ RUN      ] AssignmentTrackingTest.InstrMethods
[       OK ] AssignmentTrackingTest.InstrMethods (0 ms)
[----------] 2 tests from AssignmentTrackingTest (1 ms total)

[----------] Global test environment tear-down
[==========] 2 tests from 1 test suite ran. (1 ms total)
[  PASSED  ] 2 tests.

Hope this helps - I’m sure someone with asan familiarity will be able to help further if not.