Add snmp tests to the -test rpm and enable them, configure snmptrapd in test setup phase

This commit is contained in:
Vitezslav Crhonek 2015-05-19 12:59:14 +02:00
parent dfde10b829
commit b02f951c65
3 changed files with 79 additions and 5 deletions

View File

@ -0,0 +1,50 @@
diff -up pegasus/Makefile.ReleaseTest.orig pegasus/Makefile.ReleaseTest
--- pegasus/Makefile.ReleaseTest.orig 2013-07-01 12:55:50.000000000 +0200
+++ pegasus/Makefile.ReleaseTest 2015-05-18 14:28:22.642686363 +0200
@@ -128,6 +128,7 @@ POSTSTARTTEST_CMDS = \
$(PEGASUS_TEST_DIR)/bin/TestIndicationStressTest@@IndicationStressTestClass@@test/TestProvider@@cleanup
ifeq ($(PEGASUS_USE_NET_SNMP),true)
+ POSTSTARTTEST_CMDS_NO_SNMP := $(POSTSTARTTEST_CMDS)
POSTSTARTTEST_CMDS += \
$(PEGASUS_TEST_DIR)/bin/TestSnmpHandler@@setup@@WQL \
$(PEGASUS_TEST_DIR)/bin/TestSnmpHandler@@run@@4@@2 \
@@ -212,10 +213,21 @@ createMakefile_poststarttests:
@$(ECHO-E) "poststarttests:" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@$(MAKE) -s poststarttests_internal\n" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "poststarttests_internal:" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ifeq ($(PEGASUS_USE_NET_SNMP),true)
+ @$(foreach i, $(POSTSTARTTEST_CMDS_NO_SNMP), $(ECHO-E) "\t$(subst @@, ,$(i))" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile;)
+else
@$(foreach i, $(POSTSTARTTEST_CMDS), $(ECHO-E) "\t$(subst @@, ,$(i))" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile;)
@$(ECHO-E) "" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+endif
createMakefile_tests:
+ifeq ($(PEGASUS_USE_NET_SNMP),true)
+ @$(ECHO-E) "\t/usr/share/Pegasus/test/bin/TestSnmpHandler setup WQL" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t/usr/share/Pegasus/test/bin/TestSnmpHandler run 4 2" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t/usr/share/Pegasus/test/bin/TestSnmpHandler cleanup" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t/usr/share/Pegasus/test/bin/TestSnmpHandler removelog" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+endif
@$(ECHO-E) "###############################################################################" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "# The tests target stops the cimserver, runs the unit tests, starts the" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "# cimserver, and runs the poststarttests and local TestClient." >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@@ -276,6 +288,8 @@ createMakefile_setupTEST:
>> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@mv $(PEGASUS_TEST_REPOSITORY_DIR)/$(PEGASUS_TEST_REPOSITORY_NAME) $(PEGASUS_REPOSITORY_PARENT_DIR)/repository" \
>> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t@mv /etc/snmp/snmptrapd.conf /etc/snmp/snmptrapd.conf.bak" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t@cp /usr/share/Pegasus/test/snmptrapd.conf /etc/snmp/snmptrapd.conf" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@make cimstart" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@make create_providerlinks" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "else" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@@ -293,6 +307,7 @@ createMakefile_unsetupTEST:
>> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@mv $(PEGASUS_REPOSITORY_PARENT_DIR)/repository.bak $(PEGASUS_REPOSITORY_PARENT_DIR)/repository" \
>> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
+ @$(ECHO-E) "\t@mv /etc/snmp/snmptrapd.conf.bak /etc/snmp/snmptrapd.conf" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "endif" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "\t@make remove_providerlinks" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile
@$(ECHO-E) "" >> $(PEGASUS_STAGING_DIR)$(PEGASUS_TEST_DIR)/Makefile

13
snmptrapd.conf Normal file
View File

@ -0,0 +1,13 @@
# Example configuration file for snmptrapd
#
# No traps are handled by default, you must edit this file!
#
# SNMPv3
createUser -e 0x80001f88808a67e858ee38ec4c sahana MD5 setup_passphrase DES setup_passphrase
authUser log,execute,net sahana
# SNMPv2
authCommunity log,execute,net public

View File

