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

Commit 20f28a24 authored by Michael Butler's avatar Michael Butler
Browse files

Add validation tests for NNAPI Burst serialized format

This CL adds the following two types of validation tests on the NNAPI
Burst serialized format:
(1) it directly modifies the serialized data (invalidating it) to ensure
    that vendor  driver services properly validates the serialized
    request
(2) it ensures that vendor driver services properly fail when the result
    channel is not large enough to return the data

This CL additionally includes miscellaneous cleanups:
(1) having a generic "validateEverything" function
(2) moving the "prepareModel" function that's common across
    validateRequest and validateBurst to a common area

Fixes: 129779280
Bug: 129157135
Test: mma
Test: VtsHalNeuralnetworksV1_2TargetTest (with sample-all)
Change-Id: Ib90fe7f662824de17db5a254a8c501855e45f6bd
parent 3129bda3
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ void NeuralnetworksHidlTest::TearDown() {
    ::testing::VtsHalHidlTargetTestBase::TearDown();
}

void ValidationTest::validateEverything(const Model& model, const std::vector<Request>& request) {
    validateModel(model);
    validateRequests(model, request);
}

}  // namespace functional
}  // namespace vts
}  // namespace V1_0
+5 −2
Original line number Diff line number Diff line
@@ -63,6 +63,9 @@ class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase {
// Tag for the validation tests
class ValidationTest : public NeuralnetworksHidlTest {
   protected:
     void validateEverything(const Model& model, const std::vector<Request>& request);

   private:
     void validateModel(const Model& model);
     void validateRequests(const Model& model, const std::vector<Request>& request);
};
+5 −0
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ void NeuralnetworksHidlTest::TearDown() {
    ::testing::VtsHalHidlTargetTestBase::TearDown();
}

void ValidationTest::validateEverything(const Model& model, const std::vector<Request>& request) {
    validateModel(model);
    validateRequests(model, request);
}

}  // namespace functional
}  // namespace vts
}  // namespace V1_1
+5 −2
Original line number Diff line number Diff line
@@ -72,6 +72,9 @@ class NeuralnetworksHidlTest : public ::testing::VtsHalHidlTargetTestBase {
// Tag for the validation tests
class ValidationTest : public NeuralnetworksHidlTest {
   protected:
     void validateEverything(const Model& model, const std::vector<Request>& request);

   private:
     void validateModel(const Model& model);
     void validateRequests(const Model& model, const std::vector<Request>& request);
};
+4 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ cc_test {
    defaults: ["VtsHalNeuralNetworksTargetTestDefaults"],
    srcs: [
        "GeneratedTestsV1_0.cpp",
        "ValidateBurst.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
@@ -32,6 +33,7 @@ cc_test {
    defaults: ["VtsHalNeuralNetworksTargetTestDefaults"],
    srcs: [
        "GeneratedTestsV1_1.cpp",
        "ValidateBurst.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
@@ -46,6 +48,7 @@ cc_test {
        "BasicTests.cpp",
        "CompilationCachingTests.cpp",
        "GeneratedTests.cpp",
        "ValidateBurst.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE"
@@ -58,6 +61,7 @@ cc_test {
    srcs: [
        "BasicTests.cpp",
        "GeneratedTests.cpp",
        "ValidateBurst.cpp",
    ],
    cflags: [
        "-DNN_TEST_DYNAMIC_OUTPUT_SHAPE",
Loading