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

Commit a6e2d76f authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Introduce surfaceflinger_end2end_tests" into main

parents 7d0d256b a30c11df
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
../../../../../../build/soong/scripts/system-clang-format
 No newline at end of file
+380 −0
Original line number Diff line number Diff line
# Copyright 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FormatStyle:         file
InheritParentConfig: true

# Please add checks explicitly rather than using wildcards like "modernize-*".
# These check names are current as of LLVM 20.0.0, as reported by "clang-tidy --list-checks --checks=*"
# For more information on each check, see https://clang.llvm.org/extra/clang-tidy/checks/list.html.
Checks:
  # from android-*
  - android-cloexec-accept
  - android-cloexec-accept4
  - android-cloexec-creat
  - android-cloexec-dup
  - android-cloexec-epoll-create
  - android-cloexec-epoll-create1
  - android-cloexec-fopen
  - android-cloexec-inotify-init
  - android-cloexec-inotify-init1
  - android-cloexec-memfd-create
  - android-cloexec-open
  - android-cloexec-pipe
  - android-cloexec-pipe2
  - android-cloexec-socket
  - android-comparison-in-temp-failure-retry

  # from bugprone-*
  - bugprone-argument-comment
  - bugprone-assert-side-effect
  - bugprone-assignment-in-if-condition
  - bugprone-bad-signal-to-kill-thread
  - bugprone-bool-pointer-implicit-conversion
  - bugprone-branch-clone
  - bugprone-casting-through-void
  - bugprone-chained-comparison
  - bugprone-compare-pointer-to-member-virtual-function
  - bugprone-copy-constructor-init
  - bugprone-crtp-constructor-accessibility
  - bugprone-dangling-handle
  - bugprone-dynamic-static-initializers
  - bugprone-easily-swappable-parameters
  - bugprone-empty-catch
  - bugprone-exception-escape
  - bugprone-fold-init-type
  - bugprone-forward-declaration-namespace
  - bugprone-forwarding-reference-overload
  - bugprone-implicit-widening-of-multiplication-result
  - bugprone-inaccurate-erase
  - bugprone-inc-dec-in-conditions
  - bugprone-incorrect-enable-if
  - bugprone-incorrect-roundings
  - bugprone-infinite-loop
  - bugprone-integer-division
  - bugprone-lambda-function-name
  - bugprone-macro-parentheses
  - bugprone-macro-repeated-side-effects
  - bugprone-misplaced-operator-in-strlen-in-alloc
  - bugprone-misplaced-pointer-arithmetic-in-alloc
  - bugprone-misplaced-widening-cast
  - bugprone-move-forwarding-reference
  - bugprone-multi-level-implicit-pointer-conversion
  - bugprone-multiple-new-in-one-expression
  - bugprone-multiple-statement-macro
  - bugprone-narrowing-conversions
  - bugprone-no-escape
  - bugprone-non-zero-enum-to-bool-conversion
  - bugprone-not-null-terminated-result
  - bugprone-optional-value-conversion
  - bugprone-parent-virtual-call
  - bugprone-pointer-arithmetic-on-polymorphic-object
  - bugprone-posix-return
  - bugprone-redundant-branch-condition
  - bugprone-reserved-identifier
  - bugprone-return-const-ref-from-parameter
  - bugprone-shared-ptr-array-mismatch
  - bugprone-signal-handler
  - bugprone-signed-char-misuse
  - bugprone-sizeof-container
  - bugprone-sizeof-expression
  - bugprone-spuriously-wake-up-functions
  - bugprone-standalone-empty
  - bugprone-string-constructor
  - bugprone-string-integer-assignment
  - bugprone-string-literal-with-embedded-nul
  - bugprone-stringview-nullptr
  - bugprone-suspicious-enum-usage
  - bugprone-suspicious-include
  - bugprone-suspicious-memory-comparison
  - bugprone-suspicious-memset-usage
  - bugprone-suspicious-missing-comma
  - bugprone-suspicious-realloc-usage
  - bugprone-suspicious-semicolon
  - bugprone-suspicious-string-compare
  - bugprone-suspicious-stringview-data-usage
  - bugprone-swapped-arguments
  - bugprone-switch-missing-default-case
  - bugprone-terminating-continue
  - bugprone-throw-keyword-missing
  - bugprone-too-small-loop-variable
  - bugprone-unchecked-optional-access
  - bugprone-undefined-memory-manipulation
  - bugprone-undelegated-constructor
  - bugprone-unhandled-exception-at-new
  - bugprone-unhandled-self-assignment
  - bugprone-unique-ptr-array-mismatch
  - bugprone-unsafe-functions
  - bugprone-unused-local-non-trivial-variable
  - bugprone-unused-raii
  - bugprone-unused-return-value
  - bugprone-use-after-move
  - bugprone-virtual-near-miss

  # from cert-*
  - cert-con36-c
  - cert-con54-cpp
  - cert-ctr56-cpp
  - cert-dcl03-c
  - cert-dcl16-c
  - cert-dcl37-c
  - cert-dcl50-cpp
  - cert-dcl51-cpp
  - cert-dcl54-cpp
  - cert-dcl58-cpp
  - cert-dcl59-cpp
  - cert-env33-c
  - cert-err09-cpp
  - cert-err33-c
  - cert-err34-c
  - cert-err52-cpp
  - cert-err58-cpp
  - cert-err60-cpp
  - cert-err61-cpp
  - cert-exp42-c
  - cert-fio38-c
  - cert-flp30-c
  - cert-flp37-c
  - cert-int09-c
  - cert-mem57-cpp
  - cert-msc24-c
  - cert-msc30-c
  - cert-msc32-c
  - cert-msc33-c
  - cert-msc50-cpp
  - cert-msc51-cpp
  - cert-msc54-cpp
  - cert-oop11-cpp
  - cert-oop54-cpp
  - cert-oop57-cpp
  - cert-oop58-cpp
  - cert-pos44-c
  - cert-pos47-c
  - cert-sig30-c
  - cert-str34-c

  # from concurrency-*
  - concurrency-mt-unsafe
  - concurrency-thread-canceltype-asynchronous

  # from cppcoreguidelines-*
  - cppcoreguidelines-avoid-c-arrays
  - cppcoreguidelines-avoid-capturing-lambda-coroutines
  - cppcoreguidelines-avoid-const-or-ref-data-members
  - cppcoreguidelines-avoid-do-while
  - cppcoreguidelines-avoid-goto
  - cppcoreguidelines-avoid-magic-numbers
  - cppcoreguidelines-avoid-non-const-global-variables
  - cppcoreguidelines-avoid-reference-coroutine-parameters
  - cppcoreguidelines-c-copy-assignment-signature
  - cppcoreguidelines-explicit-virtual-functions
  - cppcoreguidelines-init-variables
  - cppcoreguidelines-interfaces-global-init
  - cppcoreguidelines-macro-to-enum
  - cppcoreguidelines-macro-usage
  - cppcoreguidelines-misleading-capture-default-by-value
  - cppcoreguidelines-missing-std-forward
  - cppcoreguidelines-narrowing-conversions
  - cppcoreguidelines-no-malloc
  - cppcoreguidelines-no-suspend-with-lock
  - cppcoreguidelines-noexcept-destructor
  - cppcoreguidelines-noexcept-move-operations
  - cppcoreguidelines-noexcept-swap
  - cppcoreguidelines-non-private-member-variables-in-classes
  - cppcoreguidelines-owning-memory
  - cppcoreguidelines-prefer-member-initializer
  - cppcoreguidelines-pro-bounds-array-to-pointer-decay
  - cppcoreguidelines-pro-bounds-constant-array-index
  - cppcoreguidelines-pro-bounds-pointer-arithmetic
  - cppcoreguidelines-pro-type-const-cast
  - cppcoreguidelines-pro-type-cstyle-cast
  - cppcoreguidelines-pro-type-member-init
  - cppcoreguidelines-pro-type-reinterpret-cast
  - cppcoreguidelines-pro-type-static-cast-downcast
  - cppcoreguidelines-pro-type-union-access
  - cppcoreguidelines-pro-type-vararg
  - cppcoreguidelines-rvalue-reference-param-not-moved
  - cppcoreguidelines-slicing
  - cppcoreguidelines-special-member-functions
  - cppcoreguidelines-use-default-member-init
  - cppcoreguidelines-virtual-class-destructor

  # from google-*
  - google-build-explicit-make-pair
  - google-build-namespaces
  - google-build-using-namespace
  - google-default-arguments
  - google-explicit-constructor
  - google-global-names-in-headers
  - google-objc-avoid-nsobject-new
  - google-objc-avoid-throwing-exception
  - google-objc-function-naming
  - google-objc-global-variable-declaration
  - google-readability-avoid-underscore-in-googletest-name
  - google-readability-braces-around-statements
  - google-readability-casting
  - google-readability-function-size
  - google-readability-namespace-comments
  - google-readability-todo
  - google-runtime-int
  - google-runtime-operator
  - google-upgrade-googletest-case

  # from misc-*
  - misc-confusable-identifiers
  - misc-const-correctness
  - misc-coroutine-hostile-raii
  - misc-definitions-in-headers
  - misc-header-include-cycle
  - misc-include-cleaner
  - misc-misleading-bidirectional
  - misc-misleading-identifier
  - misc-misplaced-const
  - misc-new-delete-overloads
  - misc-no-recursion
  - misc-non-copyable-objects
  - misc-non-private-member-variables-in-classes
  - misc-redundant-expression
  - misc-static-assert
  - misc-throw-by-value-catch-by-reference
  - misc-unconventional-assign-operator
  - misc-uniqueptr-reset-release
  - misc-unused-alias-decls
  - misc-unused-parameters
  - misc-unused-using-decls
  - misc-use-anonymous-namespace
  - misc-use-internal-linkage

  # from modernize-*
  - modernize-avoid-bind
  - modernize-avoid-c-arrays
  - modernize-concat-nested-namespaces
  - modernize-deprecated-headers
  - modernize-deprecated-ios-base-aliases
  - modernize-loop-convert
  - modernize-macro-to-enum
  - modernize-make-shared
  - modernize-make-unique
  - modernize-min-max-use-initializer-list
  - modernize-pass-by-value
  - modernize-raw-string-literal
  - modernize-redundant-void-arg
  - modernize-replace-auto-ptr
  - modernize-replace-disallow-copy-and-assign-macro
  - modernize-replace-random-shuffle
  - modernize-return-braced-init-list
  - modernize-shrink-to-fit
  - modernize-type-traits
  - modernize-unary-static-assert
  - modernize-use-auto
  - modernize-use-bool-literals
  - modernize-use-constraints
  - modernize-use-default-member-init
  - modernize-use-designated-initializers
  - modernize-use-emplace
  - modernize-use-equals-default
  - modernize-use-equals-delete
  - modernize-use-nodiscard
  - modernize-use-noexcept
  - modernize-use-nullptr
  - modernize-use-override
  - modernize-use-ranges
  - modernize-use-starts-ends-with
  - modernize-use-std-format
  - modernize-use-std-numbers
  - modernize-use-std-print
  - modernize-use-trailing-return-type
  - modernize-use-transparent-functors
  - modernize-use-uncaught-exceptions
  - modernize-use-using

  # from performance-*
  - performance-avoid-endl
  - performance-enum-size
  - performance-faster-string-find
  - performance-for-range-copy
  - performance-implicit-conversion-in-loop
  - performance-inefficient-algorithm
  - performance-inefficient-string-concatenation
  - performance-inefficient-vector-operation
  - performance-move-const-arg
  - performance-move-constructor-init
  - performance-no-automatic-move
  - performance-no-int-to-ptr
  - performance-noexcept-destructor
  - performance-noexcept-move-constructor
  - performance-noexcept-swap
  - performance-trivially-destructible
  - performance-type-promotion-in-math-fn
  - performance-unnecessary-copy-initialization
  - performance-unnecessary-value-param

  # from portability-*
  - portability-restrict-system-includes
  - portability-simd-intrinsics
  - portability-std-allocator-const

  # from readability-*
  - readability-avoid-const-params-in-decls
  - readability-avoid-nested-conditional-operator
  - readability-avoid-return-with-void-value
  - readability-avoid-unconditional-preprocessor-if
  - readability-braces-around-statements
  - readability-const-return-type
  - readability-container-contains
  - readability-container-data-pointer
  - readability-container-size-empty
  - readability-convert-member-functions-to-static
  - readability-delete-null-pointer
  - readability-duplicate-include
  - readability-else-after-return
  - readability-enum-initial-value
  - readability-function-cognitive-complexity
  - readability-function-size
  - readability-identifier-length
  - readability-identifier-naming
  - readability-implicit-bool-conversion
  - readability-inconsistent-declaration-parameter-name
  - readability-isolate-declaration
  - readability-magic-numbers
  - readability-make-member-function-const
  - readability-math-missing-parentheses
  - readability-misleading-indentation
  - readability-misplaced-array-index
  - readability-named-parameter
  - readability-non-const-parameter
  - readability-operators-representation
  - readability-qualified-auto
  - readability-redundant-access-specifiers
  - readability-redundant-casting
  - readability-redundant-control-flow
  - readability-redundant-declaration
  - readability-redundant-function-ptr-dereference
  - readability-redundant-inline-specifier
  - readability-redundant-member-init
  - readability-redundant-preprocessor
  - readability-redundant-smartptr-get
  - readability-redundant-string-cstr
  - readability-redundant-string-init
  - readability-reference-to-constructed-temporary
  - readability-simplify-boolean-expr
  - readability-simplify-subscript-expr
  - readability-static-accessed-through-instance
  - readability-static-definition-in-anonymous-namespace
  - readability-string-compare
  - readability-suspicious-call-argument
  - readability-uniqueptr-delete-release
  - readability-uppercase-literal-suffix
  - readability-use-anyofallof
  - readability-use-std-min-max