@ -8,7 +8,7 @@
Name: tog-pegasus Name: tog-pegasus
Version: %{major_ver}.1 Version: %{major_ver}.1
Release: 23%{?dist} Release: 24%{?dist}
Epoch: 2 Epoch: 2
Summary: OpenPegasus WBEM Services for Linux Summary: OpenPegasus WBEM Services for Linux
@ -35,6 +35,8 @@ Source9: cim_schema_2.38.0Experimental-MOFs.zip
# 10: Fedora/RHEL script for adding self-signed certificates to the local CA # 10: Fedora/RHEL script for adding self-signed certificates to the local CA
# trust store # trust store
Source10: generate-certs Source10: generate-certs
# 11: Configuration file for snmp tests in -test rpm
Source11: snmptrapd.conf
# 1: http://cvs.rdg.opengroup.org/bugzilla/show_bug.cgi?id=5011 # 1: http://cvs.rdg.opengroup.org/bugzilla/show_bug.cgi?id=5011
# Removing insecure -rpath # Removing insecure -rpath
@ -55,8 +57,8 @@ Patch5: pegasus-2.9.0-local-or-remote-auth.patch
Patch6: pegasus-2.5.1-pam-wbem.patch Patch6: pegasus-2.5.1-pam-wbem.patch
# 9: Adds cimuser binary to admin commands # 9: Adds cimuser binary to admin commands
Patch9: pegasus-2.6.0-cimuser.patch Patch9: pegasus-2.6.0-cimuser.patch
# 12: Removes snmp tests, which we don't want to perform # 12: Adds snmp tests to the -test rpm, configures snmptrapd
Patch12: pegasus-2.7.0-no_snmp_tests.patch Patch12: pegasus-2.7.0-snmp-tests.patch
# 13: Changes to make package compile on sparc # 13: Changes to make package compile on sparc
Patch13: pegasus-2.9.0-sparc.patch Patch13: pegasus-2.9.0-sparc.patch
# 16: Fixes "getpagesize" build error # 16: Fixes "getpagesize" build error
@ -211,7 +213,7 @@ yes | mak/CreateDmtfSchema 238 %{SOURCE9} cim_schema_2.38.0
%patch4 -p1 -b .cmpi-provider-lib %patch4 -p1 -b .cmpi-provider-lib
%patch6 -p1 -b .pam-wbem %patch6 -p1 -b .pam-wbem
%patch9 -p1 -b .cimuser %patch9 -p1 -b .cimuser
%patch12 -p1 -b .no_snmp_tests %patch12 -p1 -b .snmp-tests
%patch5 -p1 -b .local-or-remote-auth %patch5 -p1 -b .local-or-remote-auth
%patch13 -p1 -b .sparc %patch13 -p1 -b .sparc
%patch16 -p1 -b .getpagesize %patch16 -p1 -b .getpagesize
@ -309,6 +311,10 @@ mkdir -p $RPM_BUILD_ROOT/%{_includedir}/Pegasus/Listener
install -m 644 src/Pegasus/Listener/Linkage.h $RPM_BUILD_ROOT/%{_includedir}/Pegasus/Listener install -m 644 src/Pegasus/Listener/Linkage.h $RPM_BUILD_ROOT/%{_includedir}/Pegasus/Listener
install -m 644 src/Pegasus/Listener/CIMListener.h $RPM_BUILD_ROOT/%{_includedir}/Pegasus/Listener install -m 644 src/Pegasus/Listener/CIMListener.h $RPM_BUILD_ROOT/%{_includedir}/Pegasus/Listener
# Install snptrapd.conf used for net-snmp tests
%if %{PEGASUS_BUILD_TEST_RPM}
install -p %{SOURCE11} $RPM_BUILD_ROOT/usr/share/Pegasus/test/snmptrapd.conf
%endif
%check %check
# run unit tests # run unit tests
@ -386,6 +392,7 @@ make prestarttests
/usr/share/Pegasus/test/log.trace.0 /usr/share/Pegasus/test/log.trace.0
/usr/share/Pegasus/test/testtracer4.trace.0 /usr/share/Pegasus/test/testtracer4.trace.0
/usr/share/Pegasus/test/Makefile /usr/share/Pegasus/test/Makefile
%attr(0600, root, root) /usr/share/Pegasus/test/snmptrapd.conf
/usr/share/Pegasus/test/mak /usr/share/Pegasus/test/mak
%dir /usr/share/Pegasus/test/tmp %dir /usr/share/Pegasus/test/tmp
%ghost /usr/share/Pegasus/test/tmp/procIdFile %ghost /usr/share/Pegasus/test/tmp/procIdFile
@ -497,7 +504,11 @@ fi
%changelog %changelog
* Wed Apr 08 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 2:2.14.1-1 * Tue May 19 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 2:2.14.1-24
- Add snmp tests to the -test rpm and enable them, configure snmptrapd
in test setup phase
* Wed Apr 08 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 2:2.14.1-23
- Update to upstream version 2.14.1 - Update to upstream version 2.14.1
* Tue Feb 10 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 2:2.13.0-23 * Tue Feb 10 2015 Vitezslav Crhonek <vcrhonek@redhat.com> - 2:2.13.0-23