"Fossies" - the Fresh Open Source Software Archive

Member "freeradius-server-3.0.23/src/tests/sql_nas_table/all.mk" (10 Jun 2021, 2349 Bytes) of package /linux/misc/freeradius-server-3.0.23.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Make source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 #
    2 #   Unit tests validating the SQL 'nas' table clients
    3 #
    4 
    5 #
    6 #   Test name
    7 #
    8 TEST  := test.sql_nas_table
    9 FILES := $(subst $(DIR)/,,$(wildcard $(DIR)/*.txt))
   10 
   11 #
   12 #  If we have rlm_sql_sqlite and sqlite3
   13 #
   14 ifneq "$(findstring rlm_sql_sqlite,$(ALL_TGTS))" ""
   15 SQLITE3 := $(shell which sqlite3)
   16 endif
   17 
   18 ifneq "$(SQLITE3)" ""
   19 
   20 #
   21 #  Run the full tests
   22 #
   23 $(eval $(call TEST_BOOTSTRAP))
   24 
   25 #
   26 #   Config settings
   27 #
   28 SQL_NASTABLE_BUILD_DIR  := $(BUILD_DIR)/tests/sql_nas_table
   29 SQL_NASTABLE_RADIUS_LOG := $(SQL_NASTABLE_BUILD_DIR)/radiusd.log
   30 SQL_NASTABLE_GDB_LOG    := $(SQL_NASTABLE_BUILD_DIR)/gdb.log
   31 SQL_NASTABLE_DB         := $(SQL_NASTABLE_BUILD_DIR)/sql_nas_table.db
   32 
   33 # Used by src/tests/sql_nas_table/config/radiusd.conf
   34 export SQL_NASTABLE_DB
   35 
   36 #
   37 #  Generic rules to start / stop the radius service.
   38 #
   39 include src/tests/radiusd.mk
   40 $(eval $(call RADIUSD_SERVICE,radiusd,$(OUTPUT)))
   41 
   42 .PHONY: sql_nas_table_bootstrap
   43 sql_nas_table_bootstrap:
   44     $(Q)rm -f $(SQL_NASTABLE_DB)
   45     $(Q)mkdir -p $(SQL_NASTABLE_BUILD_DIR)
   46     $(Q)sqlite3 $(SQL_NASTABLE_DB) < ./raddb/mods-config/sql/main/sqlite/schema.sql
   47     $(Q)sqlite3 $(SQL_NASTABLE_DB) < ./src/tests/sql_nas_table/clients.sql
   48 
   49 #
   50 #   Run the radclient commands against the radiusd.
   51 #
   52 $(OUTPUT)/%: $(DIR)/% | $(TEST).radiusd_kill sql_nas_table_bootstrap $(TEST).radiusd_start
   53     $(Q)echo "SQL_NASTABLE-TEST"
   54     $(Q)mkdir -p $(dir $@)
   55     $(Q)[ -f $(dir $@)/radiusd.pid ] || exit 1
   56     $(Q)if ! $(TESTBIN)/radclient $(ARGV) -xf src/tests/sql_nas_table/auth.txt -D share/ 127.0.0.1:$(PORT) auth $(SECRET) 1> $(SQL_NASTABLE_BUILD_DIR)/radclient.log 2>&1; then \
   57         echo "FAILED";                                              \
   58         rm -f $(BUILD_DIR)/tests/test.sql_nas_table;            \
   59         $(MAKE) --no-print-directory test.sql_nas_table.radiusd_kill;   \
   60         echo ==============================;                \
   61         tail -10 $(SQL_NASTABLE_BUILD_DIR)/radclient.log;       \
   62         echo ==============================;                \
   63         echo "RADIUSD:   $(RADIUSD_RUN)";                           \
   64         echo "SQL_NASTABLE: $(TESTBIN)/radclient $(ARGV) -f $< -xF -d src/tests/sql_nas_table/config -D share/ 127.0.0.1:$(PORT) auth $(SECRET)"; \
   65         exit 1;                                                     \
   66     fi
   67 
   68     $(Q)touch $@
   69 
   70 $(TEST):
   71     $(Q)$(MAKE) --no-print-directory $@.radiusd_stop
   72     @touch $(BUILD_DIR)/tests/$@
   73 else
   74 #
   75 #  No sqlite3 command, don't do anything.
   76 #
   77 $(TEST):
   78 endif