Skip to content

Commit 9f84473

Browse files
committed
test: check that the source directory exists before running tests
1 parent 02969b6 commit 9f84473

File tree

3 files changed

+23
-5
lines changed

3 files changed

+23
-5
lines changed

tasks/docs/validate/coverage.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,17 @@ echo ""
88
echo "Generated: $(date +"%Y-%m-%dT%H:%M:%S%z")"
99
echo ""
1010

11+
source_directory="$(pwd)/src"
1112
total_sql_files=0
1213
documented_sql_files=0
1314

15+
if [ ! -d $source_directory ]; then
16+
echo "error: source directory does not exist: ${source_directory}"
17+
exit 2
18+
fi
19+
1420
# Check .sql files
15-
for file in $(find src -name "*.sql" -not -name "*_test.sql" | sort); do
21+
for file in $(find $source_directory -name "*.sql" -not -name "*_test.sql" | sort); do
1622
# Skip auto-generated files
1723
if grep -q "^-- AUTOMATICALLY GENERATED FILE" "$file" 2>/dev/null; then
1824
echo "- $file: ⊘ Auto-generated (skipped)"
@@ -33,7 +39,7 @@ done
3339
total_template_files=0
3440
documented_template_files=0
3541

36-
for file in $(find src -name "*.template" | sort); do
42+
for file in $(find $source_directory -name "*.template" | sort); do
3743
total_template_files=$((total_template_files + 1))
3844

3945
if grep -q "^--! @brief" "$file" 2>/dev/null; then

tasks/docs/validate/documented-sql.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,14 +8,20 @@ PGPORT=${PGPORT:-7432}
88
PGUSER=${PGUSER:-cipherstash}
99
PGPASSWORD=${PGPASSWORD:-password}
1010
PGDATABASE=${PGDATABASE:-postgres}
11+
source_directory="$(pwd)/src"
1112

1213
echo "Validating SQL syntax for all documented files..."
1314
echo ""
1415

1516
errors=0
1617
validated=0
1718

18-
for file in $(find src -name "*.sql" -not -name "*_test.sql" | sort); do
19+
if [ ! -d $source_directory ]; then
20+
echo "error: source directory does not exist: ${source_directory}"
21+
exit 2
22+
fi
23+
24+
for file in $(find $source_directory -name "*.sql" -not -name "*_test.sql" | sort); do
1925
echo -n "Validating $file... "
2026

2127
# Capture both stdout and stderr

tasks/docs/validate/required-tags.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,16 @@ set -e
66
echo "Validating required Doxygen tags..."
77
echo ""
88

9+
source_directory="$(pwd)/src"
910
errors=0
1011
warnings=0
1112

12-
for file in $(find src -name "*.sql" -not -name "*_test.sql"); do
13+
if [ ! -d $source_directory ]; then
14+
echo "error: source directory does not exist: ${source_directory}"
15+
exit 2
16+
fi
17+
18+
for file in $(find $source_directory -name "*.sql" -not -name "*_test.sql"); do
1319
# Skip auto-generated files
1420
if grep -q "^-- AUTOMATICALLY GENERATED FILE" "$file" 2>/dev/null; then
1521
continue
@@ -55,7 +61,7 @@ for file in $(find src -name "*.sql" -not -name "*_test.sql"); do
5561
done
5662

5763
# Also check template files
58-
for file in $(find src -name "*.template"); do
64+
for file in $(find $source_directory -name "*.template"); do
5965
functions=$(grep -n "^CREATE FUNCTION" "$file" 2>/dev/null | cut -d: -f1 || echo "")
6066

6167
for line_no in $functions; do

0 commit comments

Comments
 (0)