mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-02-04 17:40:39 +01:00
Merge branch 'tests' into 'master'
Support check-def.sh in meson build See merge request cairo/cairo!248
This commit is contained in:
commit
47645dd674
4 changed files with 81 additions and 5 deletions
|
|
@ -235,7 +235,6 @@ fedora meson build:
|
|||
- ninja -C builddir
|
||||
|
||||
# Run test scripts
|
||||
#- (cd builddir/src && srcdir=../../src bash "$srcdir/check-def.sh") This script calls "make cairo.def" and thus does not work with meson
|
||||
- mkdir builddir/src/.libs
|
||||
- touch builddir/src/.libs/libfoo.so
|
||||
# Run all the tests, except for the big test executable which
|
||||
|
|
|
|||
26
src/make-cairo-def.sh
Normal file
26
src/make-cairo-def.sh
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#!/bin/sh
|
||||
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
if [ $# -lt 3 ];
|
||||
then
|
||||
echo "Generate cairo def file"
|
||||
echo "Usage: $0 <def-filename> <cairo-features-file> <cairo-headers>..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
def_file="$1"
|
||||
cairo_features_h="$2"
|
||||
shift 2
|
||||
|
||||
echo Generating $def_file
|
||||
(echo EXPORTS; \
|
||||
(cat $* || echo 'cairo_ERROR ()' ) | \
|
||||
egrep -v '^# *include' | \
|
||||
( cat "$cairo_features_h" - | cpp -D__cplusplus - || echo 'cairo_ERROR ()' ) | \
|
||||
egrep '^cairo_.* \(' | \
|
||||
sed -e 's/[ ].*//' | \
|
||||
sort; \
|
||||
) > "$def_file"
|
||||
grep -q -v cairo_ERROR "$def_file" || (rm "$def_file"; false)
|
||||
38
src/meson-check-def.sh
Normal file
38
src/meson-check-def.sh
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
#!/bin/sh
|
||||
|
||||
LC_ALL=C
|
||||
export LC_ALL
|
||||
|
||||
if [ $# -lt 2 ];
|
||||
then
|
||||
echo "Check that cairo library has same exported symbols as cairo.def"
|
||||
echo "Usage: $0 <def-filename> <cairo-library>"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
def="$1"
|
||||
so="$2"
|
||||
|
||||
if which nm 2>/dev/null >/dev/null; then
|
||||
:
|
||||
else
|
||||
echo "'nm' not found; skipping test"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
stat=0
|
||||
|
||||
if [ "`uname -s`" = "Linux" ]; then
|
||||
get_cairo_syms='( objdump -t "$so" | grep "^[^ ]* [^l.*]*[.]"; objdump -t "$so" | grep "[.]hidden.*\\<cairo"; ) | sed "s/.* //"'
|
||||
else
|
||||
get_cairo_syms='nm "$so" | grep " [BCDGINRSTVW] " | cut -d" " -f3'
|
||||
fi
|
||||
|
||||
echo Checking that $so has the same symbol list as $def
|
||||
|
||||
{
|
||||
echo EXPORTS
|
||||
eval $get_cairo_syms | c++filt --no-params | grep -v '^_cairo_test_\|^_fini\|^_init\|^_save[fg]pr\|^_rest[fg]pr\|^_Z\|^__gnu\|^__bss\|^_edata\|^_end' | sort -u
|
||||
} | diff "$def" - >&2 || stat=1
|
||||
|
||||
exit $stat
|
||||
|
|
@ -278,7 +278,8 @@ libcairo = library('cairo', cairo_sources,
|
|||
include_directories: incbase,
|
||||
)
|
||||
|
||||
cairo_headers += [configure_file(output: 'cairo-features.h', configuration: feature_conf)]
|
||||
cairo_features_file = configure_file(output: 'cairo-features.h', configuration: feature_conf)
|
||||
cairo_headers += [cairo_features_file]
|
||||
|
||||
libcairo_dep = declare_dependency(link_with: libcairo,
|
||||
dependencies: deps,
|
||||
|
|
@ -298,9 +299,6 @@ install_headers(cairo_headers, subdir: 'cairo')
|
|||
shell = find_program('sh', required: false)
|
||||
if shell.found()
|
||||
test_scripts = [
|
||||
# This script calls back into make to generate cairo.def
|
||||
# TODO: Make this work, somehow
|
||||
#'check-def.sh',
|
||||
'check-doc-syntax.sh',
|
||||
'check-headers.sh',
|
||||
'check-preprocessor-syntax.sh',
|
||||
|
|
@ -316,6 +314,21 @@ if shell.found()
|
|||
env = environment()
|
||||
env.set('CAIRO_HAS_HIDDEN_SYMBOLS', '1')
|
||||
|
||||
cairo_def = custom_target('make-cairo-def',
|
||||
input : cairo_headers,
|
||||
output : 'cairo.def',
|
||||
command : [ shell,
|
||||
meson.current_source_dir()/'make-cairo-def.sh',
|
||||
'@OUTPUT@',
|
||||
cairo_features_file,
|
||||
'@INPUT@'
|
||||
])
|
||||
|
||||
test('check-def', shell,
|
||||
args: ['meson-check-def.sh', cairo_def, libcairo ],
|
||||
env: env,
|
||||
workdir: meson.current_source_dir())
|
||||
|
||||
test('check-plt.sh', shell,
|
||||
args: ['check-plt.sh', libcairo ],
|
||||
env: env,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue