commit:     9c52b98ab84ba81daa915806ac5884076df81090
Author:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
AuthorDate: Thu Dec 16 19:21:30 2021 +0000
Commit:     Fabian Groffen <grobian <AT> gentoo <DOT> org>
CommitDate: Thu Dec 16 19:21:30 2021 +0000
URL:        https://gitweb.gentoo.org/proj/portage-utils.git/commit/?id=9c52b98a

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 <AT> gentoo.org>

 tests/source/dotest | 74 +++++------------------------------------------------
 1 file changed, 6 insertions(+), 68 deletions(-)

diff --git a/tests/source/dotest b/tests/source/dotest
index 426a6cf..51215ba 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

Reply via email to