Commit f6b486b8 authored by dbarbera's avatar dbarbera
Browse files

Refactor test execution

parent 3a6a9beb
all: compile-all
regression:
make -C tests/regression all
test-parse:
@python tests/test.py test-parse
test-ada:
@python tests/test.py test-ada
flake8:
@echo Generating flake8_report file
flake8 opengeode.py sdlSymbols.py genericSymbols.py ogParser.py AdaGenerator.py Renderer.py Clipboard.py Lander.py ogAST.py undoCommands.py Connectors.py Asn1scc.py Helper.py Statechart.py >flake8_report
coverage:
coverage:
make -C tests/regression coverage
compile-all:
......
EXAMPLES=test1 test2 test3 test4 test5 test6 test7 test8 test9 test10 test11 test12 test13
all:
for v in $(EXAMPLES) ; do make -C $$v clean all || exit 1 ; done
parse:
for v in $(EXAMPLES) ; do make -C $$v parse || exit 1 ; done
coverage:
for v in $(EXAMPLES) ; do make -C $$v coverage && mv $$v/.coverage* . || exit 1 ; done ; coverage combine
......
all: compile
generate-code:
../../../opengeode.py --toAda og.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py og.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda og.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c og.adb && echo 'All OK!'
parse:
../../../opengeode.py og.pr system_structure.pr --check
gnatmake -c og.adb
coverage:
coverage run -p ../../../opengeode.py og.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda challenge.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py challenge.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda challenge.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb
gcc -c test.c
gnatbind -n challenge.ali
gnatlink -o testcase test.o challenge.ali -lgnat -lm
./testcase > result
diff result expected && echo 'All OK!'
parse:
../../../opengeode.py challenge.pr system_structure.pr --check
./testcase | diff expected -
coverage:
coverage run -p ../../../opengeode.py challenge.pr system_structure.pr --toAda
clean:
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr test
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr testcase
all: compile
generate-code:
../../../opengeode.py --toAda og.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py og.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda og.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb
gcc -c test.c
gnatbind -n og.ali
gnatlink -o testcase test.o og.ali -lgnat
./testcase > result
diff result expected && echo 'All OK!'
parse:
../../../opengeode.py og.pr system_structure.pr --check
./testcase | diff expected -
coverage:
coverage run -p ../../../opengeode.py og.pr system_structure.pr --toAda
clean:
rm -rf result *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr
rm -rf result *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr testcase
all: compile
generate-code:
../../../opengeode.py --toAda trafficlight.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py trafficlight.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda trafficlight.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb && echo 'All OK!'
gnatmake -c *.adb
#gcc -c test.c
#gnatbind -n trafficlight.ali
#gnatlink -o testcase test.o trafficlight.ali -lgnat -lm
parse:
../../../opengeode.py trafficlight.pr system_structure.pr --check
coverage:
coverage run -p ../../../opengeode.py trafficlight.pr system_structure.pr --toAda
......
all: test
all: test-ada
parse:
test-parse:
../../../opengeode.py basic.pr system_structure.pr --check
generate-ada:
@../../../opengeode.py basic.pr system_structure.pr --check --toAda
compile-ada: generate-ada
@asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
@gnatmake -c *.adb
run-ada: compile-ada
@gcc -c test_ada.c
@gnatbind -n basic.ali
@gnatlink test_ada.o basic.ali -lgnat -lm -o testcase
@./testcase | diff expected -
test: run-ada
echo "ALL OK!"
test-ada:
../../../opengeode.py basic.pr system_structure.pr --check --toAda
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c *.adb
gcc -c test_ada.c
gnatbind -n basic.ali
gnatlink test_ada.o basic.ali -lgnat -lm -o testcase
./testcase | diff expected -
clean:
@rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr testcase
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr testcase
all: compile
all: test-ada
generate-code:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
test-parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c orchestrator.adb && echo 'All OK!'
parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
gnatmake -c orchestrator.adb
coverage:
coverage run -p ../../../opengeode.py orchestrator.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda fce.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py fce.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda fce.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c fce.adb && echo 'All OK!'
parse:
../../../opengeode.py fce.pr system_structure.pr --check
gnatmake -c fce.adb
coverage:
coverage run -p ../../../opengeode.py fce.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c orchestrator.adb && echo 'All OK!'
parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
gnatmake -c orchestrator.adb
coverage:
coverage run -p ../../../opengeode.py orchestrator.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda function0.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py function0.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda function0.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c function0.adb && echo 'All OK!'
parse:
../../../opengeode.py function0.pr system_structure.pr --check
gnatmake -c function0.adb
coverage:
coverage run -p ../../../opengeode.py function0.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda myfunction.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py myfunction.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda myfunction.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c myfunction.adb && echo 'All OK!'
parse:
../../../opengeode.py myfunction.pr system_structure.pr --check
gnatmake -c myfunction.adb
coverage:
coverage run -p ../../../opengeode.py myfunction.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c orchestrator.adb && echo 'All OK!'
parse:
../../../opengeode.py orchestrator.pr system_structure.pr --check
gnatmake -c orchestrator.adb
coverage:
coverage run -p ../../../opengeode.py orchestrator.pr system_structure.pr --toAda
clean:
rm -rf *.adb *.ads *.pyc runSpark.sh spark.idx *.o *.ali gnat.cfg examiner bin *.wrn *.gpr
all: compile
generate-code:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py --check orchestrator.pr system_structure.pr
compile: generate-code
test-ada:
../../../opengeode.py --toAda orchestrator.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c orchestrator.adb && echo 'All OK!'
parse:
../../../opengeode.py --check orchestrator.pr system_structure.pr
gnatmake -c orchestrator.adb
coverage:
coverage run -p ../../../opengeode.py orchestrator.pr system_structure.pr --toAda
......
all: compile
generate-code:
../../../opengeode.py --toAda challenge.pr system_structure.pr
all: test-ada
test-parse:
../../../opengeode.py challenge.pr system_structure.pr --check
compile: generate-code
test-ada:
../../../opengeode.py --toAda challenge.pr system_structure.pr
asn1.exe -Ada dataview-uniq.asn -typePrefix asn1Scc -equal
gnatmake -c challenge.adb && echo 'All OK!'
parse:
../../../opengeode.py challenge.pr system_structure.pr --check
gnatmake -c challenge.adb
coverage:
coverage run -p ../../../opengeode.py challenge.pr system_structure.pr --toAda
......
import os
import subprocess
import sys
import time
tests_folder = os.path.dirname(__file__)
paths = [
'regression/test1',
'regression/test2',
'regression/test3',
'regression/test4',
'regression/test5',
'regression/test6',
'regression/test7',
'regression/test8',
'regression/test9',
'regression/test10',
'regression/test11',
'regression/test12',
'regression/test13',
]
def main():
start = time.time()
results = []
for rule in sys.argv[1:]:
for path in paths:
full_path = os.path.join(tests_folder, path)
result = make(full_path, rule)
make(full_path, 'clean')
results.append(result)
sys.stdout.write('.' if result[0] == 0 else 'F')
sys.stdout.flush()
sys.stdout.write('\n')
elapsed = time.time() - start
sys.exit(summarize(results, elapsed))
def make(path, rule):
proc = subprocess.Popen(
['make', '-C', path, rule],
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = proc.communicate()
errcode = proc.wait()
return (errcode, stdout, stderr, path, rule)
def summarize(results, elapsed):
failed = 0
for errcode, stdout, stderr, path, rule in results:
if errcode == 0:
continue
failed += 1
print "======================================================================"
print "ERROR: %s %s" % (path, rule)
if stdout:
print "- stdout -------------------------------------------------------------"
print stdout
if stderr:
print "- stderr -------------------------------------------------------------"
print stderr
print "----------------------------------------------------------------------"
print "Finished in %.3fs" % elapsed
print "%s tests, %s errors" % (len(results), failed)
return 0 if not failed else 1
if __name__ == '__main__':
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