#!/usr/bin/env python # -*-Python-*- # This is a simple script that takes a sequence of command-line arguments # that are names of drawing test input files, and for each value # F.drw in this sequence, runs # java draw F.drw F.ps # diff F.std F.ps # counting up and reporting the number of failures and successes. # Feel free to adapt it to your needs. import sys, os, re count = fail = 0 for test in sys.argv[1:]: base = os.path.splitext(test)[0] name = os.path.basename(base) count += 1 if os.system("java draw %s %s.ps >/dev/null 2>&1" % (test, base)) != 0: print "%s: FAILED (execution)" % name fail += 1 continue if os.system("diff %s.std %s.ps >/dev/null" % (base, base)) == 0: print "%s: OK" % name else: print "%s: FAILED (output)" % name fail += 1 if fail == 0: print "Passed all %d tests." % (count,) else: print "Failed %d out of %d tests." % (fail, count)