Skip to content

Commit

Permalink
[tests,ci] Allow to build only tests
Browse files Browse the repository at this point in the history
Signed-off-by: Mariusz Zaborski <[email protected]>
  • Loading branch information
oshogbo committed Jun 18, 2024
1 parent db1d16d commit 34d086c
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 22 deletions.
23 changes: 23 additions & 0 deletions .ci/lib/stage-build-test-only.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
stage('build') {
try {
sh '''
meson setup build/ \
--werror \
--prefix="$PREFIX" \
--buildtype="$BUILDTYPE" \
-Dskeleton=disabled \
-Ddirect=disabled \
-Dsgx=disabled \
-Dtests=enabled \
$MESON_OPTIONS
ninja -vC build/
'''
} finally {
archiveArtifacts '''
build/meson-logs/**/*,
'''
}

sh 'rm -rf build'
sh 'git clean -Xf subprojects'
}
14 changes: 14 additions & 0 deletions .ci/linux-tests-only.jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
node('nonsgx_slave && aesni') {
checkout scm

load '.ci/lib/config-docker.jenkinsfile'
docker.build(
"local:${env.BUILD_TAG}",
'-f .ci/ubuntu20.04.dockerfile .'
).inside("${env.DOCKER_ARGS_COMMON} --security-opt seccomp=${env.WORKSPACE}/scripts/docker_seccomp_mar_2021.json") {
load '.ci/lib/config.jenkinsfile'
load '.ci/lib/config-clang.jenkinsfile'

load '.ci/lib/stage-build-test-only.jenkinsfile'
}
}
6 changes: 4 additions & 2 deletions libos/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ if host_machine.cpu_family() == 'x86_64'
cflags_libos += ['-mfxsr', '-mxsave']
endif

subdir('include')
subdir('src')
if src_build
subdir('include')
subdir('src')
endif

if enable_tests
subdir('test')
Expand Down
2 changes: 1 addition & 1 deletion libos/test/regression/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ if host_machine.cpu_family() == 'x86_64'
}
endif

if sgx
if sgx or force_sgx_tests
tests += {
'attestation': {
# for `sgx_arch.h`
Expand Down
40 changes: 26 additions & 14 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ vtune = get_option('vtune') == 'enabled'

enable_libgomp = get_option('libgomp') == 'enabled'
enable_tests = get_option('tests') == 'enabled'
force_sgx_tests = get_option('force_sgx_tests') == 'enabled'

src_build = skeleton or direct or sgx

cc = meson.get_compiler('c')
host_has_glibc = cc.get_define('__GLIBC__', prefix: '#include <features.h>') != ''
Expand Down Expand Up @@ -230,19 +233,22 @@ endif
#
# Dependencies
#
if src_build
tomlc99_proj = subproject('tomlc99-208203af46bdbdb29ba199660ed78d09c220b6c5')
tomlc99_dep = tomlc99_proj.get_variable('tomlc99_dep')
tomlc99_src = tomlc99_proj.get_variable('tomlc99_src')

tomlc99_proj = subproject('tomlc99-208203af46bdbdb29ba199660ed78d09c220b6c5')
tomlc99_dep = tomlc99_proj.get_variable('tomlc99_dep')
tomlc99_src = tomlc99_proj.get_variable('tomlc99_src')

uthash_dep = subproject('uthash-2.1.0').get_variable('uthash_dep')
uthash_dep = subproject('uthash-2.1.0').get_variable('uthash_dep')
endif

mbedtls_proj = subproject('mbedtls-3.6.0')
mbedtls_static_dep = mbedtls_proj.get_variable('mbedtls_static_dep')
mbedtls_pal_dep = mbedtls_proj.get_variable('mbedtls_pal_dep')

curl_proj = subproject('curl-8.8.0')
cjson_proj = subproject('cJSON-1.7.12')
if src_build
curl_proj = subproject('curl-8.8.0')
cjson_proj = subproject('cJSON-1.7.12')
endif

if sgx
# XXX: do not call subproject() from under "if sgx" conditional, because it
Expand Down Expand Up @@ -288,16 +294,22 @@ endif
# The compilation
#

subdir('common')
subdir('pal')
if src_build
subdir('common')
subdir('pal')
endif
subdir('libos')
subdir('python')
subdir('tools')
if src_build
subdir('tools')
endif

if get_option('libc') == 'glibc'
subproject('glibc-2.39-1')
elif get_option('libc') == 'musl'
subproject('musl-1.2.4')
if src_build
if get_option('libc') == 'glibc'
subproject('glibc-2.39-1')
elif get_option('libc') == 'musl'
subproject('musl-1.2.4')
endif
endif

if enable_libgomp
Expand Down
2 changes: 2 additions & 0 deletions meson_options.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ option('libc', type: 'combo', choices: ['none', 'glibc', 'musl'],

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

option('dcap', type: 'combo', choices: ['disabled', 'enabled'],
description: 'Build additional utilities linked against DCAP library')
Expand Down
10 changes: 6 additions & 4 deletions pal/meson.build
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
subdir('include')
subdir('src')
if src_build
subdir('include')
subdir('src')

if enable_tests
subdir('regression')
if enable_tests
subdir('regression')
endif
endif

if debug
Expand Down
3 changes: 2 additions & 1 deletion python/graminelibos/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
_CONFIG_PKGLIBDIR = '@PKGLIBDIR@'
_CONFIG_LIBDIR = '@LIBDIR@'
_CONFIG_SYSLIBDIR = '@SYSLIBDIR@'
_CONFIG_SGX_ENABLED = '@SGX_ENABLED@' == '1'
_CONFIG_SGX_ENABLED = _os.path.exists('@SYSLIBDIR@/gramine/sgx/libpal.so')


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

0 comments on commit 34d086c

Please sign in to comment.