# $Id: Makefile,v 1.2 2002/02/18 18:47:52 thockin Exp $
# Copyright 2002 Sun Microsystems, Inc.  All rights reserved.

include ../../../dynamic.mk
include $(CCE_TOPDIR)/cce.mk

COMPONENTS = ../../server.a 

# ALL these tests are broken
#SIMPLE_TESTS = leaktest txn_memtest
#GREP_TESTS = codb1 codb2 codb3 test_classconf_type test_classconf txn
OTHER_TESTS = test_sorts #test_txn_scanner
TESTS = $(SIMPLE_TESTS) $(GREP_TESTS) $(OTHER_TESTS)

CFLAGS += -I..
LIBS += -lcommon -lpam

test: $(TESTS)
	$(warning WARNING: most tests are commented out or broken)
	#@for a in $(SIMPLE_TESTS); do echo ./$$a; ./$$a; done
	#@for a in $(GREP_TESTS); do \
	#	echo ./$$a; \
	#	./$$a &> $$a.out; \
	#	grep -i fail $$a.out || /bin/true; \
	#	echo -n "===> $$a: "; tail -1 $$a.out; \
	#done
	#./test_txn_scanner &> test_txn_scanner.out
	./test_sorts &> test_sorts.out; diff -u test_sorts.expected test_sorts.out

clean:
	$(RM) $(TESTS) *.out

$(SIMPLE_TESTS): %: %.c $(COMPONENTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

$(GREP_TESTS): %: %.c $(COMPONENTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

test_txn_scanner: %: %.c $(COMPONENTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)

test_sorts: %: %.c $(COMPONENTS)
	$(CC) $(CFLAGS) -o $@ $^ $(LIBS)
