head	1.1;
access;
symbols;
locks; strict;
comment	@# @;


1.1
date	2014.03.18.05.59.44;	author dholland;	state Exp;
branches;
next	;
commitid	S8HOSOoC0H8CX8tx;


desc
@@


1.1
log
@Add a test suite.

This needs a bit of work to support running the tests from bin/, but
not much, and it runs ok (just less tidily) in place.

At the moment none of it really works because the bsd-pkg-config
script doesn't honor PKG_CONFIG_PATH.
@
text
@PKGCONFIG=../bsd-pkg-config.sh
#PKGCONFIG=/usr/pkg/bin/pkg-config

ALLTESTS=basetest
PCFILES=libtuff-4 y11 ykbproto yproto

REFVER.libtuff-4=4.0.1	# less than extant version
REFVER.y11=1.6.1	# greater than extant version
REFVER.ykbproto=1.0.6	# same as extant version
REFVER.yproto=7.0.24	# same as extant version

############################################################

all: run-tests .WAIT show-diffs

.for P in $(PCFILES)
ALLTESTS+=package-query-$(P)
package-query-$(P).out: package-query.sh $(PKGCONFIG)
	./package-query.sh $(PKGCONFIG) $(P) $(REFVER.$(P)) > $@@ 2>&1
.endfor

.for T in $(ALLTESTS)
.if !target($(T).out)
$(T).out: $(T).sh $(PKGCONFIG)
	./$(T).sh $(PKGCONFIG) > $@@ 2>&1
.endif

$(T).diff: $(T).good $(T).out
	diff -u $(T).good $(T).out > $(T).diff || true

run-tests: $(T).diff
.endfor

show-diffs:
.for T in $(ALLTESTS)
	cat $(T).diff
.endfor

good:
.for T in $(ALLTESTS)
	cp $(T).out $(T).good
.endfor

clean distclean:
	rm -f *.out *.diff

.PHONY: all run-tests show-diffs good clean distclean
@
