Skip to content

Commit d517dc7

Browse files
committed
[tests,ci] Allow to build only tests
Signed-off-by: Mariusz Zaborski <[email protected]>
1 parent db1d16d commit d517dc7

File tree

8 files changed

+78
-22
lines changed

8 files changed

+78
-22
lines changed
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
stage('build') {
2+
try {
3+
sh '''
4+
meson setup build/ \
5+
--werror \
6+
--prefix="$PREFIX" \
7+
--buildtype="$BUILDTYPE" \
8+
-Dskeleton=disabled \
9+
-Ddirect=disabled \
10+
-Dsgx=disabled \
11+
-Dtests=enabled \
12+
$MESON_OPTIONS
13+
ninja -vC build/
14+
'''
15+
} finally {
16+
archiveArtifacts '''
17+
build/meson-logs/**/*,
18+
'''
19+
}
20+
21+
sh 'rm -rf build'
22+
sh 'git clean -Xf subprojects'
23+
}

.ci/linux-tests-only.jenkinsfile

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
node('nonsgx_slave && aesni') {
2+
checkout scm
3+
4+
load '.ci/lib/config-docker.jenkinsfile'
5+
docker.build(
6+
"local:${env.BUILD_TAG}",
7+
'-f .ci/ubuntu20.04.dockerfile .'
8+
).inside("${env.DOCKER_ARGS_COMMON} --security-opt seccomp=${env.WORKSPACE}/scripts/docker_seccomp_mar_2021.json") {
9+
load '.ci/lib/config.jenkinsfile'
10+
load '.ci/lib/config-clang.jenkinsfile'
11+
12+
load '.ci/lib/stage-build-test-only.jenkinsfile'
13+
}
14+
}

libos/meson.build

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,10 @@ if host_machine.cpu_family() == 'x86_64'
1717
cflags_libos += ['-mfxsr', '-mxsave']
1818
endif
1919

20-
subdir('include')
21-
subdir('src')
20+
if src_build
21+
subdir('include')
22+
subdir('src')
23+
endif
2224

2325
if enable_tests
2426
subdir('test')

libos/test/regression/meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ if host_machine.cpu_family() == 'x86_64'
192192
}
193193
endif
194194

195-
if sgx
195+
if sgx or force_sgx_tests
196196
tests += {
197197
'attestation': {
198198
# for `sgx_arch.h`

meson.build

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ vtune = get_option('vtune') == 'enabled'
5050

5151
enable_libgomp = get_option('libgomp') == 'enabled'
5252
enable_tests = get_option('tests') == 'enabled'
53+
force_sgx_tests = get_option('force_sgx_tests') == 'enabled'
54+
55+
src_build = skeleton or direct or sgx
5356

5457
cc = meson.get_compiler('c')
5558
host_has_glibc = cc.get_define('__GLIBC__', prefix: '#include <features.h>') != ''
@@ -230,19 +233,22 @@ endif
230233
#
231234
# Dependencies
232235
#
236+
if src_build
237+
tomlc99_proj = subproject('tomlc99-208203af46bdbdb29ba199660ed78d09c220b6c5')
238+
tomlc99_dep = tomlc99_proj.get_variable('tomlc99_dep')
239+
tomlc99_src = tomlc99_proj.get_variable('tomlc99_src')
233240

234-
tomlc99_proj = subproject('tomlc99-208203af46bdbdb29ba199660ed78d09c220b6c5')
235-
tomlc99_dep = tomlc99_proj.get_variable('tomlc99_dep')
236-
tomlc99_src = tomlc99_proj.get_variable('tomlc99_src')
237-
238-
uthash_dep = subproject('uthash-2.1.0').get_variable('uthash_dep')
241+
uthash_dep = subproject('uthash-2.1.0').get_variable('uthash_dep')
242+
endif
239243

240244
mbedtls_proj = subproject('mbedtls-3.6.0')
241245
mbedtls_static_dep = mbedtls_proj.get_variable('mbedtls_static_dep')
242246
mbedtls_pal_dep = mbedtls_proj.get_variable('mbedtls_pal_dep')
243247

244-
curl_proj = subproject('curl-8.8.0')
245-
cjson_proj = subproject('cJSON-1.7.12')
248+
if src_build
249+
curl_proj = subproject('curl-8.8.0')
250+
cjson_proj = subproject('cJSON-1.7.12')
251+
endif
246252

247253
if sgx
248254
# XXX: do not call subproject() from under "if sgx" conditional, because it
@@ -288,16 +294,22 @@ endif
288294
# The compilation
289295
#
290296

291-
subdir('common')
292-
subdir('pal')
297+
if src_build
298+
subdir('common')
299+
subdir('pal')
300+
endif
293301
subdir('libos')
294302
subdir('python')
295-
subdir('tools')
303+
if src_build
304+
subdir('tools')
305+
endif
296306

297-
if get_option('libc') == 'glibc'
298-
subproject('glibc-2.39-1')
299-
elif get_option('libc') == 'musl'
300-
subproject('musl-1.2.4')
307+
if src_build
308+
if get_option('libc') == 'glibc'
309+
subproject('glibc-2.39-1')
310+
elif get_option('libc') == 'musl'
311+
subproject('musl-1.2.4')
312+
endif
301313
endif
302314

303315
if enable_libgomp

meson_options.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ option('libc', type: 'combo', choices: ['none', 'glibc', 'musl'],
1111

1212
option('tests', type: 'combo', choices: ['disabled', 'enabled'],
1313
description: 'Build test binaries')
14+
option('force_sgx_tests', type: 'combo', choices: ['disabled', 'enabled'],
15+
description: 'Build sgx tests even if sgx is not enabled')
1416

1517
option('dcap', type: 'combo', choices: ['disabled', 'enabled'],
1618
description: 'Build additional utilities linked against DCAP library')

pal/meson.build

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
1-
subdir('include')
2-
subdir('src')
1+
if src_build
2+
subdir('include')
3+
subdir('src')
34

4-
if enable_tests
5-
subdir('regression')
5+
if enable_tests
6+
subdir('regression')
7+
endif
68
endif
79

810
if debug

python/graminelibos/__init__.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66
_CONFIG_PKGLIBDIR = '@PKGLIBDIR@'
77
_CONFIG_LIBDIR = '@LIBDIR@'
88
_CONFIG_SYSLIBDIR = '@SYSLIBDIR@'
9-
_CONFIG_SGX_ENABLED = '@SGX_ENABLED@' == '1'
9+
_CONFIG_SGX_ENABLED = _os.path.exists('@PKGLIBDIR@/sgx/libpal.so')
10+
1011

1112
if __version__.startswith('@') and not _os.getenv('GRAMINE_IMPORT_FOR_SPHINX_ANYWAY') == '1':
1213
raise RuntimeError(

0 commit comments

Comments
 (0)