xref: /NextBSD/contrib/jansson/test/suites/api/check-exports (revision 33da5adc555b3bc29986eeadca03829e4ad06b1e)
1#!/bin/sh
2#
3# This test checks that libjansson.so exports the correct symbols.
4#
5
6SOFILE="../src/.libs/libjansson.so"
7
8# The list of symbols, which the shared object should export, is read
9# from the def file, which is used in Windows builds
10grep 'json_' $top_srcdir/src/jansson.def \
11    | sed -e 's/ //g' \
12    | sort \
13    >$test_log/exports
14
15nm -D $SOFILE >/dev/null >$test_log/symbols 2>/dev/null \
16    || exit 77  # Skip if "nm -D" doesn't seem to work
17
18grep ' [DT] ' $test_log/symbols | cut -d' ' -f3 | grep -v '^_' | sort >$test_log/output
19
20if ! cmp -s $test_log/exports $test_log/output; then
21    diff -u $test_log/exports $test_log/output >&2
22    exit 1
23fi
24