libprocessgroup: Add VTS tests for vendor JSON files
Test: vts_processgroup_validate_test Bug: 123664216 Change-Id: I5518e34cde6fc30195fc99133f86cb23ae3be92f
This commit is contained in:
parent
28a44eb6f6
commit
e8e2756f93
|
@ -29,9 +29,21 @@ prebuilt_etc {
|
|||
src: "task_profiles.json",
|
||||
}
|
||||
|
||||
cc_defaults {
|
||||
name: "libprocessgroup_test_defaults",
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
|
||||
// Needed for headers from libprotobuf.
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
}
|
||||
|
||||
cc_library_static {
|
||||
name: "libprocessgroup_proto",
|
||||
host_supported: true,
|
||||
defaults: ["libprocessgroup_test_defaults"],
|
||||
srcs: [
|
||||
"cgroups.proto",
|
||||
"task_profiles.proto",
|
||||
|
@ -40,15 +52,11 @@ cc_library_static {
|
|||
type: "full",
|
||||
export_proto_headers: true,
|
||||
},
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
}
|
||||
|
||||
cc_test_host {
|
||||
name: "libprocessgroup_proto_test",
|
||||
defaults: ["libprocessgroup_test_defaults"],
|
||||
srcs: [
|
||||
"test.cpp",
|
||||
],
|
||||
|
@ -64,11 +72,6 @@ cc_test_host {
|
|||
shared_libs: [
|
||||
"libprotobuf-cpp-full",
|
||||
],
|
||||
cflags: [
|
||||
"-Wall",
|
||||
"-Werror",
|
||||
"-Wno-unused-parameter",
|
||||
],
|
||||
data: [
|
||||
"cgroups.json",
|
||||
"cgroups.recovery.json",
|
||||
|
@ -78,3 +81,28 @@ cc_test_host {
|
|||
"general-tests",
|
||||
],
|
||||
}
|
||||
|
||||
cc_test {
|
||||
name: "vts_processgroup_validate_test",
|
||||
defaults: ["libprocessgroup_test_defaults"],
|
||||
srcs: [
|
||||
"test_vendor.cpp",
|
||||
],
|
||||
static_libs: [
|
||||
"libgmock",
|
||||
"libjsonpbverify",
|
||||
"libjsonpbparse",
|
||||
"libprocessgroup_proto",
|
||||
],
|
||||
shared_libs: [
|
||||
"libbase",
|
||||
"liblog",
|
||||
"libjsoncpp",
|
||||
"libprotobuf-cpp-full",
|
||||
],
|
||||
target: {
|
||||
android: {
|
||||
test_config: "vts_processgroup_validate_test.xml",
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
#
|
||||
# Copyright (C) 2019 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.
|
||||
#
|
||||
|
||||
LOCAL_PATH := $(call my-dir)
|
||||
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_MODULE := VtsProcessgroupValidateTest
|
||||
-include test/vts/tools/build/Android.host_config.mk
|
|
@ -0,0 +1,71 @@
|
|||
/*
|
||||
* Copyright (C) 2019 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.
|
||||
*/
|
||||
|
||||
#include <android-base/file.h>
|
||||
#include <gtest/gtest.h>
|
||||
#include <jsonpb/json_schema_test.h>
|
||||
|
||||
#include "cgroups_test.h"
|
||||
#include "task_profiles_test.h"
|
||||
|
||||
using ::android::base::GetExecutableDirectory;
|
||||
using namespace ::android::jsonpb;
|
||||
|
||||
namespace android {
|
||||
namespace profiles {
|
||||
|
||||
static constexpr const char* kVendorCgroups = "/vendor/etc/cgroups.json";
|
||||
static constexpr const char* kVendorTaskProfiles = "/vendor/etc/task_profiles.json";
|
||||
|
||||
template <typename T>
|
||||
class TestConfig : public JsonSchemaTestConfig {
|
||||
public:
|
||||
TestConfig(const std::string& path) : file_path_(path){};
|
||||
std::unique_ptr<google::protobuf::Message> CreateMessage() const override {
|
||||
return std::make_unique<T>();
|
||||
}
|
||||
std::string file_path() const override { return file_path_; }
|
||||
bool optional() const override {
|
||||
// Ignore when vendor JSON files are missing.
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
std::string file_path_;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
JsonSchemaTestConfigFactory MakeTestParam(const std::string& path) {
|
||||
return [path]() { return std::make_unique<TestConfig<T>>(path); };
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(VendorCgroups, JsonSchemaTest,
|
||||
::testing::Values(MakeTestParam<Cgroups>(kVendorCgroups)));
|
||||
INSTANTIATE_TEST_SUITE_P(VendorCgroups, CgroupsTest,
|
||||
::testing::Values(MakeTestParam<Cgroups>(kVendorCgroups)));
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(VendorTaskProfiles, JsonSchemaTest,
|
||||
::testing::Values(MakeTestParam<TaskProfiles>(kVendorTaskProfiles)));
|
||||
INSTANTIATE_TEST_SUITE_P(VendorTaskProfiles, TaskProfilesTest,
|
||||
::testing::Values(MakeTestParam<TaskProfiles>(kVendorTaskProfiles)));
|
||||
|
||||
} // namespace profiles
|
||||
} // namespace android
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
::testing::InitGoogleTest(&argc, argv);
|
||||
return RUN_ALL_TESTS();
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2019 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="Config for VtsProcessgroupValidateTest">
|
||||
<option name="config-descriptor:metadata" key="plan" value="vts-treble" />
|
||||
<target_preparer class="com.android.compatibility.common.tradefed.targetprep.VtsFilePusher">
|
||||
<option name="abort-on-push-failure" value="false"/>
|
||||
<option name="push-group" value="HostDrivenTest.push"/>
|
||||
</target_preparer>
|
||||
<test class="com.android.tradefed.testtype.VtsMultiDeviceTest">
|
||||
<option name="test-module-name" value="VtsProcessgroupValidateTest"/>
|
||||
<option name="binary-test-working-directory" value="_32bit::/data/nativetest/" />
|
||||
<option name="binary-test-working-directory" value="_64bit::/data/nativetest64/" />
|
||||
<option name="binary-test-source" value="_32bit::DATA/nativetest/vts_processgroup_validate_test/vts_processgroup_validate_test" />
|
||||
<option name="binary-test-source" value="_64bit::DATA/nativetest64/vts_processgroup_validate_test/vts_processgroup_validate_test" />
|
||||
<option name="binary-test-type" value="gtest"/>
|
||||
<option name="binary-test-disable-framework" value="false"/>
|
||||
<option name="test-timeout" value="30s"/>
|
||||
</test>
|
||||
</configuration>
|
Loading…
Reference in New Issue