From 9a80a4f0064af1773bf73df86d3534049a61e373 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 12:19:36 +0100 Subject: First preliminary addition of the test config (there are still a bunch of hard coded paths and stuff). No sed'ing yet... --- lib/snmp/test/test_config/Makefile | 130 +++++++++++++++++++++++++++++++++++++ 1 file changed, 130 insertions(+) create mode 100644 lib/snmp/test/test_config/Makefile (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile new file mode 100644 index 0000000000..187a0ca901 --- /dev/null +++ b/lib/snmp/test/test_config/Makefile @@ -0,0 +1,130 @@ +#-*-makefile-*- ; force emacs to enter makefile-mode + +# %CopyrightBegin% +# +# Copyright Ericsson AB 1997-2009. All Rights Reserved. +# +# The contents of this file are subject to the Erlang Public License, +# Version 1.1, (the "License"); you may not use this file except in +# compliance with the License. You should have received a copy of the +# Erlang Public License along with this software. If not, it can be +# retrieved online at http://www.erlang.org/. +# +# Software distributed under the License is distributed on an "AS IS" +# basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +# the License for the specific language governing rights and limitations +# under the License. +# +# %CopyrightEnd% + +include $(ERL_TOP)/make/target.mk +include $(ERL_TOP)/make/$(TARGET)/otp.mk + + +# ---------------------------------------------------- +# Application version +# ---------------------------------------------------- +include ../../vsn.mk + +VSN = $(SNMP_VSN) + + +# ---------------------------------------------------- +# Target Specs +# ---------------------------------------------------- + +include modules.mk + +SYS_CONFIG_SRCS = $(SYS_CONFIG_FILES:%=%.src) +AGENT_CONFIG_SRCS = $(AGENT_CONFIG_FILES:%=%.src) +MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_FILES:%=%.src) + + +# ---------------------------------------------------- +# Release directory specification +# ---------------------------------------------------- +RELSYSDIR = $(RELEASE_PATH) + + +# ---------------------------------------------------- +# SNMP FLAGS +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# FLAGS +# ---------------------------------------------------- + + +# ---------------------------------------------------- +# Targets +# ---------------------------------------------------- + +tests debug opt: $(SYS_CONFIG_FILES) $(AGENT_CONFIG_FILES) $(MANAGER_CONFIG_FILES) + +clean: + rm -f $(SYS_CONFIG_FILES) + rm -f $(AGENT_CONFIG_FILES) + rm -f $(MANAGER_CONFIG_FILES) + rm -f core + +docs: + + +# ---------------------------------------------------- +# Release Target +# ---------------------------------------------------- +include $(ERL_TOP)/make/otp_release_targets.mk + +release_spec: + +release_tests_spec: opt + $(INSTALL_DIR) $(RELSYSDIR) + chmod -f -R u+w $(RELSYSDIR) + $(INSTALL_DIR) $(RELSYSDIR)/agent + chmod -f -R u+w $(RELSYSDIR)/agent + $(INSTALL_DIR) $(RELSYSDIR)/agent/conf + chmod -f -R u+w $(RELSYSDIR)/agent/conf + $(INSTALL_DIR) $(RELSYSDIR)/agent/db + chmod -f -R u+w $(RELSYSDIR)/agent/db + $(INSTALL_DIR) $(RELSYSDIR)/agent/log + chmod -f -R u+w $(RELSYSDIR)/agent/log + $(INSTALL_DIR) $(RELSYSDIR)/manager + chmod -f -R u+w $(RELSYSDIR)/manager + $(INSTALL_DIR) $(RELSYSDIR)/manager/conf + chmod -f -R u+w $(RELSYSDIR)/manager/conf + $(INSTALL_DIR) $(RELSYSDIR)/manager/db + chmod -f -R u+w $(RELSYSDIR)/manager/db + $(INSTALL_DIR) $(RELSYSDIR)/manager/log + chmod -f -R u+w $(RELSYSDIR)/manager/log + $(INSTALL_DATA) $(SYS_CONFIG_FILES) $(RELSYSDIR) + $(INSTALL_DATA) $(AGENT_CONFIG_FILES) $(RELSYSDIR)/agent/conf + $(INSTALL_DATA) $(MANAGER_CONFIG_FILES) $(RELSYSDIR)/manager/conf + +release_docs_spec: + + +info: + @echo "SNMP_DEBUG = $(SNMP_DEBUG)" + @echo "SNMP_FLAGS = $(SNMP_FLAGS)" + @echo "" + @echo "SNMP_MIB_DIR = $(SNMP_MIB_DIR)" + @echo "MIB_SOURCE = $(MIB_SOURCE)" + @echo "MIB_TARGETS = $(MIB_TARGETS)" + @echo "SNMP_MIB_FLAGS = $(SNMP_MIB_FLAGS)" + @echo "" + @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" + @echo "SOURCE = $(SOURCE)" + @echo "" + @echo "TARGET_FILES = $(TARGET_FILES)" + @echo "" + @echo "EMAKEFILE = $(EMAKEFILE)" + @echo "MAKE_EMAKE = $(MAKE_EMAKE)" + @echo "BUILDTARGET = $(BUILDTARGET)" + @echo "RELTEST_FILES = $(RELTEST_FILES)" + @echo "" + + -- cgit v1.2.3 From add572241ac6085f1dc1062ae6ca351737ec43eb Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 12:30:02 +0100 Subject: Added preliminary make targets for config file building (sed'ing). --- lib/snmp/test/test_config/Makefile | 33 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 187a0ca901..250c594af6 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -70,6 +70,15 @@ clean: docs: +$(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) + @echo "sys: $< -> $@" + +$(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) + @echo "agent: $< -> $@" + +$(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) + @echo "manager: $< -> $@" + # ---------------------------------------------------- # Release Target @@ -105,26 +114,14 @@ release_docs_spec: info: - @echo "SNMP_DEBUG = $(SNMP_DEBUG)" - @echo "SNMP_FLAGS = $(SNMP_FLAGS)" - @echo "" - @echo "SNMP_MIB_DIR = $(SNMP_MIB_DIR)" - @echo "MIB_SOURCE = $(MIB_SOURCE)" - @echo "MIB_TARGETS = $(MIB_TARGETS)" - @echo "SNMP_MIB_FLAGS = $(SNMP_MIB_FLAGS)" - @echo "" - @echo "ERL_COMPILE_FLAGS = $(ERL_COMPILE_FLAGS)" - @echo "" - @echo "RELSYSDIR = $(RELSYSDIR)" - @echo "" - @echo "SOURCE = $(SOURCE)" + @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" + @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" @echo "" - @echo "TARGET_FILES = $(TARGET_FILES)" + @echo "AGENT_CONFIG_SRCS = $(AGENT_CONFIG_SRCS)" + @echo "AGENT_CONFIG_FILES = $(AGENT_CONFIG_FILES)" @echo "" - @echo "EMAKEFILE = $(EMAKEFILE)" - @echo "MAKE_EMAKE = $(MAKE_EMAKE)" - @echo "BUILDTARGET = $(BUILDTARGET)" - @echo "RELTEST_FILES = $(RELTEST_FILES)" + @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" + @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" -- cgit v1.2.3 From ec857328b0ece6a676633a3bd647a4ce37703469 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Thu, 9 Dec 2010 18:44:04 +0100 Subject: First preliminary sedding... --- lib/snmp/test/test_config/Makefile | 56 ++++++++++++++++++++++++++++++-------- 1 file changed, 44 insertions(+), 12 deletions(-) (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 250c594af6..064c9f4689 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -29,55 +29,82 @@ include ../../vsn.mk VSN = $(SNMP_VSN) +# ---------------------------------------------------- +# Configured variables +# ---------------------------------------------------- +# PERL = @PERL@ +PERL = perl + + # ---------------------------------------------------- # Target Specs # ---------------------------------------------------- include modules.mk +ERL_TARGETS = $(MODULES:%=$(EBIN)/%.$(EMULATOR)) + SYS_CONFIG_SRCS = $(SYS_CONFIG_FILES:%=%.src) AGENT_CONFIG_SRCS = $(AGENT_CONFIG_FILES:%=%.src) MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_FILES:%=%.src) +CONFIG_FILES = \ + $(SYS_CONFIG_FILES) \ + $(AGENT_CONFIG_FILES) \ + $(MANAGER_CONFIG_FILES) -# ---------------------------------------------------- -# Release directory specification -# ---------------------------------------------------- -RELSYSDIR = $(RELEASE_PATH) +TARGETS = \ + $(ERL_TARGETS) \ + $(CONFIG_FILES) # ---------------------------------------------------- -# SNMP FLAGS +# Release directory specification # ---------------------------------------------------- +ifeq ($(TESTROOT),) +TESTROOT=/tmp +endif +RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- # FLAGS # ---------------------------------------------------- +EBIN = . + +ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ + +'{attribute,insert,app_vsn,$(APP_VSN)}' + +ifeq ($(ADDR),) +ADDR = $(shell erl -noshell -s test_config ip_address -s init stop) +endif + # ---------------------------------------------------- # Targets # ---------------------------------------------------- -tests debug opt: $(SYS_CONFIG_FILES) $(AGENT_CONFIG_FILES) $(MANAGER_CONFIG_FILES) +tests debug opt: $(TARGETS) clean: - rm -f $(SYS_CONFIG_FILES) - rm -f $(AGENT_CONFIG_FILES) - rm -f $(MANAGER_CONFIG_FILES) + rm -f $(CONFIG_FILES) + rm -f $(ERL_TARGETS) rm -f core docs: $(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) - @echo "sys: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ $(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) - @echo "agent: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ $(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) - @echo "manager: $< -> $@" + @echo "$< -> $@" + $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ # ---------------------------------------------------- @@ -114,6 +141,9 @@ release_docs_spec: info: + @echo "" + @echo "RELSYSDIR = $(RELSYSDIR)" + @echo "" @echo "SYS_CONFIG_SRCS = $(SYS_CONFIG_SRCS)" @echo "SYS_CONFIG_FILES = $(SYS_CONFIG_FILES)" @echo "" @@ -123,5 +153,7 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" + @echo "ADDR = $(ADDR)" + @echo "" -- cgit v1.2.3 From d49bdb7c372c93d5b8007cbc016a587d91539fe9 Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 13:41:38 +0100 Subject: "Completed" sed'ing of config files. --- lib/snmp/test/test_config/Makefile | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 064c9f4689..446e7d8adf 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -68,7 +68,7 @@ RELSYSDIR = $(TESTROOT) # ---------------------------------------------------- -# FLAGS +# FLAGS AND VARIABLES # ---------------------------------------------------- EBIN = . @@ -77,9 +77,26 @@ ERL_COMPILE_FLAGS += +'{parse_transform,sys_pre_attributes}' \ +'{attribute,insert,app_vsn,$(APP_VSN)}' ifeq ($(ADDR),) -ADDR = $(shell erl -noshell -s test_config ip_address -s init stop) +ADDR = $(shell erl -noshell -s snmp_test_config ip_address -s init stop) endif +ifeq ($(TARGET_NAME_PRE),) +TARGET_NAME_PRE = $(shell erl -noshell -s snmp_test_config ip_address2 -s init stop) +endif + +ifeq ($(SYS_CONTACT),) +SYS_CONTACT = foo@bar.ericsson.se +endif + +ifeq ($(SYS_LOCATION),) +SYS_LOCATION = Erlang/OTP +endif + +ifeq ($(SYS_NAME),) +SYS_NAME = FOO +endif + + # ---------------------------------------------------- # Targets @@ -94,15 +111,19 @@ clean: docs: -$(SYS_CONFIG_FILES): $(SYS_CONFIG_SRCS) +%.config: %.config.src @echo "$< -> $@" $(PERL) -p -e 's?%DIR%?$(RELSYSDIR)? ' < $< > $@ -$(AGENT_CONFIG_FILES): $(AGENT_CONFIG_SRCS) +agent/%.conf: agent/%.conf.src @echo "$< -> $@" - $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \ + -e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \ + -e 's?%SYS_NAME%?$(SYS_NAME)? ' \ + -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@ -$(MANAGER_CONFIG_FILES): $(MANAGER_CONFIG_SRCS) +manager/%.conf: manager/%.conf.src @echo "$< -> $@" $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ @@ -153,7 +174,8 @@ info: @echo "MANAGER_CONFIG_SRCS = $(MANAGER_CONFIG_SRCS)" @echo "MANAGER_CONFIG_FILES = $(MANAGER_CONFIG_FILES)" @echo "" - @echo "ADDR = $(ADDR)" + @echo "ADDR = $(ADDR)" + @echo "TARGET_NAME_PRE = $(TARGET_NAME_PRE)" @echo "" -- cgit v1.2.3 From 58620c2052e07490beb44a4bd1a8fbb5ebc028ac Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 14:17:30 +0100 Subject: Various cosmetic (print) fixes. Wrong module names used for the utility module in the test_config dir. --- lib/snmp/test/test_config/Makefile | 2 -- 1 file changed, 2 deletions(-) (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index 446e7d8adf..c02bb5c601 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -32,8 +32,6 @@ VSN = $(SNMP_VSN) # ---------------------------------------------------- # Configured variables # ---------------------------------------------------- -# PERL = @PERL@ -PERL = perl # ---------------------------------------------------- -- cgit v1.2.3 From 8e9ef38dd36c771dff0d477fa7999d34b72e8a7a Mon Sep 17 00:00:00 2001 From: Micael Karlberg Date: Fri, 10 Dec 2010 17:50:38 +0100 Subject: Added counter (variables) for usm. Also added config file for usm. And more sed'ing... --- lib/snmp/test/test_config/Makefile | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) (limited to 'lib/snmp/test/test_config/Makefile') diff --git a/lib/snmp/test/test_config/Makefile b/lib/snmp/test/test_config/Makefile index c02bb5c601..4953de7fe8 100644 --- a/lib/snmp/test/test_config/Makefile +++ b/lib/snmp/test/test_config/Makefile @@ -94,6 +94,22 @@ ifeq ($(SYS_NAME),) SYS_NAME = FOO endif +ifeq ($(AGENT_ENGINE_ID),) +AGENT_ENGINE_ID = Agent engine of $(USER) +endif + +ifeq ($(AGENT_USM_ENGINE_ID),) +AGENT_USM_ENGINE_ID = $(AGENT_ENGINE_ID) +endif + +ifeq ($(MANAGER_ENGINE_ID),) +MANAGER_ENGINE_ID = Manager engine of $(USER) +endif + +ifeq ($(MANAGER_USM_ENGINE_ID),) +MANAGER_USM_ENGINE_ID = $(MANAGER_ENGINE_ID) +endif + # ---------------------------------------------------- @@ -119,11 +135,15 @@ agent/%.conf: agent/%.conf.src -e 's?%SYS_CONTACT%?$(SYS_CONTACT)? ' \ -e 's?%SYS_LOCATION%?$(SYS_LOCATION)? ' \ -e 's?%SYS_NAME%?$(SYS_NAME)? ' \ - -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' < $< > $@ + -e 's?%TARGET_NAME_PRE%?$(TARGET_NAME_PRE)? ' \ + -e 's?%ENGINE_ID%?\"$(AGENT_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(AGENT_USM_ENGINE_ID)\"? ' < $< > $@ manager/%.conf: manager/%.conf.src @echo "$< -> $@" - $(PERL) -p -e 's?%ADDR%?$(ADDR)? ' < $< > $@ + sed -e 's?%ADDR%?$(ADDR)? ' \ + -e 's?%ENGINE_ID%?\"$(MANAGER_ENGINE_ID)\"? ' \ + -e 's?%USM_ENGINE_ID%?\"$(MANAGER_USM_ENGINE_ID)\"? ' < $< > $@ # ---------------------------------------------------- @@ -133,7 +153,7 @@ include $(ERL_TOP)/make/otp_release_targets.mk release_spec: -release_tests_spec: opt +release_tests_spec: clean opt $(INSTALL_DIR) $(RELSYSDIR) chmod -f -R u+w $(RELSYSDIR) $(INSTALL_DIR) $(RELSYSDIR)/agent -- cgit v1.2.3