-
Notifications
You must be signed in to change notification settings - Fork 0
/
cdash_client_common.ctest
57 lines (47 loc) · 2.11 KB
/
cdash_client_common.ctest
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
# Everything below this line shouldn't be modified
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "my.cdash.org")
set(CTEST_DROP_URL "/submit.php")
set(CTEST_DROP_LOCATION ${CTEST_DROP_URL}?sitename=${CDASH_SITENAME}&systemname=${CDASH_SYSTEMNAME}&submitinfo=1)
set(CTEST_DROP_SITE_CDASH true)
ctest_submit(FILES ${CDASH_SITE_CONFIG_FILE} RETURN_VALUE res)
IF(NOT "${res}" STREQUAL "0")
MESSAGE(FATAL_ERROR "Cannot submit site file")
ENDIF(NOT "${res}" STREQUAL "0")
# Get the siteid from CDash
SET(CDASH_URL ${CTEST_DROP_METHOD}://${CTEST_DROP_SITE}${CTEST_DROP_URL})
SET(CDASH_CTESTSCRIPT_FILE ${CDASH_TEMP_DIRECTORY}/ctestscript.cdash)
file(DOWNLOAD ${CDASH_URL}?project=OpenStudio&sitename=${CDASH_SITENAME}&systemname=${CDASH_SYSTEMNAME}&getsiteid=1 ${CDASH_CTESTSCRIPT_FILE})
file(READ ${CDASH_CTESTSCRIPT_FILE} CDASH_SITE_ID)
string(STRIP ${CDASH_SITE_ID} CDASH_SITE_ID)
IF(${CDASH_SITE_ID} MATCHES "ERROR:")
MESSAGE(FATAL_ERROR ${CDASH_SITE_ID})
ENDIF(${CDASH_SITE_ID} MATCHES "ERROR:")
IF(${CDASH_SITE_ID} EQUAL "0")
MESSAGE(FATAL_ERROR "Cannot define site id")
ENDIF(${CDASH_SITE_ID} EQUAL "0")
MESSAGE("SiteId="${CDASH_SITE_ID})
# Start the loop
while (${CTEST_ELAPSED_TIME} LESS 36000)
# Check if CDash has a job to run
file(DOWNLOAD ${CDASH_URL}?project=OpenStudio&siteid=${CDASH_SITE_ID}&getjob=1 ${CDASH_CTESTSCRIPT_FILE})
file(STRINGS ${CDASH_CTESTSCRIPT_FILE} firstLine LIMIT_COUNT 1)
IF(${firstLine} EQUAL "0")
MESSAGE("Nothing to do...")
ctest_sleep(20)
ENDIF(${firstLine} EQUAL "0")
# If it's not zero that means CDash has something for me
IF(NOT ${firstLine} EQUAL "0")
# Extract the job schedule id
string(REGEX REPLACE "#" "" jobScheduleId ${firstLine})
# Run the script
MESSAGE("Running script")
SET(CTEST_RUN_CURRENT_SCRIPT 0)
file(READ ${CDASH_CTESTSCRIPT_FILE} scriptFile)
ctest_run_script(${CDASH_CTESTSCRIPT_FILE})
break()
# Mark the job has done
file(DOWNLOAD ${CDASH_URL}?siteid=${CDASH_SITE_ID}&jobdone=1 ${CDASH_CTESTSCRIPT_FILE})
MESSAGE("DONE Running script")
ENDIF(NOT ${firstLine} EQUAL "0")
endwhile(${CTEST_ELAPSED_TIME} LESS 36000)