blob: 6f73ddf117e975402f0ea37584ff1e0285fbb852 (
plain)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
|
Set shell = CreateObject( "WScript.Shell" )
Set fso = CreateObject("Scripting.FileSystemObject")
Set ip = CreateObject("WScript.Network")
Set procEnv = shell.Environment("Process")
' see http://stackoverflow.com/questions/4692542/force-a-vbs-to-run-using-cscript-instead-of-wscript
Sub forceCScriptExecution
Dim Arg, Str
If Not LCase( Right( WScript.FullName, 12 ) ) = "\cscript.exe" Then
For Each Arg In WScript.Arguments
If InStr( Arg, " " ) Then Arg = """" & Arg & """"
Str = Str & " " & Arg
Next
shell.Run """" & VCVARSALL & """" & " && cscript //nologo """ & WScript.ScriptFullName & """" & Str
WScript.Sleep 1000
WScript.Quit
End If
End Sub
ME_NAME = Wscript.ScriptFullName
TEST_DIR = fso.GetParentFolderName(fso.GetFile(ME_NAME))
TESTS = TEST_DIR + "\tests"
HOSTS = TEST_DIR + "\hosts"
HOSTNAME = LCase(ip.ComputerName)
TESTFILE = HOSTS + "\" + HOSTNAME + ".ctest"
VCVARSALL = shell.ExpandEnvironmentStrings("%VCVARSALL%")
If VCVARSALL = "%VCVARSALL%" Then
VCVARSALL = "C:\Program Files\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
End If
if (NOT fso.FileExists(VCVARSALL)) Then
VCVARSALL = "C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat"
End If
if (NOT fso.FileExists(VCVARSALL)) Then
MsgBox("Please export %VCVARSALL% as the command to get a build environment for msvc.")
WScript.Quit
End If
CTEST_SUBMIT_TYPE = shell.ExpandEnvironmentStrings("%CTEST_SUBMIT_TYPE%")
If CTEST_SUBMIT_TYPE = "%CTEST_SUBMIT_TYPE%" Then
CTEST_SUBMIT_TYPE = "Experimental"
procEnv("CTEST_SUBMIT_TYPE") = CTEST_SUBMIT_TYPE
End If
USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%")
If USCXML_SOURCE_DIR = "%USCXML_SOURCE_DIR%" Then
USCXML_SOURCE_DIR = fso.GetParentFolderName(fso.GetParentFolderName(TEST_DIR))
procEnv("USCXML_SOURCE_DIR") = USCXML_SOURCE_DIR
End If
USCXML_SOURCE_DIR = shell.ExpandEnvironmentStrings("%USCXML_SOURCE_DIR%")
if (NOT fso.FileExists(USCXML_SOURCE_DIR + "\CMakeLists.txt")) Then
MsgBox "Could not find uSCXML Source for " + ME_NAME
WScript.Quit
End If
if (NOT fso.FileExists(TESTFILE)) Then
MsgBox "Warning: Could not find test file for this host at " + TESTFILE + " - defaulting"
TESTFILE = HOSTS + "\default.nmake.ctest"
End If
' continue with cscript
forceCScriptExecution
' Aqcuire lock to avoid concurrent builds
' this will throw a permission denied error :(
Set buildLock = fso.OpenTextFile(TESTFILE, 8, True)
' Check github for updates and quit when nothing's new
if (CTEST_SUBMIT_TYPE = "Continuous") Then
shell.CurrentDirectory = USCXML_SOURCE_DIR
Set oExec = shell.Exec("git pull")
GIT_SYNC = oExec.StdOut.ReadLine
if (GIT_SYNC = "Already up-to-date.") Then
WScript.Quit
End If
End If
shell.CurrentDirectory = TEST_DIR
Set exec = shell.Exec("CMD /S /K ctest -VV --timeout 100 -S " + TESTFILE + " -DHOSTNAME=" + HOSTNAME + " 2>&1")
Do While exec.Status = 0
WScript.Sleep 10
WScript.StdOut.Write(exec.StdOut.ReadLine() & vbCRLF)
' WScript.StdErr.Write(exec.StdErr.ReadLine())
Loop
|