basic dump-api tool

This commit is contained in:
Mike McLean 2024-03-29 16:09:15 -04:00 committed by Tomas Kopecek
parent f85f8cf675
commit eedb9352e2
4 changed files with 8198 additions and 0 deletions

View file

@ -0,0 +1,29 @@
import os.path
import subprocess
import unittest
class TestAPICompat(unittest.TestCase):
# path to dump-api script
SCRIPT = os.path.relpath(os.path.dirname(__file__) + '/../../devtools/check-api')
# base api data, as generated by dump-api
BASE = os.path.relpath(os.path.dirname(__file__) + '/data/api.json')
def test_api_compat(self):
cmd = [self.SCRIPT, self.BASE]
proc = subprocess.Popen(cmd, stderr=subprocess.PIPE)
(_, err) = proc.communicate()
status = proc.wait()
errors = 0
for line in err.decode().splitlines():
if line.startswith('ERROR'):
print(line)
errors += 1
if errors or status != 0:
print('Command failed: %s' % ' '.join(cmd))
raise Exception('API verification failed')
# the end