This is an archive of the discontinued LLVM Phabricator instance.

compiler-rt/test: Add a couple of convenience features for Android.
ClosedPublic

Authored by pcc on Jan 15 2019, 2:03 AM.

Details

Summary

Add a ANDROID_SERIAL_FOR_TESTING CMake variable. This lets you
run the tests with multiple devices attached without having to set
ANDROID_SERIAL.

Add a mechanism for pushing files to the device. Currently most
sanitizers require llvm-symbolizer and the sanitizer runtime to
be pushed to the device. This lets the sanitizer make this happen
automatically before running the tests by specifying the paths in
the lit.site.cfg file.

Diff Detail

Repository
rL LLVM

Event Timeline

pcc created this revision.Jan 15 2019, 2:03 AM
eugenis added inline comments.Jan 15 2019, 1:33 PM
compiler-rt/test/lit.common.cfg
282 ↗(On Diff #181747)

Is this actually better than setting ANDROID_SERIAL in the environment?

In any case, it looks like this line makes tests ignore ANDROID_SERIAL, even if the cmake variable is not set. This would get in the way if one wants to switch devices (ex. same arch but different api levels).

pcc marked an inline comment as done.Jan 15 2019, 1:45 PM
pcc added inline comments.
compiler-rt/test/lit.common.cfg
282 ↗(On Diff #181747)

Is this actually better than setting ANDROID_SERIAL in the environment?

I guess it's a matter of opinion, but I personally find it more convenient if I can just do "ninja check-hwasan" without needing to set an environment variable.

In any case, it looks like this line makes tests ignore ANDROID_SERIAL, even if the cmake variable is not set. This would get in the way if one wants to switch devices (ex. same arch but different api levels).

cmake expands unset variables to the empty string, and Python treats the empty string as false-ish, so this code won't get executed if the variable is not set.

eugenis accepted this revision.Jan 15 2019, 1:56 PM

LGTM

compiler-rt/test/lit.common.cfg
282 ↗(On Diff #181747)

Ah, right. That's OK then.

This revision is now accepted and ready to land.Jan 15 2019, 1:56 PM
This revision was automatically updated to reflect the committed changes.