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

Commit 44d8bba3 authored by Yu Shan's avatar Yu Shan Committed by Android (Google) Code Review
Browse files

Merge changes Iadea6b4d,I5ba4d5eb into main

* changes:
  Generate Java/Cpp files for VehicleProperty annotations.
  Add annotations checks for VehicleProperty.aidl.
parents 726117d4 9df12155
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -43,6 +43,10 @@ cc_test {
    team: "trendy_team_aaos_carframework_triage",
    srcs: ["VehiclePropertyAnnotationCppTest.cpp"],
    header_libs: ["IVehicleGeneratedHeaders-V4"],
    static_libs: [
        "libgtest",
        "libgmock",
    ],
    defaults: ["VehicleHalInterfaceDefaults"],
    test_suites: ["general-tests"],
}
+12 −0
Original line number Diff line number Diff line
@@ -15,16 +15,20 @@
 */

#include <AccessForVehicleProperty.h>
#include <AnnotationsForVehicleProperty.h>
#include <ChangeModeForVehicleProperty.h>

#include <aidl/android/hardware/automotive/vehicle/VehicleProperty.h>
#include <gmock/gmock.h>
#include <gtest/gtest.h>
#include <unordered_set>

namespace aidl_vehicle = ::aidl::android::hardware::automotive::vehicle;
using aidl_vehicle::AccessForVehicleProperty;
using aidl_vehicle::AnnotationsForVehicleProperty;
using aidl_vehicle::ChangeModeForVehicleProperty;
using aidl_vehicle::VehicleProperty;
using testing::IsEmpty;

namespace {
    template<class T>
@@ -54,3 +58,11 @@ TEST(VehiclePropertyAnnotationCppTest, testAccess) {
            << "Outdated annotation-generated AIDL files. Please run "
            << "generate_annotation_enums.py to update.";
}

TEST(VehiclePropertyAnnotationCppTest, testAnnotations) {
    for (const auto& [propertyId, annotations] : AnnotationsForVehicleProperty) {
        ASSERT_THAT(annotations, Not(IsEmpty()))
                << "annotations set for property: " << aidl_vehicle::toString(propertyId)
                << " must not be empty";
    }
}
+11 −0
Original line number Diff line number Diff line
@@ -57,4 +57,15 @@ public class VehiclePropertyAnnotationJavaTest {
                .that(doesAnnotationMapContainsAllProps(AccessForVehicleProperty.values))
                .isTrue();
    }

    @Test
    @SmallTest
    public void testAnnotations() {
        for (int propertyId : AnnotationsForVehicleProperty.values.keySet()) {
            assertWithMessage("annotations set for property: "
                    + VehicleProperty.$.toString(propertyId) + " must not be empty")
                    .that(AnnotationsForVehicleProperty.values.get(propertyId))
                    .isNotEmpty();
        }
    }
}
 No newline at end of file
+26 −26

File changed.

Preview size limit exceeded, changes collapsed.

+327 −0

File added.

Preview size limit exceeded, changes collapsed.

Loading