예제 #1
0
파일: Log_Test.py 프로젝트: mlozborne/motin
 def test_log(self):
     gLog.open("2", 10)
     gLog.print(
         """
                 Expected output:
                     Interleaved output from multiple threads
                     Each thread logs
                         (a) when it is starting
                         (b) multiple lines of output
                         (c) when it has ended
                     There should be NO BLANK LINES in the log and
                     each line should contain output from a single thread.
                     The line '....MIDPOINT...' appears half way through.
                     In the first half lines are about 90 characters long.
                     In the second half lines are twice as long.
         """
     )
     for digit in range(10):
         PrintManyLinesToLog(str(digit)).start()
     sleep(2)
     gLog.flush()
     gLog.print("...................... MIDPOINT.........................")
     for digit in range(10):
         PrintManyLinesToLog(str(digit) + str(digit) + str(digit)).start()
     sleep(5)
     gLog.close()
     raise Exception("EXCEPTION EXPECTED: Check correctness of output in file log_test.txt")
예제 #2
0
    throttle = Throttle(name = name, comPkg = comRes.getNextPackage())
    gLog.print("Main: read layout file")
    msg = throttle.readLayout("../../runSoftware/Layout.xml")
    sleep(2)
    responseFlag, code = (msg.responseFlag, msg.code)
    gLog.print("Main: finished reading layout file: responseFlag = {0} and code ={1}".format(responseFlag, code))
    if responseFlag != 1:
        print("ABEND")
        print("Error in XML file with flag = {0} and code = {1}".format(responseFlag, code))
        print("THE END")
        input("press enter to quit")
    throttle.close()

    # Start four gui throttles
    gLog.print("Main: begin start four GuiThrottleProcess")
    for i in range(4):
        GuiThrottleProcess(name = str(i+1), comPkg = comRes.getNextPackage()).start()
        sleep(1)
    gLog.print("Main: end start four GuiThrottleProcess")
    gLog.flush()

    sleep(1)          ##### WEIRD If sleep is omitted, then the input statement
                      ##### blocks the gui from being displayed.

    raw_input("press enter to quit\n")

    sak.kill("controller")
    sak.kill("simulator")
    gLog.close()