Skip to content

Commit

Permalink
More work on suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
cvvergara committed Jan 18, 2025
1 parent edbef8b commit 48792a0
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 14 deletions.
33 changes: 21 additions & 12 deletions tools/developer/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ function set_cmake {
#cmake -DWITH_DOC=ON -DBUILD_DOXY=ON ..

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

#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 ..

Expand Down Expand Up @@ -105,15 +105,16 @@ function set_compiler {
echo ------------------------------------

if [ -n "$1" ]; then
sudo update-alternatives --set gcc "/usr/bin/gcc-$1"
sudo update-alternatives --set g++ "/usr/bin/g++-$1"
export CC="/usr/bin/gcc-$1"
export CXX="/usr/bin/g++-$1"
fi
}

function build_doc {
pushd build > /dev/null || exit 1
#rm -rf doc/* ; rm -rf locale/*/*/*.mo
#rm -rf doc/*
# Clean only generated files while preserving custom content
find doc -type f -name "*.html" -o -name "*.pdf" -delete
make doc
#example on how to only build spanish html
#make html-es
Expand All @@ -126,14 +127,26 @@ function build_doc {

function check {
pushd build > /dev/null || exit 1
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON .
cppcheck --project=compile_commands.json -q
cmake -DCMAKE_EXPORT_COMPILE_COMMANDS=ON ..

# Run with error handling and report generation
cppcheck --project=compile_commands.json \
--enable=all \
--suppress=missingIncludeSystem \
--error-exitcode=1 \
--output-file=cppcheck-report.txt 2>&1 || {
echo "Static analysis failed. See build/cppcheck-report.txt for details"
return 1
}
popd > /dev/null || exit 1
}

function tidy_with_clang {
.github/scripts/tidy-vs-commit.sh upstream/develop
sleep 1
local base_branch=${1:-"upstream/develop"}
.github/scripts/tidy-vs-commit.sh "$base_branch" || {
echo "clang-tidy checks failed"
return 1
}
}

function build {
Expand Down Expand Up @@ -173,11 +186,7 @@ function test_compile {

tap_test
tools/testers/doc_queries_generator.pl -pgport $PGPORT
#exit 0


tidy_with_clang
check
build_doc
tap_test
action_tests
Expand Down
29 changes: 27 additions & 2 deletions tools/developer/taptest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,19 @@ pushd "${DIR}" > /dev/null || exit 1
DIR="$1"
shift
PGFLAGS=$*
VERSION=$(grep -Po '(?<=project\(PGROUTING VERSION )[^;]+' CMakeLists.txt)
if ! VERSION=$(grep -E '^[[:space:]]*project\(PGROUTING[[:space:]]+VERSION[[:space:]]+([^[:space:];]+)' CMakeLists.txt | sed -E 's/.*VERSION[[:space:]]+([^[:space:];]+).*/\1/'); then
echo "Error: Failed to extract version from CMakeLists.txt" >&2
exit 1
fi

if [[ -z "${VERSION}" ]]; then
echo "Error: Version not found in CMakeLists.txt" >&2
exit 1
fi

echo "dir ${DIR}"
echo "pgflags ${PGFLAGS}"
echo "VERSION ${VERSION}"
QUIET="-v"
QUIET="-q"

Expand All @@ -58,12 +67,17 @@ do
echo " Running with version ${v}"
echo " test ${DIR}"
echo "--------------------------"
# give time to developer to read message
sleep 3

dropdb --if-exists "${PGFLAGS}" "${PGDATABASE}"
createdb "${PGFLAGS}" "${PGDATABASE}"

bash setup_db.sh "${PGPORT}" "${PGDATABASE}" "${PGUSER}" "${v}"
if ! bash setup_db.sh "${PGPORT}" "${PGDATABASE}" "${PGUSER}" "${v}"; then
echo "Error: Database setup failed" >&2
exit 1
fi
echo "--------------------------"
echo " Installed version"
echo "--------------------------"
Expand All @@ -79,7 +93,18 @@ do
echo "--------------------------"
echo " update version"
echo "--------------------------"
psql "${PGFLAGS}" -d "$PGDATABASE" -c "SET client_min_messages TO DEBUG3; ALTER EXTENSION pgrouting UPDATE TO '${VERSION}';"
if ! psql "${PGFLAGS}" -d "$PGDATABASE" -c "SET client_min_messages TO DEBUG3; ALTER EXTENSION pgrouting UPDATE TO '${VERSION}';"; then
echo "Error: Failed to update pgrouting extension to version ${VERSION}" >&2
exit 1
fi

psql "${PGFLAGS}" -q -t -d "$PGDATABASE" -c "SELECT extversion FROM pg_extension WHERE extname = 'pgrouting';"

# Verify update success
if ! psql "${PGFLAGS}" -q -t -d "$PGDATABASE" -c "SELECT extversion FROM pg_extension WHERE extname = 'pgrouting';" | grep -q "${VERSION}"; then
echo "Error: Extension version mismatch after update" >&2
exit 1
fi
fi

# run this version's test
Expand Down

0 comments on commit 48792a0

Please sign in to comment.