-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.bat
102 lines (88 loc) · 2.79 KB
/
build.bat
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
@ECHO OFF
REM Copyright (c) 2014 "Kaazing Corporation," (www.kaazing.com)
REM
REM This file is part of Robot.
REM
REM Robot is free software: you can redistribute it and/or modify
REM it under the terms of the GNU Affero General Public License as
REM published by the Free Software Foundation, either version 3 of the
REM License, or (at your option) any later version.
REM
REM This program is distributed in the hope that it will be useful,
REM but WITHOUT ANY WARRANTY; without even the implied warranty of
REM MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
REM GNU Affero General Public License for more details.
REM
REM You should have received a copy of the GNU Affero General Public License
REM along with this program. If not, see <http://www.gnu.org/licenses/>.
ECHO Checking if Vagrant and VirtualBox are installed...
REM Check if vagrant command works to see if Vagrant is installed
vagrant -v > vagrant_version 2>&1
SET vagrant=%errorlevel%
IF %vagrant% == 0 (
ECHO Vagrant Version:
TYPE vagrant_version
) ELSE (
ECHO Vagrant is not installed
)
DEL vagrant_version
REM Check if vboxmanage command works to see if VirtualBox is installed (NOTE: assumes it was installed to default location)
"C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" -v > virtualbox_version 2>&1
SET virtualbox=%errorlevel%
IF %virtualbox% == 0 (
ECHO VirtualBox Version:
TYPE virtualbox_version
) ELSE (
ECHO Virtualbox is not installed
)
DEL virtualbox_version
IF %vagrant% == 0 (
IF %virtualbox% == 0 (
REM Prepare vagrant environment and execute script over SSH
vagrant up
ECHO Starting tests...
vagrant ssh -c "sh /vagrant/wrap_run_tests.sh"
vagrant destroy -f
REM Show test results
ECHO =====TEST RESULTS=====
TYPE .\build\test_results.txt
REM Check test results
ECHO Tests complete...
GOTO :CHECK_TEST_RESULTS
) ELSE (
ECHO [WARNING]Tests cannot be run in this environment...nothing will be built
goto :EXIT_FAIL_BUILD
)
) ELSE (
ECHO [WARNING]Tests cannot be run in this environment...nothing will be built
goto :EXIT_FAIL_BUILD
)
:EXIT_SUCCESS
ECHO BUILD SUCCESS
EXIT /B 0
REM Fail build with error level 1 if tests failed (hard fail or timeout)
:CHECK_TEST_RESULTS
FINDSTR FAILED .\build\test_results.txt > NUL 2>&1
SET failed=%errorlevel%
IF %failed% == 0 (
GOTO :EXIT_FAIL_TESTS
) ELSE (
GOTO :CHECK_PASSED
)
REM Fail build with error level 1 if tests failed due to timeout
:CHECK_PASSED
FINDSTR PASSED .\build\test_results.txt > NUL 2>&1
SET passed=%errorlevel%
IF %passed% == 0 (
ECHO Tests Passed
GOTO :EXIT_SUCCESS
) ELSE (
ECHO Tests failed due to timeout. Consider re-running with a higher timeout in example_tests.cpp
GOTO :EXIT_FAIL_TESTS
)
:EXIT_FAIL_BUILD
ECHO Build Failed
EXIT /B 1
:EXIT_FAIL_TESTS
ECHO Tests failed...Failing Build
EXIT /B 1