From: Nick Porter Date: Fri, 19 Aug 2022 16:01:46 +0000 (+0100) Subject: Run tests on Active Directory LDAP server X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b958c75a7d7a52a3eb3d385ee263134da4308c7d;p=thirdparty%2Ffreeradius-server.git Run tests on Active Directory LDAP server --- diff --git a/src/tests/ldap_sync/active_directory/all.mk b/src/tests/ldap_sync/active_directory/all.mk new file mode 100644 index 00000000000..1d65437d094 --- /dev/null +++ b/src/tests/ldap_sync/active_directory/all.mk @@ -0,0 +1,56 @@ +# +# Tests against Persistent Search implementing LDAP directories +# + +# +# Test name +# +TEST := test.ldap_sync/active_directory +FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.sh)) + +$(eval $(call TEST_BOOTSTRAP)) + +# +# Generic rules to start /stop the radius service +# +include src/tests/radiusd.mk +$(eval $(call RADIUSD_SERVICE,radiusd,$(OUTPUT))) + +# +# There is a delay of up to 30 seconds looking for the output file +# as samba only sends results of persistent LDAP searches on a polled +# basis. Real Active Directory sends the results immediately. +# +$(OUTPUT)/%: $(DIR)/% | $(TEST).radiusd_kill $(TEST).radiusd_start + $(eval TARGET := $(notdir $<)) + $(eval EXPECTED := $(patsubst %.sh,%.out,$<)) + $(eval FOUND := $(patsubst %.sh,%.out,$@)) + $(eval ARGV := $(shell grep "#.*ARGV:" $< | cut -f2)) + $(eval OUT_DIR := $(BUILD_DIR)/tests/ldap_sync/active_directory) + + $(Q)echo "LDAPSYNC-TEST active_directory $(TARGET)" + $(Q)[ -f $(dir $@)/radiusd.pid ] || exit 1 + $(Q)rm -f $(OUT_DIR)/linelog.out + $(Q)$< + $(Q)i=0; while [ $$i -lt 300 ] ; \ + do if [ -e $(OUT_DIR)/linelog.out ] ; \ + then \ + break; \ + fi; \ + sleep .1; \ + i=$$((i+1)); \ + done ; + $(Q)sleep .5 + $(Q)mv $(OUT_DIR)/linelog.out $(FOUND) + + $(Q)if [ -e "$(EXPECTED)" ] && ! cmp -s $(FOUND) $(EXPECTED); then \ + echo "LDAP_SYNC FAILED $@"; \ + rm -rf $(BUILD_DIR)/tests/test.ldap_sync/active_directory; \ + $(MAKE) --no-print-directory test.ldap_sync/active_directory.radiusd_kill; \ + exit 1; \ + fi + $(Q)touch $@ + +$(TEST): + $(Q)$(MAKE) --no-print-directory $@.radiusd_stop + @touch $(BUILD_DIR)/tests/$@