xref: /qemu/tests/tcg/x86_64/system/validate-patch.py (revision 71d337943870b30ed8a137fb14dbf4680ba9ccc7)
1#!/usr/bin/env python3
2#
3# validate-patch.py: check the patch applies
4#
5# This program takes two inputs:
6#   - the plugin output
7#   - the binary output
8#
9# Copyright (C) 2024
10#
11# SPDX-License-Identifier: GPL-2.0-or-later
12
13import sys
14from argparse import ArgumentParser
15
16def main() -> None:
17    """
18    Process the arguments, injest the program and plugin out and
19    verify they match up and report if they do not.
20    """
21    parser = ArgumentParser(description="Validate patch")
22    parser.add_argument('test_output',
23                        help="The output from the test itself")
24    parser.add_argument('plugin_output',
25                        help="The output from plugin")
26    args = parser.parse_args()
27
28    with open(args.test_output, 'r') as f:
29        test_data = f.read()
30    with open(args.plugin_output, 'r') as f:
31        plugin_data = f.read()
32    if "Value: 1" in test_data:
33        sys.exit(0)
34    else:
35        sys.exit(1)
36
37if __name__ == "__main__":
38    main()
39
40