• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env python3
2#
3# Copyright (C) 2019 The Android Open Source Project
4#
5# Licensed under the Apache License, Version 2.0 (the "License");
6# you may not use this file except in compliance with the License.
7# You may obtain a copy of the License at
8#
9#       http://www.apache.org/licenses/LICENSE-2.0
10#
11# Unless required by applicable law or agreed to in writing, software
12# distributed under the License is distributed on an "AS IS" BASIS,
13# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14# See the License for the specific language governing permissions and
15# limitations under the License.
16#
17
18import argparse
19import os
20import sys
21
22from abitool import get_abi_tool
23
24def diff_abi(abitool, baseline, new, out_file):
25    tool = get_abi_tool(abitool)
26    return tool.diff_abi(baseline, new, out_file)
27
28def main():
29    """ Build the linux kernel, freshly cloning if needed"""
30    parser = argparse.ArgumentParser()
31    parser.add_argument('--baseline', help='baseline dump to compare to',
32                        required=True)
33    parser.add_argument('--new', help='new dump to compare to baseline',
34                        required=True)
35    parser.add_argument('--abi-tool', default='libabigail',
36                        help='abi tool to be used to monitor abi')
37    parser.add_argument('--report', help='where to write the report to',
38                        required=True)
39
40    args = parser.parse_args()
41
42    abi_changed = diff_abi(args.abi_tool,
43                           args.baseline,
44                           args.new,
45                           args.report)
46    if abi_changed:
47        return 8
48
49if __name__ == "__main__":
50    sys.exit(main())
51