Skip to content

Enables integration with the Travis CI build automation system #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@
*.o
*.so
*.out
*.diff
regress/binary.dat
regress/failures
20 changes: 20 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
language: c

env:
- PGVERSION=9.1
- PGVERSION=9.2
- PGVERSION=9.3

before_script:
- export PATH=/usr/lib/postgresql/$PGVERSION/bin:$PATH # Add our chosen PG version to the path
- sudo /etc/init.d/postgresql stop # Stop whichever version of PG that travis started
- sudo /etc/init.d/postgresql start $PGVERSION # Start the version of PG that we want to test
- sudo apt-get install postgresql-server-dev-$PGVERSION # Required for PGXS
- sudo apt-get install postgresql-common # Required for extension support files
- createdb hll_regress # Create the test database

script:
- make && sudo make install
- psql -c "create extension hll" hll_regress
- make -C regress

2 changes: 2 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
[![Build Status](https://travis-ci.org/cwelton/postgresql-hll.svg?branch=master)](https://travis-ci.org/cwelton/postgresql-hll)

Overview
========

Expand Down
82 changes: 29 additions & 53 deletions regress/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -19,69 +19,45 @@
# ../testdata/foo.csv - (optional data file for \copy from pstdin)
# foo.out - actual output

SQL = \
add_agg.sql \
auto_sparse.sql \
explicit_thresh.sql \
nosparse.sql \
agg_oob.sql \
cast_shape.sql \
scalar_oob.sql \
typmod.sql \
typmod_insert.sql \
hash.sql \
hash_any.sql \
murmur_bigint.sql \
murmur_bytea.sql \
equal.sql \
notequal.sql \
union_op.sql\
card_op.sql \
meta_func.sql \
transaction.sql \
storedproc.sql \
cumulative_add_cardinality_correction.sql \
cumulative_add_comprehensive_promotion.sql \
cumulative_add_sparse_edge.sql \
cumulative_add_sparse_random.sql \
cumulative_add_sparse_step.sql \
cumulative_union_comprehensive.sql \
cumulative_union_explicit_explicit.sql \
cumulative_union_explicit_promotion.sql \
cumulative_union_probabilistic_probabilistic.sql \
cumulative_union_sparse_full_representation.sql \
cumulative_union_sparse_promotion.sql \
cumulative_union_sparse_sparse.sql \
copy_binary.sql \
$(NULL)
PSQL = psql
TEST_DB = hll_regress

TEST_DB = hll_regress
SQL = $(wildcard *.sql)
OUT := $(SQL:%.sql=%.out)

NOT = \
$(NULL)

OUT := $(SQL:%.sql=%.out)

# Print NULL values explicitly.
PSQLOPTS = -X --echo-all -P null=NULL

# Disable NOTICE log messages
export PGOPTIONS := --client-min-messages=warning
PSQLOPTS = -X --echo-all -P null=NULL # Print NULL values explicitly.
PGOPTIONS = --client-min-messages=warning # Output WARNINGS

all: $(OUT)
@find . -maxdepth 1 -name '*.diff' -print -quit > failures
@if test -s failures; then \
echo ERROR: `ls -1 *.diff | wc -l` / `ls -1 *.sql | wc -l` tests failed; \
echo; \
cat *.diff; \
exit 1; \
else \
rm failures; \
echo `ls -1 *.out | wc -l` / `ls -1 *.sql | wc -l` tests passed; \
fi

clean:
rm -f $(OUT)
rm -f binary.dat
rm -f binary.dat *.out *.diff

# If a matching testdata file exists use it as standard input.
# Otherwise the test doesn't need data on stdin.
#
%.out: %.sql %.ref
@echo $*
@echo -n $*
@if test -f ../testdata/$*.csv; then \
cat ../testdata/$*.csv | \
psql $(PSQLOPTS) $(TEST_DB) -f $*.sql &> $*.out && diff -u $*.ref $*.out; \
PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql < ../testdata/$*.csv > $*.out 2>&1; \
else \
PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql > $*.out 2>&1; \
fi
@diff -u $*.ref $*.out >> $*.diff || status=1
@if test -s $*.diff; then \
echo " .. FAIL"; \
else \
psql $(PSQLOPTS) $(TEST_DB) -f $*.sql &> $*.out && diff -u $*.ref $*.out; \
fi
echo " .. PASS"; \
rm -f $*.diff; \
fi