1# `surfaceflinger_end2end_tests` 2 3Tests to cover end to end testing of SurfaceFlinger. 4 5In particular the test framework allows you to simulate various display 6configurations, so the test can confirm displays are handled correctly. 7 8## Quick Useful info 9 10### Running the tests 11 12At present the tests should run on any target, though the typical target would 13be a [Cuttlefish](https://source.android.com/docs/devices/cuttlefish) VM 14target such as `aosp_cf_x86_64_phone`. 15 16At some future time the test may be rewritten to require 17[`vkms`](https://dri.freedesktop.org/docs/drm/gpu/vkms.html) and 18[`drm_hwcomposer`](https://gitlab.freedesktop.org/drm-hwcomposer/drm-hwcomposer) 19 20``` 21atest surfaceflinger_end2end_tests 22``` 23 24You can also run the google test binary directly. However you will also need 25to run a few other set-up and tear-down commands that are part of the 26AndroidTest.xml configuration, so that SurfaceFlinger can be used run isolation 27from the rest of the system. 28 29``` 30# Set-up 31adb root 32adb shell stop 33adb shell setenforce 0 34adb shell setprop debug.sf.nobootanimation 1 35 36# Sync and run the test 37adb sync data 38adb shell data/nativetest64/surfaceflinger_end2end_tests/surfaceflinger_end2end_tests 39 40# Tear-down 41adb shell stop 42adb shell setenforce 1 43adb shell setprop debug.sf.nobootanimation 0 44adb shell setprop debug.sf.hwc_service_name default 45``` 46 47### Manual clang-tidy checks via Soong 48 49At present Android does not run the clang-tidy checks as part of its 50presubmit checks. 51 52You can run them through the build system by using phony target that are 53automatically created for each source subdirectory. 54 55For the code under `frameworks/native/services/surfaceflinger/tests/end2end`, 56you would build: 57 58``` 59m tidy-frameworks-native-services-surfaceflinger-tests-end2end 60``` 61 62For more information see the build documentation: 63 64* <https://android.googlesource.com/platform/build/soong/+/main/docs/tidy.md#the-tidy_directory-targets> 65 66### Seeing clang-tidy checks in your editor 67 68If your editor supports using [`clangd`](https://clangd.llvm.org/) as a 69C++ language server, you can build and export a compilation database using 70Soong. With the local `.clangd` configuration file, you should see the same 71checks in editor, along with all the other checks `clangd` runs. 72 73See the build documentation for the compilation database instructions: 74 75https://android.googlesource.com/platform/build/soong/+/main/docs/compdb.md 76