Skip to content

Commit

Permalink
Update documents to run Cobalt on Linux in evergreen mode (#4108)
Browse files Browse the repository at this point in the history
android document is updated as well for generating XML test result

b/361540371
b/362655498

(cherry picked from commit daf89fc)
  • Loading branch information
jonastsai authored and anonymous1-me committed Sep 19, 2024
1 parent 73272fe commit cf91b8b
Show file tree
Hide file tree
Showing 2 changed files with 389 additions and 34 deletions.
107 changes: 107 additions & 0 deletions cobalt/site/docs/development/setup-android.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,26 @@ return and complete the following steps.
`debug.keystore` you may need to set one up on your system:

```
<<<<<<< HEAD
=======
1. Download the Starboard toolchain and Android SDK
```sh
./starboard/tools/download_clang.sh
./starboard/android/shared/download_sdk.sh
```

1. Install additional Linux packages

```sh
sudo apt install binutils-arm-linux-gnueabi libgles2-mesa-dev mesa-common-dev
```

1. Make sure Android debug keystore is setup

```sh
>>>>>>> daf89fc92ba (Update documents to run Cobalt on Linux in evergreen mode (#4108))
keytool -genkey -v -keystore ~/.android/debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000
```
Expand Down Expand Up @@ -227,7 +247,94 @@ change `DEFAULT_COBALT_TARGET` to be the name of the test you want to debug
instead of 'cobalt'. Then you can set breakpoints, etc. in the test the same as
when debugging Cobalt.
<<<<<<< HEAD
## Debugging (Terminal)
=======
```sh
gn gen out/evergreen-arm-softfp_devel --args="target_platform=\"evergreen-arm-softfp\" target_cpu=\"arm\" use_asan=false build_type=\"devel\" sb_api_version=15"
```
1. Build nplb library
```sh
ninja -C out/evergreen-arm-softfp_devel nplb_install
```
1. Generate apk output folder
```sh
gn gen out/android-arm_devel --args="target_platform=\"android-arm\" target_cpu=\"arm\" target_os=\"android\" sb_is_evergreen_compatible=true build_type=\"devel\" sb_api_version=15"
```
### Build and run nplb test apk
1. Build nplb apk
```sh
ninja -C out/android-arm_devel nplb_evergreen_loader_install
```
1. Check the output apk file. The output file is available at
```sh
out/android-arm_devel/nplb_evergreen_loader.apk
```
1. To run the nplb test, execute following command
```sh
# install the apk
adb install out/android-arm_devel/nplb_evergreen_loader.apk
# launch the apk
adb shell "am start --esa args '--evergreen_library=app/cobalt/lib/libnplb.so,--evergreen_content=app/cobalt/content' dev.cobalt.coat"
```
1. Generate test result with XML format
Due to access permission constrains on AOSP, the xml file should be created
by `adb shell` first, before nplb apk writing test result in it.
```sh
# create a file in a folder with read/write permission
adb shell "mkdir -p /data/local/tmp/"
adb shell "touch /data/local/tmp/nplb_testResult.xml"
# Make the file writable
adb shell "chmod a+w /data/local/tmp/nplb_testResult.xml"
# test and output to xml file
adb shell "am start --esa args '--evergreen_library=app/cobalt/lib/libnplb.so,--evergreen_content=app/cobalt/content,--gtest_output=xml:/data/local/tmp/nplb_testResult.xml' dev.cobalt.coat"
```
### Build and run nplb evergreen compat test apk
1. Build nplb_evergreen_compat_tests apk
**NOTE:** Please finish nplb build in previous step before building nplb compat test
```sh
ninja -C out/android-arm_devel nplb_evergreen_compat_tests_install
```
1. Check the output apk file. The output file is available at
```sh
out/android-arm_devel/nplb_evergreen_compat_tests.apk
```
1. To run the nplb compat test, execute following command
```sh
# install the apk
adb install out/android-arm_devel/nplb_evergreen_compat_tests.apk
# launch the apk
adb shell am start dev.cobalt.coat
```
## Debugging
>>>>>>> daf89fc92ba (Update documents to run Cobalt on Linux in evergreen mode (#4108))
Use `adb logcat` while Cobalt is running, or use `adb bugreport` shortly after
exiting to view Android logs. You will need to filter or search for
Expand Down
Loading

0 comments on commit cf91b8b

Please sign in to comment.