1 /*
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
17 #include <android-base/file.h>
18 #include <gtest/gtest.h>
19 #include <jsonpb/json_schema_test.h>
20
21 #include "cgroups_test.h"
22 #include "task_profiles_test.h"
23
24 using namespace ::android::jsonpb;
25 using ::android::base::GetExecutableDirectory;
26
27 namespace android {
28 namespace profiles {
29
30 template <typename T>
MakeTestParam(const std::string & path)31 JsonSchemaTestConfigFactory MakeTestParam(const std::string& path) {
32 return jsonpb::MakeTestParam<T>(GetExecutableDirectory() + path);
33 }
34
35 // Test suite instantiations
36 INSTANTIATE_TEST_SUITE_P(Cgroups, JsonSchemaTest,
37 ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"),
38 MakeTestParam<Cgroups>("/cgroups.recovery.json"),
39 MakeTestParam<TaskProfiles>("/task_profiles.json")));
40 INSTANTIATE_TEST_SUITE_P(Cgroups, CgroupsTest,
41 ::testing::Values(MakeTestParam<Cgroups>("/cgroups.json"),
42 MakeTestParam<Cgroups>("/cgroups.recovery.json")));
43 INSTANTIATE_TEST_SUITE_P(TaskProfiles, TaskProfilesTest,
44 ::testing::Values(MakeTestParam<TaskProfiles>("/task_profiles.json")));
45
46 } // namespace profiles
47 } // namespace android
48
main(int argc,char ** argv)49 int main(int argc, char** argv) {
50 ::testing::InitGoogleTest(&argc, argv);
51 return RUN_ALL_TESTS();
52 }
53