use sort -c
This commit is contained in:
12
.github/checks/sorted.sh
vendored
12
.github/checks/sorted.sh
vendored
@@ -4,8 +4,9 @@ SCRIPT_PATH=`dirname $0`
|
|||||||
|
|
||||||
CHECK_DIR=../../src
|
CHECK_DIR=../../src
|
||||||
|
|
||||||
SORT_OPT=-u
|
SORT_OPT="-u -c"
|
||||||
|
|
||||||
|
# $1: filename
|
||||||
function checkarray_quoted_name
|
function checkarray_quoted_name
|
||||||
{
|
{
|
||||||
CHECK_FILE="$1"
|
CHECK_FILE="$1"
|
||||||
@@ -21,17 +22,14 @@ function checkarray_quoted_name
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
|
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||||
|
|
||||||
if cmp --silent -- .a.tmp .b.tmp; then
|
|
||||||
echo ""$1" tables OK"
|
echo ""$1" tables OK"
|
||||||
else
|
else
|
||||||
echo "error: "$1" tables are not sorted."
|
echo "error: "$1" tables are not sorted."
|
||||||
diff -y .a.tmp .b.tmp
|
rm -rf .a.tmp
|
||||||
rm -rf .a.tmp .b.tmp
|
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
rm -rf .a.tmp .b.tmp
|
rm -rf .a.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
31
.github/checks/sorted_codeopt.sh
vendored
31
.github/checks/sorted_codeopt.sh
vendored
@@ -4,8 +4,9 @@ SCRIPT_PATH=`dirname $0`
|
|||||||
|
|
||||||
CHECK_DIR=../../src
|
CHECK_DIR=../../src
|
||||||
|
|
||||||
SORT_OPT=-u
|
SORT_OPT="-u -c"
|
||||||
|
|
||||||
|
# $1: filename
|
||||||
function checkarray
|
function checkarray
|
||||||
{
|
{
|
||||||
CHECK_FILE="$1"
|
CHECK_FILE="$1"
|
||||||
@@ -21,32 +22,38 @@ function checkarray
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
|
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||||
|
echo ""$1" decls sorted."
|
||||||
if cmp --silent -- .a.tmp .b.tmp; then
|
|
||||||
echo ""$1" decls OK"
|
|
||||||
else
|
else
|
||||||
echo "error: "$1" decls are not sorted."
|
echo "error: "$1" decls are not sorted."
|
||||||
diff -y .a.tmp .b.tmp
|
rm -rf .a.tmp
|
||||||
rm -rf .a.tmp .b.tmp
|
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
START="\\/\\* BEGIN SORTED_CODEOPT.SH \\*\\/"
|
START="\\/\\* BEGIN SORTED_CODEOPT.SH \\*\\/"
|
||||||
END="\\/\\* END SORTED_CODEOPT.SH \\*\\/"
|
END="\\/\\* END SORTED_CODEOPT.SH \\*\\/"
|
||||||
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
|
|
||||||
sed -e 's:\(.*##\).*&D\(.*\),.*:\1\2:g' > .a.tmp
|
|
||||||
|
|
||||||
if [[ -z $(grep '[^[:space:]]' .a.tmp) ]] ; then
|
awk '/'"$START"'/{flag=1; count++; next} /'"$END"'/{flag=0;} flag {print count,"##",$0}' "$CHECK_FILE" | \
|
||||||
|
sed -e 's:\(.*##\).*&D\(.*\),.*:\1\2:g' > .b.tmp
|
||||||
|
|
||||||
|
if [[ -z $(grep '[^[:space:]]' .b.tmp) ]] ; then
|
||||||
echo "error: "$1" table is empty"
|
echo "error: "$1" table is empty"
|
||||||
rm -rf .a.tmp
|
rm -rf .a.tmp .b.tmp
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if `LC_COLLATE=C sort $SORT_OPT .b.tmp`; then
|
||||||
|
echo ""$1" tables sorted."
|
||||||
|
else
|
||||||
|
echo "error: "$1" tables are not sorted."
|
||||||
|
rm -rf .a.tmp .b.tmp
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if cmp --silent -- .a.tmp .b.tmp; then
|
if cmp --silent -- .a.tmp .b.tmp; then
|
||||||
echo ""$1" tables OK"
|
echo ""$1" tables OK"
|
||||||
else
|
else
|
||||||
echo "error: "$1" tables are not sorted."
|
echo "error: "$1" tables are different."
|
||||||
diff -y .a.tmp .b.tmp
|
diff -y .a.tmp .b.tmp
|
||||||
rm -rf .a.tmp .b.tmp
|
rm -rf .a.tmp .b.tmp
|
||||||
exit -1
|
exit -1
|
||||||
|
|||||||
12
.github/checks/sorted_opcodes.sh
vendored
12
.github/checks/sorted_opcodes.sh
vendored
@@ -4,8 +4,9 @@ SCRIPT_PATH=`dirname $0`
|
|||||||
|
|
||||||
CHECK_DIR=../../src
|
CHECK_DIR=../../src
|
||||||
|
|
||||||
SORT_OPT=-u
|
SORT_OPT="-u -c"
|
||||||
|
|
||||||
|
# $1: filename
|
||||||
function checkarray_quoted_name
|
function checkarray_quoted_name
|
||||||
{
|
{
|
||||||
CHECK_FILE="$1"
|
CHECK_FILE="$1"
|
||||||
@@ -23,17 +24,14 @@ function checkarray_quoted_name
|
|||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LC_COLLATE=C sort $SORT_OPT .a.tmp > .b.tmp
|
if `LC_COLLATE=C sort $SORT_OPT .a.tmp`; then
|
||||||
|
|
||||||
if cmp --silent -- .a.tmp .b.tmp; then
|
|
||||||
echo ""$1" tables OK"
|
echo ""$1" tables OK"
|
||||||
else
|
else
|
||||||
echo "error: "$1" tables are not sorted."
|
echo "error: "$1" tables are not sorted."
|
||||||
diff -y .a.tmp .b.tmp
|
rm -rf .a.tmp
|
||||||
rm -rf .a.tmp .b.tmp
|
|
||||||
exit -1
|
exit -1
|
||||||
fi
|
fi
|
||||||
rm -rf .a.tmp .b.tmp
|
rm -rf .a.tmp
|
||||||
}
|
}
|
||||||
|
|
||||||
for N in `grep -rl "BEGIN SORTED_OPCODES.SH" "$CHECK_DIR"`; do
|
for N in `grep -rl "BEGIN SORTED_OPCODES.SH" "$CHECK_DIR"`; do
|
||||||
|
|||||||
Reference in New Issue
Block a user