kpatch/test/test-functions.sh
Josh Poimboeuf 4c1184dcf7 test/unit: add a library for common functions
I placed the library in the top-level test directory, as the same
assertions could also be used by the integration tests once we rework
them a bit.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
2018-04-20 08:16:20 -05:00

13 lines
221 B
Bash

FILE=$1
assert_num_funcs() {
local num_funcs=$(nm $FILE | grep -i " t " | wc -l)
if [[ $num_funcs != $1 ]]; then
echo "$FILE: assertion failed: file has $num_funcs funcs, expected $1" 1>&2
exit 1
fi
return 0
}