Commit 1300298d authored by Daniel Tuulik's avatar Daniel Tuulik
Browse files

Add update flag and try calling opengeode with --check

parent 7574c1a8
......@@ -9,7 +9,7 @@ test-parse:
@python3 test.py test-parse $(TEST_CASES)
test-qgen-parse:
@python3 test.py test-qgen-parse $(TEST_CASES) -s $(size)
@python3 test.py test-qgen-parse $(TEST_CASES)
test-ada:
@python3 test.py test-ada $(TEST_CASES)
......
......@@ -15,7 +15,7 @@ work3 = ['python', 'testqgen.py']
testsWork = {
'all': work1,
'test-parse' : work1,
'test-qgen-parse' : work2,
'test-qgen-parse' : work3,
'test-ada' : work1,
'test-c' : work1,
'test-llvm' : work1,
......@@ -31,9 +31,9 @@ def colorMe(result, msg):
def parse_args():
''' Parse command line arguments '''
parser = argparse.ArgumentParser()
parser.add_argument('-s', '--size', type=int, default=0)
parser.add_argument('rule', metavar='Rule', type=str)
parser.add_argument('paths', metavar='Path', type=str, nargs='+')
parser.add_argument('-u', '--update', action='store_true')
return parser.parse_args()
def main():
......@@ -42,7 +42,7 @@ def main():
results = []
op = parse_args()
with futures.ProcessPoolExecutor(max_workers=cpu_count()) as executor:
for result in executor.map(partial(partial(make, op.rule), op.size), op.paths):
for result in executor.map(partial(partial(make, op.rule)), op.paths):
print("%40s: %s" % (result[3], colorMe(result[0],
'[OK]' if result[0]==0 else '[FAILED]')))
results.append(result)
......@@ -53,7 +53,7 @@ def main():
return summarize(results, elapsed)
def make(rule, size, path):
def make(rule, path):
''' Call a Makefile with the required rule (e.g. test-ada or clean) '''
''' Choose work settings based on the given rule '''
......@@ -61,10 +61,11 @@ def make(rule, size, path):
''' Compose the command based on the rule'''
if rule=='test-qgen-parse':
cmd=[work[0], work[1], path, rule, 'size='+ str(size)]
cmd=[work[0], work[1], rule, path]
else:
cmd=[work[0], work[1], path, rule]
print (cmd)
proc = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
......
......@@ -7,7 +7,7 @@ test-parse:
$(OPENGEODE) og.pr system_structure.pr --check
test-qgen-parse:
$(TESTQGEN) og.pr system_structure.pr $(size)
$(TESTQGEN) og.pr system_structure.pr
test-ada: og.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n og.ali
......
......@@ -7,7 +7,7 @@ test-parse:
$(OPENGEODE) orchestrator.pr system_structure.pr --check
test-qgen-parse:
$(TESTQGEN) orchestrator.pr system_structure.pr $(size)
$(TESTQGEN) orchestrator.pr system_structure.pr
test-ada: orchestrator.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n orchestrator.ali
......
......@@ -9,15 +9,17 @@ import os
import sys
import logging
import argparse
import subprocess
__version__ = '1.0.0'
LOG = logging.getLogger(__name__)
def parse_args():
''' Parse command line arguments '''
parser = argparse.ArgumentParser(version=__version__)
parser.add_argument('rule', metavar='Rule', type=str)
parser.add_argument('files', metavar='file.pr', type=str, nargs='*',
help='SDL file(s)')
parser.add_argument('size', type=int)
help='SDL file(s)')
parser.add_argument('-u', '--update', action='store_true')
return parser.parse_args()
......@@ -40,14 +42,27 @@ def getSizeFiles(list,size):
LOG.warning(file+ " size " + str(s))
return err
def main():
options = parse_args()
init_logging(options)
size = options.size
if size==0:
size = 9000
return getSizeFiles(options.files,size)
files=''
for file in options.files:
files = files + file + ' '
cmd = ['make ', files, ' --check']
print (cmd)
proc = subprocess.Popen(
cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = proc.communicate()
errcode = proc.wait()
return (errcode, stdout, stderr)
if __name__ == '__main__':
ret = main()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment