Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ba46cae3 authored by Nolan Scobie's avatar Nolan Scobie
Browse files

Log chosen RenderPipelineType when running hwui_unit_tests

There are a few ways to run hwui_unit_tests: copy the binary to the
device and execute it directly, run with atest, tradefed, etc(?). Some
of these approaches have arcane ways of passing arguments down into the
executable, such as the `--renderer` flag. Logging what is actually
observed/chosen can help confirm that the flag is being passed
correctly.

Bug: b/338077634
Test: observed logs for `hwui_unit_tests --renderer=skiavk`
Flag: TEST_ONLY
Change-Id: I1a4e72fb08dedf36f9095b3844e346ffeefac602
parent 0fc4b90b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@
 */

#include <getopt.h>
#include <log/log.h>
#include <signal.h>

#include "Properties.h"
@@ -65,6 +66,19 @@ static RenderPipelineType parseRenderer(const char* renderer) {
    return RenderPipelineType::SkiaGL;
}

static constexpr const char* renderPipelineTypeName(const RenderPipelineType renderPipelineType) {
    switch (renderPipelineType) {
        case RenderPipelineType::SkiaGL:
            return "SkiaGL";
        case RenderPipelineType::SkiaVulkan:
            return "SkiaVulkan";
        case RenderPipelineType::SkiaCpu:
            return "SkiaCpu";
        case RenderPipelineType::NotInitialized:
            return "NotInitialized";
    }
}

struct Options {
    RenderPipelineType renderer = RenderPipelineType::SkiaGL;
};
@@ -118,6 +132,7 @@ int main(int argc, char* argv[]) {

    auto opts = parseOptions(argc, argv);
    Properties::overrideRenderPipelineType(opts.renderer);
    ALOGI("Starting HWUI unit tests with %s pipeline", renderPipelineTypeName(opts.renderer));

    // Run the tests
    testing::InitGoogleTest(&argc, argv);