-
-
Notifications
You must be signed in to change notification settings - Fork 45
/
.ci.cmake
209 lines (207 loc) · 10.7 KB
/
.ci.cmake
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
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# CTest script for a CI to submit to CDash a run of configuration,
# building and testing
cmake_minimum_required(VERSION 3.1 FATAL_ERROR)
include(cmake/QuickCppLibBootstrap.cmake)
include(QuickCppLibUtils)
CONFIGURE_CTEST_SCRIPT_FOR_CDASH("llfio" "prebuilt")
#list(APPEND CTEST_CONFIGURE_OPTIONS -DCMAKE_BUILD_TYPE=${CTEST_CONFIGURATION_TYPE} -DCXX_COROUTINES_FLAGS=)
ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY})
if(WIN32)
find_program(BASH_COMMAND bash HINTS "C:/Program Files/Git/bin")
checked_execute_process("Checking bash binary works"
COMMAND "${BASH_COMMAND}" --version
)
endif()
include(FindGit)
set(CTEST_GIT_COMMAND "${GIT_EXECUTABLE}")
ctest_start("Experimental")
#ctest_update()
message(STATUS "NOTE: CTEST_CONFIGURE_OPTIONS are '${CTEST_CONFIGURE_OPTIONS}'")
ctest_configure(OPTIONS "${CTEST_CONFIGURE_OPTIONS}")
if(NOT "$ENV{CXX}" MATCHES "g\\+\\+") ## Avoid ICE for header only build in GCC
ctest_build(TARGET _hl)
endif()
ctest_build(TARGET _dl)
ctest_build(TARGET _sl)
set(retval 0)
if(NOT CTEST_DISABLE_TESTING)
# shared_fs_mutex takes too long on CI
# tls_socket_handle is unstable
# dynamic_thread_pool_group is unstable
set(LLFIO_DISABLE_TESTS "shared_fs_mutex|tls_socket_handle|dynamic_thread_pool_group")
if(WIN32)
# Azure's Windows version doesn't permit unprivileged creation of symbolic links
if(CTEST_CMAKE_GENERATOR MATCHES "Visual Studio 15 2017.*")
ctest_test(RETURN_VALUE retval EXCLUDE "${LLFIO_DISABLE_TESTS}|symlink|process_handle")
else()
ctest_test(RETURN_VALUE retval EXCLUDE "${LLFIO_DISABLE_TESTS}|symlink")
endif()
elseif(APPLE)
# Around Feb 2021 the Mac OS CI began failing pipe_handle and I don't have a Mac to diagnose
ctest_test(RETURN_VALUE retval EXCLUDE "${LLFIO_DISABLE_TESTS}|pipe_handle")
else()
ctest_test(RETURN_VALUE retval EXCLUDE "${LLFIO_DISABLE_TESTS}")
endif()
endif()
if(WIN32)
if(EXISTS "prebuilt/bin/Release/llfio_dl-2.0-Windows-AMD64-Release.dll")
file(DOWNLOAD "https://github.com/ned14/outcome/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/outcome.tgz")
file(DOWNLOAD "https://github.com/ned14/quickcpplib/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/quickcpplib.tgz")
checked_execute_process("Tarring up binaries 0"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "outcome.tgz"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "quickcpplib.tgz"
)
checked_execute_process("Tarring up binaries 1"
COMMAND "${CMAKE_COMMAND}" -E make_directory llfio/prebuilt/bin/Release
COMMAND "${CMAKE_COMMAND}" -E make_directory llfio/prebuilt/lib/Release
COMMAND "${CMAKE_COMMAND}" -E copy_directory doc llfio/doc/
COMMAND "${CMAKE_COMMAND}" -E copy_directory example llfio/example/
COMMAND "${CMAKE_COMMAND}" -E copy_directory include llfio/include/
)
checked_execute_process("Tarring up binaries 2"
COMMAND "${CMAKE_COMMAND}" -E copy Build.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy index.html llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Licence.txt llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Readme.md llfio/
)
checked_execute_process("Tarring up binaries 3"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/Release/llfio_sl-2.0-Windows-AMD64-Release.lib llfio/prebuilt/lib/Release/
)
checked_execute_process("Tarring up binaries 4"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/Release/llfio_dl-2.0-Windows-AMD64-Release.lib llfio/prebuilt/lib/Release/
)
checked_execute_process("Tarring up binaries 5"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/bin/Release/llfio_dl-2.0-Windows-AMD64-Release.dll llfio/prebuilt/bin/Release/
)
if(EXISTS "prebuilt/bin/Release/ntkernel-error-category_dl-1.0-Windows-AMD64-Release.dll")
checked_execute_process("Tarring up binaries 6"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/Release/ntkernel-error-category_sl-1.0-Windows-AMD64-Release.lib llfio/prebuilt/lib/Release/
)
checked_execute_process("Tarring up binaries 7"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/Release/ntkernel-error-category_dl-1.0-Windows-AMD64-Release.lib llfio/prebuilt/lib/Release/
)
checked_execute_process("Tarring up binaries 8"
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/bin/Release/ntkernel-error-category_dl-1.0-Windows-AMD64-Release.dll llfio/prebuilt/bin/Release/
)
endif()
checked_execute_process("Tarring up binaries 9"
COMMAND "${BASH_COMMAND}" -c "mv ned14-outcome* llfio/include/outcome"
COMMAND "${BASH_COMMAND}" -c "mv ned14-quickcpplib* llfio/include/quickcpplib"
)
checked_execute_process("Tarring up binaries final"
COMMAND "${CMAKE_COMMAND}" -E tar cfv llfio-v2.0-binaries-win64.zip --format=zip llfio/
)
get_filename_component(toupload llfio-v2.0-binaries-win64.zip ABSOLUTE)
endif()
else()
if(EXISTS "prebuilt/lib/libllfio_dl-2.0-Linux-x86_64-Release.so")
file(DOWNLOAD "https://github.com/ned14/outcome/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/outcome.tgz")
file(DOWNLOAD "https://github.com/ned14/quickcpplib/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/quickcpplib.tgz")
checked_execute_process("Tarring up binaries 0"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "outcome.tgz"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "quickcpplib.tgz"
)
checked_execute_process("Tarring up binaries 1"
COMMAND "${CMAKE_COMMAND}" -E make_directory llfio/prebuilt/lib
COMMAND "${CMAKE_COMMAND}" -E copy_directory doc llfio/doc/
COMMAND "${CMAKE_COMMAND}" -E copy_directory example llfio/example/
COMMAND "${CMAKE_COMMAND}" -E copy_directory include llfio/include/
COMMAND "${CMAKE_COMMAND}" -E copy Build.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy index.html llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Licence.txt llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Readme.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_sl-2.0-Linux-x86_64-Release.a llfio/prebuilt/lib/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_dl-2.0-Linux-x86_64-Release.so llfio/prebuilt/lib/
)
checked_execute_process("Tarring up binaries 2"
COMMAND bash -c "mv ned14-outcome* llfio/include/outcome"
COMMAND bash -c "mv ned14-quickcpplib* llfio/include/quickcpplib"
)
checked_execute_process("Tarring up binaries 3"
COMMAND "${CMAKE_COMMAND}" -E tar cfz llfio-v2.0-binaries-linux-x64.tgz llfio
)
get_filename_component(toupload llfio-v2.0-binaries-linux-x64.tgz ABSOLUTE)
endif()
if(EXISTS "prebuilt/lib/libllfio_dl-2.0-Linux-armhf-Release.so")
file(DOWNLOAD "https://github.com/ned14/outcome/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/outcome.tgz")
file(DOWNLOAD "https://github.com/ned14/quickcpplib/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/quickcpplib.tgz")
checked_execute_process("Tarring up binaries 0"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "outcome.tgz"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "quickcpplib.tgz"
)
checked_execute_process("Tarring up binaries 1"
COMMAND "${CMAKE_COMMAND}" -E make_directory llfio/prebuilt/lib
COMMAND "${CMAKE_COMMAND}" -E copy_directory doc llfio/doc/
COMMAND "${CMAKE_COMMAND}" -E copy_directory example llfio/example/
COMMAND "${CMAKE_COMMAND}" -E copy_directory include llfio/include/
COMMAND "${CMAKE_COMMAND}" -E copy Build.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy index.html llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Licence.txt llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Readme.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_sl-2.0-Linux-armhf-Release.a llfio/prebuilt/lib/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_dl-2.0-Linux-armhf-Release.so llfio/prebuilt/lib/
)
checked_execute_process("Tarring up binaries 2"
COMMAND bash -c "mv ned14-outcome* llfio/include/outcome"
COMMAND bash -c "mv ned14-quickcpplib* llfio/include/quickcpplib"
)
checked_execute_process("Tarring up binaries 3"
COMMAND "${CMAKE_COMMAND}" -E tar cfz llfio-v2.0-binaries-linux-armhf.tgz llfio
)
get_filename_component(toupload llfio-v2.0-binaries-linux-armhf.tgz ABSOLUTE)
endif()
if(EXISTS "prebuilt/lib/libllfio_dl-2.0-Darwin-arm64-Release.dylib")
file(DOWNLOAD "https://github.com/ned14/outcome/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/outcome.tgz")
file(DOWNLOAD "https://github.com/ned14/quickcpplib/tarball/master" "${CMAKE_CURRENT_LIST_DIR}/quickcpplib.tgz")
checked_execute_process("Tarring up binaries 0"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "outcome.tgz"
COMMAND "${CMAKE_COMMAND}" -E tar xfz "quickcpplib.tgz"
)
checked_execute_process("Tarring up binaries 1"
COMMAND "${CMAKE_COMMAND}" -E make_directory llfio/prebuilt/lib
COMMAND "${CMAKE_COMMAND}" -E copy_directory doc llfio/doc/
COMMAND "${CMAKE_COMMAND}" -E copy_directory example llfio/example/
COMMAND "${CMAKE_COMMAND}" -E copy_directory include llfio/include/
COMMAND "${CMAKE_COMMAND}" -E copy Build.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy index.html llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Licence.txt llfio/
COMMAND "${CMAKE_COMMAND}" -E copy Readme.md llfio/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_sl-2.0-Darwin-arm64-Release.a llfio/prebuilt/lib/
COMMAND "${CMAKE_COMMAND}" -E copy prebuilt/lib/libllfio_dl-2.0-Darwin-arm64-Release.dylib llfio/prebuilt/lib/
)
checked_execute_process("Tarring up binaries 2"
COMMAND bash -c "mv ned14-outcome* llfio/include/outcome"
COMMAND bash -c "mv ned14-quickcpplib* llfio/include/quickcpplib"
)
checked_execute_process("Tarring up binaries 3"
COMMAND "${CMAKE_COMMAND}" -E tar cfz llfio-v2.0-binaries-darwin-arm64.tgz llfio
)
get_filename_component(toupload llfio-v2.0-binaries-darwin-arm64.tgz ABSOLUTE)
endif()
endif()
set(retval2 0)
set(retval3 0)
if(NOT CTEST_DISABLE_TESTING)
if(("$ENV{CXX}" MATCHES "clang") OR ("$ENV{CXX}" MATCHES "g\\+\\+"))
if("$ENV{CXX}" MATCHES "clang")
ctest_build(TARGET _sl-asan)
set(CTEST_CONFIGURATION_TYPE "asan")
ctest_test(RETURN_VALUE retval2 INCLUDE "llfio_sl" EXCLUDE "shared_fs_mutex")
else()
set(retval2 0)
endif()
ctest_build(TARGET _sl-ubsan)
set(CTEST_CONFIGURATION_TYPE "ubsan")
ctest_test(RETURN_VALUE retval3 INCLUDE "llfio_sl" EXCLUDE "shared_fs_mutex")
endif()
merge_junit_results_into_ctest_xml()
endif()
if(EXISTS "${toupload}")
ctest_upload(FILES "${toupload}")
endif()
ctest_submit()
if(NOT retval EQUAL 0 OR NOT retval2 EQUAL 0 OR NOT retval3 EQUAL 0)
message(FATAL_ERROR "FATAL: Running tests exited with ${retval} ${retval2} ${retval3}")
else()
message(STATUS "SUCCESS: Running tests exited with ${retval} ${retval2} ${retval3}")
endif()