Files
android_development/vndk/tools/header-checker/header-abi-util/src/api_level_test.cpp
Logan Chien eb308b6bb5 header-abi-linker: Support solib and version script
This commit allows user to specify both `-so` (for a shared object file)
and `-v` (for a version script).  If both of them are specified, the
generated output will only include the symbols that are marked as
exported in both cases.

This commit also rewritten the version script parser so that it can
work with real version script cases.  This includes how the parser
skips a comment line.

Furthermore, the version script parser accepts a list of excluded symbol
versions and symbol tags that should not be included in the generated
output.  To customize the behavior, pass `--exclude-symbol-version`
and/or `--exclude-symbol-tag` to `header-abi-linker`.

Bug: 122845490
Test: ./tests/test.py
Test: atest  # under development/vndk/tools/header-checker
Change-Id: Ibf048bba6ccd5ac44f265d1fe767c2ded3d13a8d
2019-01-30 11:27:33 +08:00

37 lines
1.0 KiB
C++

// 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 "api_level.h"
#include <gtest/gtest.h>
namespace abi_util {
TEST(ApiLevelTest, ParseApiLevel) {
EXPECT_FALSE(ParseApiLevel(""));
EXPECT_FALSE(ParseApiLevel("A"));
EXPECT_TRUE(ParseApiLevel("current").has_value());
EXPECT_EQ(FUTURE_API_LEVEL, ParseApiLevel("current").value());
EXPECT_TRUE(ParseApiLevel("16").has_value());
EXPECT_EQ(16l, ParseApiLevel("16").value());
}
} // namespace abi_util