--- /dev/null
+TMPDIR?=/tmp
+
+test: test-common test-index test-lwgeom test-ogc
+
+test-lwgeom:
+ @./run_lwgeom_regress
+
+test-common:
+ @./run_regress
+
+test-index:
+ @./run_index_regress
+
+test-ogc:
+ @./run_ogc_regress
+
+clean:
+ rm -f $(TMPDIR)/regress_out
+ rm -f $(TMPDIR)/lwgeom_regress_out
+ rm -f $(TMPDIR)/regress_index_out
+ rm -f $(TMPDIR)/regress_ogc_out
echo "Index Creation will take some time..."
echo ""
+if [ -z "$TMPDIR" ]; then
+ TMPDIR=/tmp
+fi
+
DB=postgis_reg
createdb $DB > /dev/null
createlang plpgsql $DB > /dev/null
psql -f ../lwpostgis.sql $DB > /dev/null 2>&1
-psql -tA < regress_index.sql $DB > regress_index_out 2>&1
-diff regress_index_out regress_index_expected
+psql -tA < regress_index.sql $DB > "${TMPDIR}/regress_index_out" 2>&1
+diff regress_index_expected "${TMPDIR}/regress_index_out"
sleep 1
dropdb $DB > /dev/null
echo ""
echo "Building a database for testing (postgis_reg)."
+if [ -z "$TMPDIR" ]; then
+ TMPDIR=/tmp
+fi
+
DB=postgis_reg
createdb $DB > /dev/null
echo "there shouldnt be any real output produced after this line."
echo ""
-psql -tA < lwgeom_regress.sql $DB 2>&1 | grep -v "^INSERT" > lwgeom_regress_out
-diff lwgeom_regress_out lwgeom_regress_expected
+psql -tA < lwgeom_regress.sql $DB 2>&1 | grep -v "^INSERT" > "${TMPDIR}/lwgeom_regress_out"
+diff lwgeom_regress_expected "${TMPDIR}/lwgeom_regress_out"
sleep 1
dropdb $DB > /dev/null
echo " expected:'<' obtained:'>'"
echo
+if [ -z "$TMPDIR" ]; then
+ TMPDIR=/tmp
+fi
+
DB=postgis_reg
createdb $DB > /dev/null
createlang plpgsql $DB > /dev/null
psql -f ../lwpostgis.sql $DB > /dev/null 2>&1
-psql -tA < regress_ogc.sql $DB 2>&1 | grep -v INSERT > regress_ogc_out
-diff regress_ogc_expected regress_ogc_out
+psql -tA < regress_ogc.sql $DB 2>&1 | grep -v INSERT > "${TMPDIR}/regress_ogc_out"
+diff regress_ogc_expected "${TMPDIR}/regress_ogc_out"
sleep 1
dropdb $DB > /dev/null
echo " expected:'<' obtained:'>'"
echo
+if [ -z "$TMPDIR" ]; then
+ TMPDIR=/tmp
+fi
+
DB=postgis_reg
createdb $DB > /dev/null
createlang plpgsql $DB > /dev/null
psql -f ../lwpostgis.sql $DB > /dev/null 2>&1
-psql -tA < regress.sql $DB 2>&1 | grep -v INSERT > regress_out
-diff regress_expected regress_out
+psql -tA < regress.sql $DB 2>&1 | grep -v INSERT > "${TMPDIR}/regress_out"
+diff regress_expected "${TMPDIR}/regress_out"
sleep 1
dropdb $DB > /dev/null