+20 −0
Original line number Diff line number Diff line
# Copyright 2025 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

Diagnostics:
  UnusedIncludes: Strict
  MissingIncludes: Strict
  ClangTidy:
    FastCheckFilter: None
    # See the .clang-tidy files for additional configuration
+68 −0
Original line number Diff line number Diff line
package {
    // See: http://go/android-license-faq
    // A large-scale-change added 'default_applicable_licenses' to import
    // all of the 'license_kinds' from "frameworks_native_license"
    // to get the below license kinds:
    //   SPDX-license-identifier-Apache-2.0
    default_applicable_licenses: ["frameworks_native_license"],
}

cc_test {
    name: "surfaceflinger_end2end_tests",
    test_suites: ["device-tests"],
    require_root: true,

    cpp_std: "experimental",
    cflags: [
        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
        "-DNODISCARD_EXPECTED",
        "-D_LIBCPP_ENABLE_THREAD_SAFETY_ANNOTATIONS",
        "-Wall",
        "-Wconversion",
        "-Werror",
        "-Wextra",
        "-Wformat",
        "-Wno-non-virtual-dtor",
        "-Wno-sign-compare",
        "-Wno-sign-conversion",
        "-Wshadow",
        "-Wthread-safety",
        "-Wunreachable-code",
        "-Wunused",
    ],
    srcs: [
        "main.cpp",
        "test_framework/core/TestService.cpp",
        "test_framework/fake_hwc3/Hwc3Composer.cpp",
        "test_framework/fake_hwc3/Hwc3Controller.cpp",
        "test_framework/surfaceflinger/SFController.cpp",
        "tests/Placeholder_test.cpp",
    ],
    tidy: true,
    tidy_flags: [
        "--config=", // Use the .clang-tidy closest to each source file for the configuration
    ],
    tidy_checks_as_errors: [
        "*",
    ],
    include_dirs: [
        "frameworks/native/include",
    ],
    local_include_dirs: ["."],
    shared_libs: [
        "libbase",
        "libbinder",
        "libbinder_ndk",
        "libcutils",
        "libgui",
        "libsync",
        "libui",
        "libutils",
    ],
    static_libs: [
        "android.hardware.common-V2-ndk",
        "android.hardware.graphics.common-V6-ndk",
        "android.hardware.graphics.composer3-V3-ndk",
        "libgtest",
    ],
}
+39 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2025 The Android Open Source Project

     Licensed under the Apache License, Version 2.0 (the "License");
     you may not use this file except in compliance with the License.
     You may obtain a copy of the License at

          http://www.apache.org/licenses/LICENSE-2.0

     Unless required by applicable law or agreed to in writing, software
     distributed under the License is distributed on an "AS IS" BASIS,
     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<configuration description="Configuration for surfaceflinger_end2end_tests">
    <target_preparer class="com.android.tradefed.targetprep.RootTargetPreparer" />
    <target_preparer class="com.android.tradefed.targetprep.DisableSELinuxTargetPreparer" />
    <target_preparer class="com.android.tradefed.targetprep.RunCommandTargetPreparer">
        <!-- Stop everything to run SurfaceFlinger in isolation, with relaxed SELinux permissions -->
        <option name="teardown-command" value="stop" />
        <option name="teardown-command" value="setprop debug.sf.nobootanimation 1" />

        <!-- Restart everything with normal settings after the test finishes. -->
        <option name="teardown-command" value="stop" />
        <option name="teardown-command" value="setprop debug.sf.nobootanimation 0" />
        <option name="teardown-command" value="setprop debug.sf.hwc_service_name default" />
        <option name="teardown-command" value="start" />
    </target_preparer>
    <target_preparer class="com.android.compatibility.common.tradefed.targetprep.FilePusher">
        <option name="cleanup" value="true" />
        <option name="push" value="surfaceflinger_end2end_tests->/data/local/tests/surfaceflinger_end2end_tests" />
    </target_preparer>
    <test class="com.android.tradefed.testtype.GTest" >
        <option name="native-test-device-path" value="/data/local/tests" />
        <option name="module-name" value="surfaceflinger_end2end_tests" />
        <option name="native-test-timeout" value="15m"/>
    </test>
</configuration>
Loading