summaryrefslogtreecommitdiff
path: root/utils/source_builder/RunTestScripts.py
blob: a7f7b49a51f412aa68b6b556571a7117f0f628a5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import sys, os, string, re, time, smtplib, getopt, P4, SystemHelpers

def RunResultingTestFiles(listTestFiles, szErrorResults ):
    while len(listTestFiles):
        szFilename = listTestFiles.pop()
        os.system( szFilename )
        szErrorResult = os.popen( "type errors.txt" ).read()        
        if szErrorResult:
            szErrorResult = "Script failed: " + szFilename + "\n" + szErrorResult
            os.remove("errors.txt")
        szErrorResults += szErrorResult
    return szErrorResults


if __name__ == '__main__':
    szErrorResults = ""
    SystemHelpers.ChangeDir("\\src\\unittests\\autotestscripts\\")
    os.environ['PATH'] += os.pathsep + "d:\\main\\src\\devtools\\bin\\" + \
                          os.pathsep + "d:\\main\\game\\bin\\"
    listTestFiles = SystemHelpers.ListFiles(".py")
    szErrorResults += RunResultingTestFiles(listTestFiles, szErrorResults)
    listTestFiles = SystemHelpers.ListFiles(".cmd")
    szErrorResults += RunResultingTestFiles(listTestFiles, szErrorResults)
    listTestFiles = SystemHelpers.ListFiles(".bat")
    szErrorResults += RunResultingTestFiles(listTestFiles, szErrorResults)
    listTestFiles = SystemHelpers.ListFiles(".pl")
    szErrorResults += RunResultingTestFiles(listTestFiles, szErrorResults)


    print szErrorResults