1 /*
2 * Copyright (C) 2024 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 <unistd.h>
18 #include <string>
19
20 #include <android-base/file.h>
21 #include <vintf/Version.h>
22 #include <vintf/VintfObject.h>
23 #include "utility/ValidateXml.h"
24
TEST(CheckConfig,approvedBuildValidation)25 TEST(CheckConfig, approvedBuildValidation) {
26 if (android::vintf::VintfObject::GetRuntimeInfo()->kernelVersion().dropMinor() <
27 android::vintf::Version{4, 14}) {
28 GTEST_SKIP() << "Kernel versions below 4.14 are exempt";
29 }
30
31 RecordProperty("description",
32 "Verify that the kernel EOL config file "
33 "is valid according to the schema");
34
35 std::string xml_schema_path = android::base::GetExecutableDirectory() + "/kernel_lifetimes.xsd";
36 std::vector<const char*> locations = {"/system/etc/kernel"};
37 EXPECT_ONE_VALID_XML_MULTIPLE_LOCATIONS("kernel-lifetimes.xml", locations,
38 xml_schema_path.c_str());
39 }
40