aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorFabian Groffen <grobian@gentoo.org>2021-12-16 20:21:30 +0100
committerFabian Groffen <grobian@gentoo.org>2021-12-16 20:21:30 +0100
commit9c52b98ab84ba81daa915806ac5884076df81090 (patch)
tree20db0fe946c5eda6cc82ee4bccb7b682f585480e /tests
parentmain: fix memory overwrite in strincr_var (diff)
downloadportage-utils-9c52b98ab84ba81daa915806ac5884076df81090.tar.gz
portage-utils-9c52b98ab84ba81daa915806ac5884076df81090.tar.bz2
portage-utils-9c52b98ab84ba81daa915806ac5884076df81090.zip
tests/source: remove some checks
these tests are somewhat expensive, so reduce them - style is kind of personal - noone should really have the need to use PATH_MAX any more (wrapped) - combine obsolete funcs and headers Signed-off-by: Fabian Groffen <grobian@gentoo.org>
Diffstat (limited to 'tests')
-rwxr-xr-xtests/source/dotest74
1 files changed, 6 insertions, 68 deletions
diff --git a/tests/source/dotest b/tests/source/dotest
index 426a6cf9..51215ba0 100755
--- a/tests/source/dotest
+++ b/tests/source/dotest
@@ -76,73 +76,11 @@ testit src.typos
#
-# don't allow obsolete functions
+# don't allow obsolete functions or headers (portability)
#
+funcs='\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime)\>[[:space:]]*\('
+hdrs='\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>'
find ${ats} "${src_files[@]}" -print0 | xargs -0 \
- grep -n -E -e '\<(bcmp|bcopy|bzero|getwd|index|mktemp|rindex|utime)\>[[:space:]]*\(' \
- | sed -e "s:^\.\./\.\./::g" > src.obsolete.funcs
-testit src.obsolete.funcs
-
-
-
-#
-# make sure people use our constants
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
- grep -n -E -e '\<PATH_MAX\>' | grep -v _Q_PATH_MAX \
- | sed -e "s:^\.\./\.\./::g" > src.bad.constants
-testit src.bad.constants
-
-
-
-#
-# don't allow obsolete headers
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
- grep -n -E -e '\<(malloc|memory|sys/(errno|fcntl|signal|stropts|termios|unistd))\.h\>' \
- | sed -e "s:^\.\./\.\./::g" > src.obsolete.headers
-testit src.obsolete.headers
-
-
-
-#
-# make sure people use the x* helper funcs
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
- grep -n -E -e '\<(malloc|strdup)[[:space:]]*\(' \
- | grep -v libq/x \
- | sed -e "s:^\.\./\.\./::g" > src.use.xfuncs
-testit src.use.xfuncs
-
-
-#
-# check for style
-#
-find ${ats} "${src_files[@]}" -print0 | xargs -0 \
- grep -n -E \
- -e '\<(for|if|switch|while)\(' \
- -e '\<(for|if|switch|while) \( ' \
- -e ' ;' \
- -e '[[:space:]]$' \
- -e '\){' \
- -e '(^|[^:])//' \
- | sed -e "s:^\.\./\.\./::g" > src.style
-testit src.style
-
-
-#
-# Auto clean up the space issues
-#
-for x in $(find ${ats} "${src_files[@]}" -print); do
- # skip paths we don't have write access to
- touch "$x~" 2>/dev/null || continue
- ${s}/space "$x" > "$x~"
- if ! diff -u "$x" "$x~" ; then
- echo "New file: $x~"
- else
- rm -f "$x~"
- fi
-done > src.space
-testit src.space
-
-end
+ grep -n -E -e "(${funcs}|${hdrs})" \
+ | sed -e "s:^\.\./\.\./::g" > src.obsolete.funcs.hdrs
+testit src.obsolete.funcs.hdrs