# Makefile.in for tests
# $OpenLDAP$
## This work is part of OpenLDAP Software <http://www.openldap.org/>.
##
## Copyright 1998-2024 The OpenLDAP Foundation.
## All rights reserved.
##
## Redistribution and use in source and binary forms, with or without
## modification, are permitted only as authorized by the OpenLDAP
## Public License.
##
## A copy of this license is available in the file LICENSE in the
## top-level directory of the distribution or, alternatively, at
## <http://www.OpenLDAP.org/license.html>.

RUN=./run
SUBDIRS= progs

BUILD_MDB=@BUILD_MDB@
BUILD_SQL=@BUILD_SQL@
BUILD_SLAPD=@BUILD_SLAPD@
BUILD_BALANCER=@BUILD_BALANCER@
BUILD_WT=@BUILD_WT@

# test primary backends (default)
test tests:
	@$(MAKE) mdb
	@$(MAKE) lloadd

# test all backends
alltests: tests
	@$(MAKE) sql
	@$(MAKE) ldif
	@$(MAKE) wt

# parallel test targets
partests: pmdb plloadd psql pldif pwt

pmdb:
	@$(MAKE) mdb TESTINST=0 > testout.0

plloadd:
	@$(MAKE) lloadd TESTINST=1 > testout.1

psql:
	@$(MAKE) sql TESTINST=2 > testout.2

pldif:
	@$(MAKE) ldif TESTINST=3 > testout.3

pwt:
	@$(MAKE) wt TESTINST=4 > testout.4

mdb test-mdb:	mdb-$(BUILD_MDB)
mdb-no:
	@echo "run configure with --enable-mdb to run MDB tests"

mdb-yes mdb-mod: FORCE
	@echo "Initiating LDAP tests for MDB..."
	@$(RUN) -b mdb all

sql test-sql:	sql-$(BUILD_SQL)
sql-no:
	@echo "run configure with --enable-sql to run SQL tests"

sql-yes sql-mod:	FORCE
	@echo "Initiating LDAP tests for SQL..."
	@$(RUN) -b sql sql-all

ldif test-ldif: FORCE
	@echo "Initiating LDAP tests for LDIF..."
	@$(RUN) -b ldif all

wt test-wt:	wt-$(BUILD_WT)
wt-no:
	@echo "run configure with --enable-wt to run back-wt tests"

wt-yes wt-mod: FORCE
	@$(RUN) -b wt all

lloadd test-lloadd: lloadd-$(BUILD_BALANCER)
lloadd-no:
	@echo "run configure with --enable-balancer to run the Load Balancer tests"

lloadd-yes lloadd-mod: lloadd-slapd-$(BUILD_SLAPD)

lloadd-slapd-no:
	@echo "run configure with --enable-slapd to run the Load Balancer tests"

lloadd-slapd-yes: FORCE
	@echo "Initiating LDAP tests for the Load Balancer..."
	@$(RUN) lloadd-all

regressions:	FORCE
	@echo "Testing (available) ITS regressions"
	@$(MAKE) mdb-its

its: regressions

mdb-its: mdb-its-$(BUILD_MDB)
mdb-its-no:
	@echo "run configure with --enable-mdb to run MDB ITS regressions"

mdb-its-yes mdb-its-mod: FORCE
	@$(RUN) -b mdb its-all

clean-local:	FORCE
	-$(RM) -r testrun configpw configpw.conf *leak *gmon *core

veryclean-local: FORCE
	@-$(RM) run testdata schema ucdata

