-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* rewrite tests to work with meson This ports our tests to meson and makes them able to be run in parallel. * add tests to ci * rewrite test/check-trailing-newlines in bash This test was using a GNU sed command which does not work on Alpine Linux.
- Loading branch information
Showing
15 changed files
with
141 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,4 +18,4 @@ set -x | |
|
||
meson build | ||
meson compile -C build | ||
# gmake test | ||
meson test --verbose -C build |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
#!/bin/sh | ||
|
||
top_srcdir=${SOURCE_ROOT:-..} | ||
. ${top_srcdir}/test/setup_env.sh | ||
|
||
ebegin "Checking for obsolete functions" | ||
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \ | ||
! -name queue.h \ | ||
-exec grep -n -E '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' {} +) | ||
[ -z "${out}" ] | ||
eend $? "Avoid these obsolete functions:"$'\n'"${out}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/sh | ||
|
||
top_srcdir=${SOURCE_ROOT:-..} | ||
. ${top_srcdir}/test/setup_env.sh | ||
|
||
ebegin "Checking spacing style" | ||
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \ | ||
! -name queue.h \ | ||
-exec grep -n -E \ | ||
-e '\<(for|if|switch|while)\(' \ | ||
-e '\<(for|if|switch|while) \( ' \ | ||
-e ' ;' \ | ||
-e '[[:space:]]$' \ | ||
-e '\){' \ | ||
-e '(^|[^:])//' \ | ||
{} +) | ||
[ -z "${out}" ] | ||
eend $? "These lines violate style rules:"$'\n'"${out}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
top_srcdir=${SOURCE_ROOT:-..} | ||
. ${top_srcdir}/test/setup_env.sh | ||
|
||
ebegin "Checking trailing newlines in code" | ||
out=$(cd ${top_srcdir}; | ||
for f in $(find */ -name '*.[ch]') ; do | ||
while read -r line; do | ||
if [ -n "${line}" ]; then | ||
blankline= | ||
else | ||
blankline=1 | ||
fi | ||
done < "${f}" | ||
[ -n "${blankline}" ] && printf "%s\n" "${f}" | ||
done) | ||
[ -z "${out}" ] | ||
eend $? "Trailing newlines need to be deleted:"$'\n'"${out}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/bin/sh | ||
|
||
top_srcdir=${SOURCE_ROOT:-..} | ||
. ${top_srcdir}/test/setup_env.sh | ||
|
||
ebegin "Checking trailing whitespace in code" | ||
# XXX: Should we check man pages too ? | ||
out=$(cd ${top_srcdir}; find */ \ | ||
'(' -name '*.[ch]' -o -name '*.in' -o -name '*.sh' ')' \ | ||
-exec grep -n -E '[[:space:]]+$' {} +) | ||
[ -z "${out}" ] | ||
eend $? "Trailing whitespace needs to be deleted:"$'\n'"${out}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
#!/bin/sh | ||
|
||
top_srcdir=${SOURCE_ROOT:-..} | ||
. ${top_srcdir}/test/setup_env.sh | ||
|
||
ebegin "Checking for x* func usage" | ||
out=$(cd ${top_srcdir}; find src -name '*.[ch]' \ | ||
! -name queue.h \ | ||
-exec grep -n -E '\<(malloc|strdup)[[:space:]]*\(' {} + \ | ||
| grep -v \ | ||
-e src/shared/helpers.h \ | ||
-e src/libeinfo/libeinfo.c) | ||
|
||
[ -z "${out}" ] | ||
eend $? "These need to be using the x* variant:"$'\n'"${out}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
if meson.version().version_compare('>=0.56.0') | ||
build_root = meson.project_build_root() | ||
source_root = meson.project_source_root() | ||
else | ||
build_root = meson.build_root() | ||
source_root = meson.source_root() | ||
endif | ||
|
||
test_env = [ | ||
'BUILD_ROOT=' + build_root, | ||
'SOURCE_ROOT=' + source_root | ||
] | ||
|
||
check_obsolete_functions = find_program('check-obsolete-functions.sh') | ||
check_spacing_style = find_program('check-spacing-style.sh') | ||
check_trailing_newlines = find_program('check-trailing-newlines.sh') | ||
check_trailing_whitespace = find_program('check-trailing-whitespace.sh') | ||
check_xfunc_usage = find_program('check-xfunc-usage.sh') | ||
|
||
test('check for obsolete functions', check_obsolete_functions, env : test_env) | ||
test('check spacing style', check_spacing_style, env : test_env) | ||
test('check trailing newlines', check_trailing_newlines, env : test_env) | ||
test('check trailing whitespace', check_trailing_whitespace, env : test_env) | ||
test('check xfunc usage', check_xfunc_usage, env : test_env) | ||
|
||
subdir('units') |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,21 @@ | ||
#!/bin/sh | ||
|
||
if [ -z "${top_srcdir}" ] ; then | ||
echo "You must set top_srcdir before sourcing this file" 1>&2 | ||
if [ -z "${BUILD_ROOT}" ] ; then | ||
printf "%s\n" "You must export BUILD_ROOT before sourcing this file" >&2 | ||
exit 1 | ||
fi | ||
|
||
srcdir=${srcdir:-.} | ||
top_builddir=${top_builddir:-${top_srcdir}} | ||
builddir=${builddir:-${srcdir}} | ||
|
||
LD_LIBRARY_PATH=${top_builddir}/src/libeinfo:${top_builddir}/src/librc:${LD_LIBRARY_PATH} | ||
PATH=${top_builddir}/src/rc:${PATH} | ||
export LD_LIBRARY_PATH PATH | ||
if [ -z "${SOURCE_ROOT}" ] ; then | ||
printf "%s\n" "You must export SOURCE_ROOT before sourcing this file" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f ${top_srcdir}/sh/functions.sh ] ; then | ||
echo "functions.sh not yet created !?" 1>&2 | ||
if [ ! -f ${BUILD_ROOT}/sh/functions.sh ] ; then | ||
printf "%s\n" "functions.sh not yet created !?" >&2 | ||
exit 1 | ||
elif ! . ${top_srcdir}/sh/functions.sh; then | ||
echo "Sourcing functions.sh failed !?" 1>&2 | ||
elif ! . ${BUILD_ROOT}/sh/functions.sh; then | ||
printf "%s\n" "Sourcing functions.sh failed !?" >&2 | ||
exit 1 | ||
fi | ||
|
||
PATH="${BUILD_ROOT}"/src/einfo:${PATH} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,13 @@ | |
# unit test for is_older_than code of baselayout (2008/06/19) | ||
# Author: Matthias Schwarzott <[email protected]> | ||
|
||
TMPDIR=tmp-"$(basename "$0")" | ||
if [ -z "${BUILD_ROOT}" ]; then | ||
printf "%s\n" "BUILD_ROOT must be defined" >&2 | ||
exit 1 | ||
fi | ||
PATH="${BUILD_ROOT}"/src/is_older_than:${PATH} | ||
|
||
TMPDIR="${BUILD_ROOT}"/tmp-"$(basename "$0")" | ||
|
||
# Please note that we added this unit test because the function | ||
# should really be called is_newer_than as it's what it's really testing. | ||
|
@@ -37,13 +43,14 @@ do_test() | |
is_older_than "$@" | ||
r2=$? | ||
|
||
[ -n "${VERBOSE}" ] && echo "reference = $r1 | OpenRC = $r2" | ||
[ -n "${VERBOSE}" ] && | ||
printf "reference = %s | OpenRC = %s\n" "$r1" "$r2" | ||
[ $r1 = $r2 ] | ||
} | ||
|
||
echo_cmd() | ||
{ | ||
[ -n "${VERBOSE}" ] && echo "$@" | ||
[ -n "${VERBOSE}" ] && printf "%s\n" "$@" | ||
"$@" | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
is_older_than = find_program('check-is-older-than.sh') | ||
sh_yesno = find_program('check-sh-yesno.sh') | ||
|
||
test('is_older_than', is_older_than, env : test_env) | ||
test('sh_yesno', sh_yesno, env : test_env) |