summaryrefslogtreecommitdiffstats
path: root/test cases/common/22 object extraction/check-obj.py
blob: d6afbcc27c9bad336cf14a1ed32d2c8a7faa2067 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env python3

import json
import sys
import os

cc = None
output = None

# Only the ninja backend produces compile_commands.json
if sys.argv[1] == 'ninja':
    with open('compile_commands.json') as f:
        cc = json.load(f)
    output = {x['output'] for x in cc}

for obj in sys.argv[2:]:
    if not os.path.exists(obj):
        sys.exit(f'File {obj} not found.')
    if sys.argv[1] == 'ninja' and obj not in output:
        sys.exit(1)
    print('Verified', obj)