def startTest(stl):
    print "child process started:" + stl.get(Tasks.StaticVariables.SERVERNAME)
    #start the test script on client.
    sct = StartClientTask()
    Tasks.Command.displayTaskState(sct.getStat())
    sct.execute(stl)
    Tasks.Command.displayTaskState(sct.getStat())
              
    #monitor iserver
    mls = MonitorLinuxServerTask()
    Tasks.Command.displayTaskState(mls.getStat())
    mls.execute(stl)
    Tasks.Command.displayTaskState(mls.getStat())
                     
    #stop client
    stct = StopClientTask()
    Tasks.Command.displayTaskState(stct.getStat())
    stct.execute(stl)
    Tasks.Command.displayTaskState(stct.getStat())
    
    #downlod log file.
    dlf = DownloadLogFileTask()
    Tasks.Command.displayTaskState(dlf.getStat())
    state = dlf.execute(stl)
    Tasks.Command.displayTaskState(dlf.getStat()) 
    def execute(self):
        
        s = State()
        configlocation = self.configPath
        cf = ConfigParser.ConfigParser()
        cf.read(configlocation)
        parameters=cf.items("Config")
        for item in parameters:
            s.put(item[0], item[1])
            
        #init the email tolist
        emailToListStr = s.get(Tasks.StaticVariables.EMAILTOLIST)
        emailToList = emailToListStr.split(";")
        s.put(Tasks.StaticVariables.EMAILTOLIST.lower(), emailToList)
        #init the logger
        logger = Logger(s.get(Tasks.StaticVariables.SERVERNAME)+"_"+s.get(Tasks.StaticVariables.BUILDNO),1)
        s.put(Tasks.StaticVariables.LINUXTESTLOGGER,logger)
        
        Ibuildno = raw_input("please input the build number:")
        if Ibuildno != "":
            s.put(Tasks.StaticVariables.BUILDNO,Ibuildno)
    
        Ibuildversion = raw_input("please input the build versiton(DEBUG/RELEASE):")
        if Ibuildno != "":
            s.put(Tasks.StaticVariables.BUILDVERSION,Ibuildversion.upper())


        #install build on Linux
        inb = InstallLinuxBuildTask()
        Tasks.Command.displayTaskState(inb.getStat())
        state = inb.execute(s)
        Tasks.Command.displayTaskState(inb.getStat())
        if state != TaskStatus.PASS:
            exit()
     
        #configure dsn on Linux
        cld = CreateLinuxDSNTask()
        Tasks.Command.displayTaskState(cld.getStat())
        state = cld.execute(s)
        Tasks.Command.displayTaskState(cld.getStat())
        if state != TaskStatus.PASS:
            exit()
     
        #configure the performance counter and log size
        cnld = ConfigLinuxDiagTask()
        Tasks.Command.displayTaskState(cnld.getStat())
        state = cnld.execute(s)
        Tasks.Command.displayTaskState(cnld.getStat())
        if state != TaskStatus.PASS:
            exit()
        
        #configure iserver
        cus = ConfigUnixIServerTask()
        Tasks.Command.displayTaskState(cus.getStat())
        state = cus.execute(s)
        Tasks.Command.displayTaskState(cus.getStat())
        if state != TaskStatus.PASS:
            exit()
       
        #start iserver on Linux
        st = StartServerTask();
        Tasks.Command.displayTaskState(st.getStat())
        state = st.execute(s)
        Tasks.Command.displayTaskState(st.getStat())
    
    #     #start the test script on client.
        if state == TaskStatus.PASS:
            sct = StartClientTask()
            Tasks.Command.displayTaskState(sct.getStat())
            sct.execute(s)
            Tasks.Command.displayTaskState(sct.getStat())
     
        # monitor iserver
            mls = MonitorLinuxServerTask()
            Tasks.Command.displayTaskState(mls.getStat())
            mls.execute(s)
            Tasks.Command.displayTaskState(mls.getStat())
            
        #stop client
        stct = StopClientTask()
        Tasks.Command.displayTaskState(stct.getStat())
        stct.execute(s)
        Tasks.Command.displayTaskState(stct.getStat())
    
        # monitor iserver
        dlf = DownloadLogFileTask()
        Tasks.Command.displayTaskState(dlf.getStat())
        state = dlf.execute(s)
        Tasks.Command.displayTaskState(dlf.getStat())
            mls = MonitorLinuxServerTask()
            Tasks.Command.displayTaskState(mls.getStat())
            mls.execute(s)
            Tasks.Command.displayTaskState(mls.getStat())
        
        if taskno == 8:          
        #stop client
            stct = StopClientTask()
            Tasks.Command.displayTaskState(stct.getStat())
            stct.execute(s)
            Tasks.Command.displayTaskState(stct.getStat())
         
        if taskno == 9:
            # monitor iserver
            dlf = DownloadLogFileTask()
            Tasks.Command.displayTaskState(dlf.getStat())
            state = dlf.execute(s)
            Tasks.Command.displayTaskState(dlf.getStat())
        
        if taskno == 10:
            sst = SimulateServerTask()
            Tasks.Command.displayTaskState(sst.getStat())
            simulateFlag = True
            while simulateFlag:
                try:
                    simucmd = raw_input("please input you command:")
#                     print simucmd
                except Exception as e:
                    pass
                if simucmd.find("quit")!=-1:
                    simulateFlag= False