Skip to content

Commit df74645

Browse files
committed
Updating test scripts according to changes
1 parent 88f9227 commit df74645

2 files changed

Lines changed: 38 additions & 47 deletions

File tree

tools/scripts/test_license.sh

Lines changed: 37 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -5,63 +5,54 @@
55

66
# This test checks that all source files correctly have license headers
77

8-
EXCLUDE_LIST="txt|sig|png|jpeg|_static|md|control|html|cfg|gif|result|conf"
8+
DIR=$(git rev-parse --show-toplevel)
9+
pushd "${DIR}" > /dev/null || exit
910

11+
12+
# extensions
13+
EXCLUDE_LIST="png|jpeg|gif|ico|md|sig|mo|xml"
14+
# directories
15+
EXCLUDE_LIST="${EXCLUDE_LIST}|_static|_templates|git-tools|doctrees"
16+
# files
17+
EXCLUDE_LIST="${EXCLUDE_LIST}|forward|README|Doxyfile|allPairs-performance|typos_whitelist|CPPLINT|gitignore"
1018
mylicensecheck() {
11-
licensecheck -r --copyright -l 30 --tail 0 -i "$EXCLUDE_LIST" "$1"
19+
licensecheck --copyright -r -m -l 30 --tail 0 -i "$EXCLUDE_LIST" "$1"
1220
}
1321

14-
DIR=$(git rev-parse --show-toplevel)
15-
pushd "${DIR}" > /dev/null || exit
16-
{ mylicensecheck src & mylicensecheck sql & mylicensecheck include & mylicensecheck pgtap;} | grep "No copyright\|UNKNOWN"
17-
missing1=$(mylicensecheck doc | grep "No copyright")
18-
missing2=$(grep --files-without-match 'Creative Commons' doc/*/*.rst)
19-
missing3=$(mylicensecheck docqueries | grep "No copyright")
20-
missing4=$(grep --files-without-match 'Creative Commons' docqueries/*/*.pg)
21-
popd > /dev/null || exit
2222

23-
#mylicensecheck doc
2423
error=0
24+
copyr=""
25+
missing=""
26+
NAMES=("doc" "src" "include" "docqueries" "pgtap" "sql" "tools" "ci" "cmake" "doxygen")
27+
for n in "${NAMES[@]}" ; do
28+
results=$(mylicensecheck "${n}")
29+
tmp=$(grep UNKNOWN <<< "${results}")
30+
if [ -n "${tmp}" ] ; then
31+
error=1
32+
missing="$missing ${tmp}"
33+
fi
34+
tmp=$(grep "No copyright" <<< "${results}")
35+
if [ -n "${tmp}" ] ; then
36+
error=1
37+
copyr="${copyr} ${tmp}"
38+
fi
39+
done
40+
41+
if [[ ${copyr} ]]; then
42+
echo " ****************************************************"
43+
echo " *** Found source files without copyright *"
44+
echo " ****************************************************"
45+
echo "${copyr}"
46+
fi
47+
2548
if [[ $missing ]]; then
2649
echo " ****************************************************"
2750
echo " *** Found source files without valid license headers"
2851
echo " ****************************************************"
2952
echo "$missing"
30-
error=1
3153
fi
3254

33-
if [[ $missing1 ]]; then
34-
echo " ****************************************************"
35-
echo " *** Found documentation files without copyright"
36-
echo " ****************************************************"
37-
echo "$missing1"
38-
error=1
39-
fi
40-
41-
if [[ $missing2 ]]; then
42-
echo " ****************************************************"
43-
echo " *** Found documentation files without valid license headers"
44-
echo " ****************************************************"
45-
echo "$missing2"
46-
error=1
47-
fi
48-
49-
if [[ $missing3 ]]; then
50-
echo " ****************************************************"
51-
echo " *** Found docqueries files without copyright"
52-
echo " ****************************************************"
53-
echo "$missing3"
54-
error=1
55-
fi
56-
57-
if [[ $missing4 ]]; then
58-
echo " ****************************************************"
59-
echo " *** Found docqueries files without copyright"
60-
echo " ****************************************************"
61-
echo "$missing4"
62-
error=1
63-
fi
64-
65-
55+
echo the pop
56+
popd > /dev/null || exit ${error}
57+
echo the pop
6658
exit $error
67-

tools/scripts/test_shell.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,5 +27,5 @@ do
2727
code=1
2828
fi
2929
done
30-
popd || exit 1
30+
popd > /dev/null || exit ${code}
3131
exit $code

0 commit comments

Comments
 (0)