This is an archive of the discontinued LLVM Phabricator instance.

Add support for running lldb-test on android targets
ClosedPublic

Authored by chying on Apr 29 2015, 3:15 PM.

Details

Summary
  • Add build/compile steps for android target using ndk
  • Modify current remote test steps to work for android
  • Allow combination of running lldb tests on local host, android and linux platform

Diff Detail

Repository
rL LLVM

Event Timeline

chying updated this revision to Diff 24662.Apr 29 2015, 3:15 PM
chying retitled this revision from to Add support for running lldb-test on android targets.
chying updated this object.
chying edited the test plan for this revision. (Show Details)
chying added reviewers: sivachandra, chaoren, vharron.
chying added a subscriber: Unknown Object (MLST).
chying updated this revision to Diff 24663.Apr 29 2015, 3:22 PM

Revert one local workaround that was accidentially included in previous revision

sivachandra edited edge metadata.Apr 29 2015, 4:03 PM

Hi,

This change is fairly large that I need time to digest all of it. I have few preliminary nitty comments. Addressing them might help me digest faster.

A general comment is that commands being specified as strings and not lists. We should do this only if it is unavoidable, for example on LLDBBuilder.py:368. I should have pointed this out during the review of http://reviews.llvm.org/D8711.

zorg/buildbot/builders/LLDBBuilder.py
416 ↗(On Diff #24663)

I think time has come to add doc strings describing what these args are and how they should be formatted.

475 ↗(On Diff #24663)

I think this function can be named getLLDBAndroidCmakeStep and decoupled with compilation step. Non-Android cmake step can be as before. See my comments below.

504 ↗(On Diff #24663)

I know this is copied over code, but I think it is better done this way:

cmake_args.append("-DCMAKE_C_COMPILER=%s" % getCCompilerCmd(build_compiler))
cmake_args.append("-DCMAKE_CXX_COMPILER=%s" % getCxxCompilerCmd(build_compiler))

The get functions as follows:

def getCCompilerCmd(compiler):
  if compiler == "clang":
    return "clang"
  elif compiler == "gcc":
    return "gcc"

def getCxxCompilerCmd(compiler):
  if compiler == "clang":
    return "clang++"
  elif compiler == "gcc":
    return "gcc++"
528 ↗(On Diff #24663)

Looks like the only reason config step and compile step are combined in this function is because of |extra_ninja_cmd|. If you treat |extra_ninja_cmd| as |ninja_targets|, then this will not be required. As in, linux builds take no targets (implying all targets), while android builds take one target named "lldb-server".

531 ↗(On Diff #24663)

+1 wrt PEP8, but I think it is not following the style in this file.

> A general comment is that commands being specified as strings and not lists. We should do this only if it is unavoidable, for example on LLDBBuilder.py:368.
Using lists makes it slightly more complicated when there're single/double quotes in the command.
I will try to convert strings to lists in the next revision.

zorg/buildbot/builders/LLDBBuilder.py
416 ↗(On Diff #24663)

Will do this in next revision.

475 ↗(On Diff #24663)

This function contains both steps, because cmake and compilation step will always be called together for local configuration first, and then once for each target platform. If compilation step is decoupled, then we need to have the same code for compilation step in multiple places.

528 ↗(On Diff #24663)

Same as above, these two steps are combined because they will be called together.
It's good to add ninja_targets.

sivachandra added inline comments.Apr 29 2015, 5:11 PM
zorg/buildbot/builders/LLDBBuilder.py
475 ↗(On Diff #24663)

OK. Then I suggest 1. Rename getLLDBCmakeCompileSteps to getLLDBCMakeAndCompileSteps. 2. Add these functions:

def getLLDBCMakeStep(...):
  if ... == 'linux':
    getLLDBLinuxCMakeStep(...)
  elif ... == 'android':
    getLLDBAndroidCMakeStep(...)

def getLLDBLinuxCMakeStep(...):
  ...

def getLLDBAndroidCMakeStep(...):
  ...
sivachandra added inline comments.Apr 29 2015, 5:15 PM
zorg/buildbot/builders/LLDBBuilder.py
475 ↗(On Diff #24663)

Sorry, forgot to mention that you should call getLLDBCMakeStep from getLLDBCMakeAndCompileSteps.

chying updated this revision to Diff 24763.Apr 30 2015, 12:11 PM
chying edited edge metadata.
  1. Convert shell command single strings to list of strings when possible
  2. Add Docstring for getLLDBUbuntuCMakeBuildFactory function
  3. Add one step to clean remote directory after remote testing
  4. Break cmake function to smaller functions
chying updated this revision to Diff 24832.May 1 2015, 2:47 PM

Use 'adb://deviceid:port' as platform url to connect android devices since lldb support multiple devices

sivachandra accepted this revision.May 1 2015, 3:17 PM
sivachandra edited edge metadata.

LGTM with nits.

I have not gone through the correctness of the various commands involved as I do not understand them yet. Chaoren, can you do that?

zorg/buildbot/builders/LLDBBuilder.py
257 ↗(On Diff #24832)

Nit: space before and after '='. Except when specifying default function args, there should be a space before and after '='. Space like that are missing at a number of places in this change. Same should be done with '+=' as well.

347 ↗(On Diff #24832)

Nit: Python variables "leak" out of scope. Hence, you do not need lines 344-347.

404 ↗(On Diff #24832)

Seems like there should be an 'else' case which just returns 'f'. Not that it matters in the current state of affairs, but it seems like a hole in the logic. For, if the platform is neither linux nor android, you will still go ahead and add other steps. I am not sure if this is OK.

561 ↗(On Diff #24832)

Nit: seems like you could just say return getLLDB....

567 ↗(On Diff #24832)

Same here.

This revision is now accepted and ready to land.May 1 2015, 3:17 PM
chying added inline comments.May 1 2015, 3:47 PM
zorg/buildbot/builders/LLDBBuilder.py
347 ↗(On Diff #24832)

Thanks, It's good to know.

404 ↗(On Diff #24832)

This case will be handled in the beginning of this function,
' # only supports linux and android as remote target at this time

if remote_config.platform not in ('linux', 'android'):
      return f '
sivachandra added inline comments.May 1 2015, 3:58 PM
buildbot/osuosl/master/config/builders.py
751 ↗(On Diff #24832)

Sorry for the revisit. Is this a change you forgot to uncomment before uploading?

Nit: there should be a space before and after ','. This happens at a number of places in this change.

zorg/buildbot/builders/LLDBBuilder.py
404 ↗(On Diff #24832)

Ah, OK. Sorry, I missed it.

chying updated this revision to Diff 24842.May 1 2015, 4:58 PM
chying edited edge metadata.

Fix a few nits based on code review
Change job number for this slave to 40 since it's a 40 core station

This revision was automatically updated to reflect the committed changes.