Commit 73c3e085 authored by Daniel Tuulik's avatar Daniel Tuulik
Browse files

Add test mechanism for using ASN types with QGen

parent c3bd0666
......@@ -9,6 +9,8 @@ O=0
TESTQGEN_PARSE=../testqgen.py test-qgen-parse
TESTQGEN_ADA=../testqgen.py test-qgen-ada
TESTQGEN_C=../testqgen.py test-qgen-c
TESTQGEN_ADA_ASN=../testqgen.py test-qgen-ada-asn
TESTQGEN_C_ASN=../testqgen.py test-qgen-c-asn
clean:
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.so *.ali gnat.cfg \
......
......@@ -20,6 +20,12 @@ test-qgen-ada:
test-qgen-c:
$(TESTQGEN_C) $(ROOT_MODEL)
test-qgen-ada-asn:
$(TESTQGEN_ADA_ASN) $(ROOT_MODEL)
test-qgen-c-asn:
$(TESTQGEN_C_ASN) $(ROOT_MODEL)
test-ada: challenge.ali dataview-uniq.o | test_ada.o
$(GNATBIND) -n challenge.ali
......
......@@ -134,22 +134,46 @@ def run_test(op):
jar_name = os.environ.get('JAR_NAME')
jar_path = os.path.join (jar_dir,jar_name)
asntest = False
if op.rule == 'test-qgen-parse':
lang = 'xmi'
elif op.rule == 'test-qgen-ada':
lang = 'ada'
elif op.rule == 'test-qgen-c':
lang = 'c'
elif op.rule == 'test-qgen-c-asn':
asntest = True
lang = 'c'
elif op.rule == 'test-qgen-ada-asn':
asntest = True
lang = 'ada'
else:
# the importer crashes if any other value us used here,
# for now keep xmi as default value
lang = 'xmi'
#expected = file + '.out'
cmd = ['java', '-jar', jar_path, op.root_model,
'--language', lang, '--generate-types',
'--output', 'generated_' + lang,
'--type-prefix', 'asn1QGen']
if asntest:
asn_call = ['asn1.exe', 'dataview-uniq.asn']
p0 = subprocess.Popen(asn_call,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
stdout, stderr = p0.communicate()
errcode = p0.wait()
if errcode != 0:
return (errcode, stdout, stderr, op.root_model, op.rule)
cmd = ['java', '-jar', jar_path, op.root_model,
'--language', lang,
'--output', 'generated_asn_' + lang]
else:
cmd = ['java', '-jar', jar_path, op.root_model,
'--language', lang, '--generate-types',
'--output', 'generated_' + lang,
'--type-prefix', 'asn1QGen']
p1 = subprocess.Popen(cmd,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
......
Supports Markdown
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