Skip to content

Commit c16f1b5

Browse files
authored
Fixing docqueries generator flag -level & updating developer tools (#2723)
* Fixing docqueries generator flag -level & updating developer tools
1 parent 4a68cd3 commit c16f1b5

File tree

3 files changed

+102
-47
lines changed

3 files changed

+102
-47
lines changed

tools/developer/run.sh

Lines changed: 47 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,18 @@ function set_cmake {
5959
#cmake -DWITH_DOC=ON -DBUILD_DOXY=ON ..
6060

6161
# Building using clang
62-
#CXX=clang++ CC=clang cmake -DPOSTGRESQL_BIN=${PGBIN} -DCMAKE_BUILD_TYPE=Debug ..
62+
#CXX=clang++ CC=clang cmake -DPOSTGRESQL_BIN=${PGBIN} -DCMAKE_BUILD_TYPE=Debug -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=OFF ..
6363

64+
# Building with debug on
6465
#cmake -DPOSTGRESQL_BIN=${PGBIN} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DBUILD_LATEX=ON -DCMAKE_BUILD_TYPE=Debug -DES=ON -DPROJECT_DEBUG=ON ..
6566

66-
# building languages -DES=ON -DJA=ON -DZH_HANS=ON -DDE=ON -DKO=ON
67-
#cmake -DPOSTGRESQL_BIN=${PGBIN} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DBUILD_LATEX=ON -DES=ON -DCMAKE_BUILD_TYPE=Debug ..
67+
# building languages -DES=ON -DJA=ON -DZH_HANS=ON -DDE=ON -DKO=ON and CMAKE_EXPORT_COMPILE_COMMANDS for static analysis tools.
68+
#cmake -DPOSTGRESQL_BIN=${PGBIN} -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DBUILD_LATEX=ON -DES=ON -DCMAKE_BUILD_TYPE=Debug ..
6869

6970
# check link in documentation
7071
#cmake -DPOSTGRESQL_BIN=${PGBIN} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DES=ON -DLINKCHECK=ON -DCMAKE_BUILD_TYPE=Release ..
7172

73+
# build only english
7274
cmake -DPOSTGRESQL_BIN=${PGBIN} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DBUILD_LATEX=ON -DCMAKE_BUILD_TYPE=Debug ..
7375
}
7476

@@ -105,14 +107,16 @@ function set_compiler {
105107
echo ------------------------------------
106108

107109
if [ -n "$1" ]; then
108-
update-alternatives --set gcc "/usr/bin/gcc-$1"
110+
export CC="/usr/bin/gcc-$1"
111+
export CXX="/usr/bin/g++-$1"
109112
fi
110113
}
111114

112115
function build_doc {
113116
pushd build > /dev/null || exit 1
114117
#rm -rf doc/* ; rm -rf locale/*/*/*.mo
115-
rm -rf doc/*
118+
# Clean only generated files while preserving custom content
119+
find doc -type f \( -name "*.html" -o -name "*.pdf" \) -delete
116120
make doc
117121
#example on how to only build spanish html
118122
#make html-es
@@ -123,6 +127,30 @@ function build_doc {
123127
popd > /dev/null || exit 1
124128
}
125129

130+
function check {
131+
pushd build > /dev/null || exit 1
132+
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..
133+
134+
# Run with error handling and report generation
135+
cppcheck --project=compile_commands.json \
136+
--enable=all \
137+
--suppress=missingIncludeSystem \
138+
--error-exitcode=1 \
139+
--output-file=cppcheck-report.txt 2>&1 || {
140+
echo "Static analysis failed. See build/cppcheck-report.txt for details"
141+
return 1
142+
}
143+
popd > /dev/null || exit 1
144+
}
145+
146+
function tidy_with_clang {
147+
local base_branch=${1:-"upstream/develop"}
148+
.github/scripts/tidy-vs-commit.sh "$base_branch" || {
149+
echo "clang-tidy checks failed"
150+
return 1
151+
}
152+
}
153+
126154
function build {
127155
pushd build > /dev/null || exit 1
128156
set_cmake
@@ -141,25 +169,30 @@ function test_compile {
141169
build
142170

143171
echo --------------------------------------------
144-
echo Execute tap_directories
172+
echo Execute documentation queries
145173
echo --------------------------------------------
146-
for d in ${TAP_DIRS}
174+
for d in ${QUERIES_DIRS}
147175
do
148-
time bash taptest.sh "${d}" "-p ${PGPORT}"
176+
# generate the documentation queries
177+
#tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -documentation -pgport "${PGPORT}"
178+
# Show warnings
179+
#tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -level WARNING -pgport "${PGPORT}"
180+
# Compare differences on results
181+
tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -pgport "${PGPORT}"
149182
done
150183

151184
echo --------------------------------------------
152-
echo Execute documentation queries
185+
echo Execute tap_directories
153186
echo --------------------------------------------
154-
for d in ${QUERIES_DIRS}
187+
for d in ${TAP_DIRS}
155188
do
156-
#tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -documentation -pgport "${PGPORT}"
157-
#tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -debug1 -pgport "${PGPORT}"
158-
tools/testers/doc_queries_generator.pl -alg "docqueries/${d}" -pgport "${PGPORT}"
189+
time bash taptest.sh "${d}" "-p ${PGPORT}"
159190
done
160191

192+
tap_test
193+
tools/testers/doc_queries_generator.pl -pgport $PGPORT
194+
161195
build_doc
162-
#exit 0
163196
tap_test
164197
action_tests
165198
}

tools/developer/taptest.sh

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,35 @@ if [[ -z $1 ]]; then
2626
exit 1;
2727
fi
2828

29+
# run from root of repository
30+
if ! DIR=$(git rev-parse --show-toplevel 2>/dev/null); then
31+
echo "Error: Must be run from within the git repository" >&2
32+
exit 1
33+
fi
34+
pushd "${DIR}" > /dev/null || exit 1
2935

3036
DIR="$1"
3137
shift
3238
PGFLAGS=$*
39+
if ! VERSION=$(grep -E '^[[:space:]]*project\(PGROUTING[[:space:]]+VERSION[[:space:]]+([^[:space:];]+)' CMakeLists.txt | sed -E 's/.*VERSION[[:space:]]+([^[:space:];]+).*/\1/'); then
40+
echo "Error: Failed to extract version from CMakeLists.txt" >&2
41+
exit 1
42+
fi
43+
44+
if [[ -z "${VERSION}" ]]; then
45+
echo "Error: Version not found in CMakeLists.txt" >&2
46+
exit 1
47+
fi
3348

3449
echo "dir ${DIR}"
3550
echo "pgflags ${PGFLAGS}"
51+
echo "VERSION ${VERSION}"
3652
QUIET="-v"
3753
QUIET="-q"
3854

55+
PGPORT="${PGPORT:-5432}"
56+
PGUSER="${PGUSER:-$USER}"
57+
3958
PGDATABASE="___pgr___test___"
4059
PGRVERSION="3.6.1 3.6.0 3.5.1 3.5.0 3.2.0 3.1.3 3.0.6"
4160
PGRVERSION="3.7.2"
@@ -46,49 +65,51 @@ do
4665
pushd tools/testers/
4766
echo "--------------------------"
4867
echo " Running with version ${v}"
68+
echo " test ${DIR}"
4969
echo "--------------------------"
70+
# give time to developer to read message
71+
sleep 3
5072

5173
dropdb --if-exists "${PGFLAGS}" "${PGDATABASE}"
5274
createdb "${PGFLAGS}" "${PGDATABASE}"
5375

54-
psql "$PGFLAGS" -d "$PGDATABASE" -X -q --set client_min_messages=WARNING --set ON_ERROR_STOP=1 --pset pager=off \
55-
-c "CREATE EXTENSION IF NOT EXISTS pgtap; CREATE EXTENSION IF NOT EXISTS pgrouting WITH VERSION '${v}' CASCADE;"
56-
76+
if ! bash setup_db.sh "${PGPORT}" "${PGDATABASE}" "${PGUSER}" "${v}"; then
77+
echo "Error: Database setup failed" >&2
78+
exit 1
79+
fi
5780
echo "--------------------------"
5881
echo " Installed version"
5982
echo "--------------------------"
6083
psql "${PGFLAGS}" -d "$PGDATABASE" -c "SELECT * FROM pgr_full_version();"
61-
#psql "${PGFLAGS}" -d "$PGDATABASE" -c "SET client_min_messages TO DEBUG3; ALTER EXTENSION pgrouting UPDATE TO '3.7.0';"
62-
echo "--------------------------"
63-
echo " update version"
64-
echo "--------------------------"
65-
psql "${PGFLAGS}" -d "$PGDATABASE" -c "SELECT * FROM pgr_full_version();"
84+
popd
6685

67-
psql "${PGFLAGS}" -d "$PGDATABASE" -X -q --set client_min_messages=WARNING --set ON_ERROR_STOP=1 --pset pager=off \
68-
-f sampledata.sql \
69-
-f solomon_100_rc101.data.sql \
70-
-f innerQuery.sql \
71-
-f innerQuery_old.sql \
72-
-f inner_styles.sql \
73-
-f old_inner_styles.sql \
74-
-f no_crash_test.sql \
75-
-f alphaShapeTester.sql \
76-
-f general_pgtap_tests.sql \
77-
-f no_crash_general.sql \
78-
-f dijkstra_pgtap_tests.sql \
79-
-f flow_pgtap_tests.sql \
80-
-f trsp_tests.sql \
81-
-f spanningtree.sql \
82-
-f types_check.sql \
83-
-f via_compare.sql \
84-
-f astar_pgtap_tests.sql \
85-
-f compare_dijkstra.sql \
86-
-f allpairs_tests.sql \
87-
-f contraction_tapfuncs.sql\
88-
-f tsp_pgtap_tests.sql
86+
if [[ "${v}" != "${VERSION}" ]]
87+
then
88+
# run tests on old version
89+
pg_prove "$QUIET" --normalize --directives --recurse "${PGFLAGS}" -d "${PGDATABASE}" "pgtap/${DIR}"
90+
91+
# update to this version
92+
echo "--------------------------"
93+
echo " update version"
94+
echo "--------------------------"
95+
if ! psql "${PGFLAGS}" -d "$PGDATABASE" -c "SET client_min_messages TO DEBUG3; ALTER EXTENSION pgrouting UPDATE TO '${VERSION}';"; then
96+
echo "Error: Failed to update pgrouting extension to version ${VERSION}" >&2
97+
exit 1
98+
fi
99+
100+
psql "${PGFLAGS}" -q -t -d "$PGDATABASE" -c "SELECT extversion FROM pg_extension WHERE extname = 'pgrouting';"
101+
102+
# Verify update success
103+
if ! psql "${PGFLAGS}" -q -t -d "$PGDATABASE" -c "SELECT extversion FROM pg_extension WHERE extname = 'pgrouting';" | grep -q "${VERSION}"; then
104+
echo "Error: Extension version mismatch after update" >&2
105+
exit 1
106+
fi
107+
fi
108+
109+
# run this version's test
110+
psql "${PGFLAGS}" -d "$PGDATABASE" -c "SELECT * FROM pgr_full_version();"
89111

90112

91-
popd
92113
pg_prove "$QUIET" --normalize --directives --recurse "${PGFLAGS}" -d "${PGDATABASE}" "pgtap/${DIR}"
93114
#dropdb --if-exists "${PGFLAGS}" "${PGDATABASE}"
94115
done

tools/testers/doc_queries_generator.pl

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,9 @@ sub Usage {
124124
elsif ($a =~ /^-c/i) {
125125
$clean = 1;
126126
}
127-
elsif ($a =~ /^-l$/i) {
128-
$LEVEL = $psql = shift @ARGV || Usage();
127+
elsif ($a =~ /^-l(evel)?/i) {
128+
$LEVEL = shift @ARGV || Usage();
129+
print "The level $LEVEL\n";
129130
}
130131
elsif ($a =~ /^-v/i) {
131132
$VERBOSE = 1;

0 commit comments

Comments
 (0)