|
19 | 19 | # ../testdata/foo.csv - (optional data file for \copy from pstdin)
|
20 | 20 | # foo.out - actual output
|
21 | 21 |
|
22 |
| -SQL = \ |
23 |
| - add_agg.sql \ |
24 |
| - auto_sparse.sql \ |
25 |
| - explicit_thresh.sql \ |
26 |
| - nosparse.sql \ |
27 |
| - agg_oob.sql \ |
28 |
| - cast_shape.sql \ |
29 |
| - scalar_oob.sql \ |
30 |
| - typmod.sql \ |
31 |
| - typmod_insert.sql \ |
32 |
| - hash.sql \ |
33 |
| - hash_any.sql \ |
34 |
| - murmur_bigint.sql \ |
35 |
| - murmur_bytea.sql \ |
36 |
| - equal.sql \ |
37 |
| - notequal.sql \ |
38 |
| - union_op.sql\ |
39 |
| - card_op.sql \ |
40 |
| - meta_func.sql \ |
41 |
| - transaction.sql \ |
42 |
| - storedproc.sql \ |
43 |
| - cumulative_add_cardinality_correction.sql \ |
44 |
| - cumulative_add_comprehensive_promotion.sql \ |
45 |
| - cumulative_add_sparse_edge.sql \ |
46 |
| - cumulative_add_sparse_random.sql \ |
47 |
| - cumulative_add_sparse_step.sql \ |
48 |
| - cumulative_union_comprehensive.sql \ |
49 |
| - cumulative_union_explicit_explicit.sql \ |
50 |
| - cumulative_union_explicit_promotion.sql \ |
51 |
| - cumulative_union_probabilistic_probabilistic.sql \ |
52 |
| - cumulative_union_sparse_full_representation.sql \ |
53 |
| - cumulative_union_sparse_promotion.sql \ |
54 |
| - cumulative_union_sparse_sparse.sql \ |
55 |
| - copy_binary.sql \ |
56 |
| - $(NULL) |
| 22 | +PSQL = psql |
| 23 | +TEST_DB = hll_regress |
57 | 24 |
|
58 |
| -TEST_DB = hll_regress |
| 25 | +SQL = $(wildcard *.sql) |
| 26 | +OUT := $(SQL:%.sql=%.out) |
59 | 27 |
|
60 |
| -NOT = \ |
61 |
| - $(NULL) |
62 |
| - |
63 |
| -OUT := $(SQL:%.sql=%.out) |
64 |
| - |
65 |
| -# Print NULL values explicitly. |
66 |
| -PSQLOPTS = -X --echo-all -P null=NULL |
67 |
| - |
68 |
| -# Disable NOTICE log messages |
69 |
| -export PGOPTIONS := --client-min-messages=warning |
| 28 | +PSQLOPTS = -X --echo-all -P null=NULL # Print NULL values explicitly. |
| 29 | +PGOPTIONS = --client-min-messages=warning # Output WARNINGS |
70 | 30 |
|
71 | 31 | all: $(OUT)
|
| 32 | + @find . -maxdepth 1 -name '*.diff' -print -quit > failures |
| 33 | + @if test -s failures; then \ |
| 34 | + echo ERROR: `ls -1 *.diff | wc -l` / `ls -1 *.sql | wc -l` tests failed; \ |
| 35 | + echo; \ |
| 36 | + cat *.diff; \ |
| 37 | + exit 1; \ |
| 38 | + else \ |
| 39 | + rm failures; \ |
| 40 | + echo `ls -1 *.out | wc -l` / `ls -1 *.sql | wc -l` tests passed; \ |
| 41 | + fi |
72 | 42 |
|
73 | 43 | clean:
|
74 |
| - rm -f $(OUT) |
75 |
| - rm -f binary.dat |
| 44 | + rm -f binary.dat *.out *.diff |
76 | 45 |
|
77 | 46 | # If a matching testdata file exists use it as standard input.
|
78 | 47 | # Otherwise the test doesn't need data on stdin.
|
79 | 48 | #
|
80 | 49 | %.out: %.sql %.ref
|
81 |
| - @echo $* |
| 50 | + @echo -n $* |
82 | 51 | @if test -f ../testdata/$*.csv; then \
|
83 |
| - cat ../testdata/$*.csv | \ |
84 |
| - psql $(PSQLOPTS) $(TEST_DB) -f $*.sql &> $*.out && diff -u $*.ref $*.out; \ |
| 52 | + PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql < ../testdata/$*.csv > $*.out 2>&1; \ |
| 53 | + else \ |
| 54 | + PGOPTIONS=$(PGOPTIONS) $(PSQL) $(PSQLOPTS) $(TEST_DB) -f $*.sql > $*.out 2>&1; \ |
| 55 | + fi |
| 56 | + @diff -u $*.ref $*.out >> $*.diff || status=1 |
| 57 | + @if test -s $*.diff; then \ |
| 58 | + echo " .. FAIL"; \ |
85 | 59 | else \
|
86 |
| - psql $(PSQLOPTS) $(TEST_DB) -f $*.sql &> $*.out && diff -u $*.ref $*.out; \ |
87 |
| - fi |
| 60 | + echo " .. PASS"; \ |
| 61 | + rm -f $*.diff; \ |
| 62 | + fi |
| 63 | + |
0 commit comments