Skip to content

Commit

Permalink
actually commit changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ezra-varady authored and Ngalstyan4 committed Oct 13, 2023
1 parent adb57d1 commit 49ede25
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 14 deletions.
51 changes: 42 additions & 9 deletions scripts/run_all_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,15 @@ PSQL=psql
TMP_ROOT=/tmp/lantern
TMP_OUTDIR=$TMP_ROOT/tmp_output
FILTER="${FILTER:-}"
EXCLUDE="${EXCLUDE:-}"
# $USER is not set in docker containers, so use whoami
DEFAULT_USER=$(whoami)

if [[ -n "$FILTER" && -n "$EXCLUDE" ]]; then
echo "-FILTER and -EXCLUDE cannot be used together, please use only one"
exit 1
fi

# typically default user is root in a docker container
# and in those cases postgres is the user with appropriate permissions
# to the database
Expand Down Expand Up @@ -78,28 +84,55 @@ while [[ "$#" -gt 0 ]]; do
shift
done

FIRST_TEST=1
function print_test {
if [ "$PARALLEL" -eq 1 ]; then
if [ $1 == end ]; then
echo -e "\ntest: $1" >> $2
elif [ $1 == begin ]; then
echo -e "\ntest: $1" >> $2
else
if [ "$FIRST_TEST" -eq 1 ]; then
echo -n "test: $1" >> $2
FIRST_TEST=0
else
echo -n " $1" >> $2
fi
fi
else
echo "test: $1" >> $2
fi
}

# Generate schedule.txt
rm -rf $TMP_OUTDIR/schedule.txt
if [ "$PARALLEL" -eq 1 ]; then
SCHEDULE='parallel_schedule.txt'
else
SCHEDULE='schedule.txt'
fi
if [ -n "$FILTER" ]; then
if [[ -n "$FILTER" || -n "$EXCLUDE" ]]; then
if [ "$PARALLEL" -eq 1 ]; then
TEST_FILES=$(cat $SCHEDULE | grep -E '^(test:|test_begin:|test_end:)' | sed -E -e 's/^test:|test_begin:|test_end://' | tr " " "\n" | sed -e '/^$/d')
else
if [[ "$pgvector_installed" == "1" ]]; then
TEST_FILES=$(cat $SCHEDULE | grep -E '^(test:|test_pgvector:)' | sed -E -e 's/^test:|test_pgvector://' | tr " " "\n" | sed -e '/^$/d')
else
TEST_FILES=$(cat $SCHEDULE | grep '^test:' | sed -e 's/^test://' | tr " " "\n" | sed -e '/^$/d')
fi
if [[ "$pgvector_installed" == "1" ]]; then
TEST_FILES=$(cat $SCHEDULE | grep -E '^(test:|test_pgvector:)' | sed -E -e 's/^test:|test_pgvector://' | tr " " "\n" | sed -e '/^$/d')
else
TEST_FILES=$(cat $SCHEDULE | grep '^test:' | sed -e 's/^test://' | tr " " "\n" | sed -e '/^$/d')
fi
fi

while IFS= read -r f; do
if [[ $f == *"$FILTER"* ]]; then
echo "HERE $f"
echo "test: $f" >> $TMP_OUTDIR/schedule.txt
if [ -n "$FILTER" ]; then
if [[ $f == *"$FILTER"* ]]; then
echo "HERE $f"
print_test $f $TMP_OUTDIR/schedule.txt $FIRST_TEST
fi
elif [ -n "$EXCLUDE" ]; then
if [[ $f == *"$EXCLUDE"* ]]; then
continue
fi
print_test $f $TMP_OUTDIR/schedule.txt $FIRST_TEST
fi
done <<< "$TEST_FILES"

Expand Down
2 changes: 2 additions & 0 deletions scripts/test_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ def update_from_tag(from_version: str, to_version: str):
repo.git.checkout(sha_before)
res = subprocess.run(f"cd {args.builddir} ; git submodule update && cmake .. && make -j4 && make install && make test", shell=True)
res = subprocess.run(f"cd {args.builddir} ; UPDATE_EXTENSION=1 UPDATE_FROM={from_version} UPDATE_TO={to_version} make test", shell=True)
res = subprocess.run(f"cd {args.builddir} ; UPDATE_EXTENSION=1 UPDATE_FROM={from_version} UPDATE_TO={from_version} make test-parallel FILTER=begin", shell=True)
res = subprocess.run(f"cd {args.builddir} ; UPDATE_EXTENSION=1 UPDATE_FROM={from_version} UPDATE_TO={to_version} make test-parallel EXCLUDE=begin", shell=True)
#todo:: run query and check portion of parallel tests

def incompatible_version(pg_version, version_tag):
Expand Down
6 changes: 1 addition & 5 deletions test/test_runner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ function drop_db {
EOF
}

<<<<<<< HEAD
function run_regression_test {
# Exclude debug/inconsistent output from psql
# So tests will always have the same output
Expand All @@ -47,9 +46,6 @@ function run_regression_test {
perl -nle'print if !m{DEBUG:(?!.*LANTERN)}'
}

trap drop_db EXIT




# If these aren't parallel tests always drop the db after the test
Expand Down Expand Up @@ -83,7 +79,7 @@ then
exit 1
fi
# install the old version of the extension and sanity-check that all tests pass
psql "$@" -U ${DB_USER} -d ${TEST_CASE_DB} -v ECHO=none -q -c "SET client_min_messages=error; CREATE EXTENSION lantern VERSION '$UPDATE_FROM';" 2>/dev/null
psql "$@" -U ${DB_USER} -d ${TEST_CASE_DB} -v ECHO=none -q -c "SET client_min_messages=error; CREATE EXTENSION IF NOT EXISTS lantern VERSION '$UPDATE_FROM';" 2>/dev/null
psql "$@" -U ${DB_USER} -d ${TEST_CASE_DB} -v ECHO=none -q -f utils/common.sql 2>/dev/null
run_regression_test $@
# upgrade to the new version of the extension and make sure that all existing tests still pass
Expand Down

0 comments on commit 49ede25

Please sign in to comment.