package SBST2015; import java.util.List; import java.util.logging.Logger; import Sequenic.T3.CONSTANTS; /** * Top-level shell-command to run a wrapped T3 generator on a given CUT. */ public class GenCmd { // args 0 : full name of CUT // args 1 : path to CUT root classdir // args 2 : path to where to save trace files static public void main(String[] args) throws Exception { Class CUT = Class.forName(args[0]) ; String CUTdir = args[1] ; String tracedir = args[2] ; Common.setCUT(CUT) ; if (CUTdir != null && !CUTdir.equals("null")) Common.setClassDir(CUTdir) ; if (tracedir != null && !tracedir.equals("null")) Common.setTraceDir(tracedir); TimeOut time = new TimeOut(900*1000) ; time.start() ; try { Common.stdSuite() ; } finally { time.interrupt(); } } static public void main1(List args) throws Exception { String[] args_ = { args.get(0), args.get(1), args.get(2) } ; main(args_) ; } static public void main2(String...arg) throws Exception { main(arg) ; } static class TimeOut extends Thread { long TIMEOUT = 600*1000 ; // set time out to this much milli-secs TimeOut(long timeout) { this.TIMEOUT = timeout ; } public void run() { try { System.err.println("** Setting a timer to " + TIMEOUT + " ms."); sleep(TIMEOUT); System.err.println("** T3-gen is forcefully terminated because of timeout!"); System.exit(-1); } catch (Exception e) { // the sleep was interrupted... ok. } } } }