blob: b37e3e625998faa52ddf135ab5782b1079982713 [file] [log] [blame]
Yifan Hong72ff5852019-02-13 14:32:34 -08001/*
2 * Copyright (C) 2019 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
Yifan Hong72ff5852019-02-13 14:32:34 -080017#include <android-base/file.h>
Yifan Hong28a44eb2019-03-04 15:22:37 -080018#include <gtest/gtest.h>
Yifan Hong72ff5852019-02-13 14:32:34 -080019#include <jsonpb/json_schema_test.h>
20
Yifan Hong28a44eb2019-03-04 15:22:37 -080021#include "cgroups_test.h"
22#include "task_profiles_test.h"
Yifan Hong72ff5852019-02-13 14:32:34 -080023
24using namespace ::android::jsonpb;
25using ::android::base::GetExecutableDirectory;
Yifan Hong72ff5852019-02-13 14:32:34 -080026
27namespace android {
28namespace profiles {
29
30template <typename T>
31JsonSchemaTestConfigFactory MakeTestParam(const std::string& path) {
32 return jsonpb::MakeTestParam<T>(GetExecutableDirectory() + path);
33}
34
Yifan Hong72ff5852019-02-13 14:32:34 -080035// Test suite instantiations
Haibo Huangcf8a5b02019-11-08 12:15:11 -080036INSTANTIATE_TEST_SUITE_P(Cgroups, JsonSchemaTest,
Yifan Hong72ff5852019-02-13 14:32:34 -080037 ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"),
38 MakeTestParam<Cgroups>("/cgroups.recovery.json"),
39 MakeTestParam<TaskProfiles>("/task_profiles.json")));
Haibo Huangcf8a5b02019-11-08 12:15:11 -080040INSTANTIATE_TEST_SUITE_P(Cgroups, CgroupsTest,
Yifan Hong72ff5852019-02-13 14:32:34 -080041 ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"),
42 MakeTestParam<Cgroups>("/cgroups.recovery.json")));
Haibo Huangcf8a5b02019-11-08 12:15:11 -080043INSTANTIATE_TEST_SUITE_P(TaskProfiles, TaskProfilesTest,
Yifan Hong72ff5852019-02-13 14:32:34 -080044 ::testing::Values(MakeTestParam<TaskProfiles>("/task_profiles.json")));
45
46} // namespace profiles
47} // namespace android
48
49int main(int argc, char** argv) {
50 ::testing::InitGoogleTest(&argc, argv);
51 return RUN_ALL_TESTS();
52}