diff options
author | Matthew Leeds <matthew.leeds@endlessm.com> | 2020-06-17 14:35:18 -0700 |
---|---|---|
committer | Matthew Leeds <matthew.leeds@endlessm.com> | 2020-06-17 15:28:15 -0700 |
commit | d21181653ecb678dfa2a6ace422ece17d4e2de77 (patch) | |
tree | 82f529cf2df2bed188075b39403d0c855cf4a576 | |
parent | 33c95812bb54689cd886eb43746508cea7556d61 (diff) | |
download | ostree-d21181653ecb678dfa2a6ace422ece17d4e2de77.tar.gz |
tests: Check that example symbol isn't released
For the motivation for this see #2132.
-rw-r--r-- | tests/kolainst/libtest-core.sh | 10 | ||||
-rwxr-xr-x | tests/test-symbols.sh | 12 |
2 files changed, 22 insertions, 0 deletions
diff --git a/tests/kolainst/libtest-core.sh b/tests/kolainst/libtest-core.sh index 945d2857..64b3e0a3 100644 --- a/tests/kolainst/libtest-core.sh +++ b/tests/kolainst/libtest-core.sh @@ -115,6 +115,16 @@ assert_file_has_content () { done } +assert_file_has_content_once () { + fpath=$1 + shift + for re in "$@"; do + if ! test $(grep -e "$re" "$fpath" | wc -l) = "1"; then + _fatal_print_file "$fpath" "File '$fpath' doesn't match regexp '$re' exactly once" + fi + done +} + assert_file_has_content_literal () { fpath=$1; shift for s in "$@"; do diff --git a/tests/test-symbols.sh b/tests/test-symbols.sh index f6742d93..8f67a46c 100755 --- a/tests/test-symbols.sh +++ b/tests/test-symbols.sh @@ -21,6 +21,8 @@ set -xeuo pipefail +. $(dirname $0)/libtest.sh + echo '1..3' released_syms=${G_TEST_SRCDIR}/src/libostree/libostree-released.sym @@ -41,6 +43,16 @@ echo "Verifying all expected symbols are actually exported..." grep --no-filename ' ostree_[A-Za-z0-9_]*;' ${released_syms} ${devel_syms} ${experimental_sym} | sed -e 's,^ *\([A-Za-z0-9_]*\);,\1,' | sort -u > expected-symbols.txt eu-readelf -a ${G_TEST_BUILDDIR}/.libs/libostree-1.so | grep 'FUNC.*GLOBAL.*DEFAULT.*@@LIBOSTREE_' | sed -e 's,^.* \(ostree_[A-Za-z0-9_]*\)@@LIBOSTREE_[0-9A-Z_.]*,\1,' |sort -u > found-symbols.txt diff -u expected-symbols.txt found-symbols.txt + +echo "Checking that the example symbol wasn't copy-pasted..." +if test -f ${devel_syms}; then + assert_file_has_content_once ${devel_syms} "someostree_symbol_deleteme" +fi +if test -f ${experimental_sym}; then + assert_not_file_has_content ${experimental_sym} "someostree_symbol_deleteme" +fi +assert_not_file_has_content ${released_syms} "someostree_symbol_deleteme" + echo "ok exports" # cmd__private__ is private. The fetcher symbol should not have been made public. |