From 8de8b8ef202e0ae151b3445d72c33c6ae8c727eb Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 24 Aug 2017 12:20:14 +0200 Subject: [PATCH 1/4] dstate.h : use our timehead.h to have "struct timeval" defined --- clients/upsclient.c | 3 +-- drivers/dstate.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/clients/upsclient.c b/clients/upsclient.c index f749a4c7d0..b90587b001 100644 --- a/clients/upsclient.c +++ b/clients/upsclient.c @@ -25,7 +25,7 @@ #ifdef HAVE_PTHREAD /* this include is needed on AIX to have errno stored in thread local storage */ #include -#endif +#endif #include #include @@ -37,7 +37,6 @@ #include #include #include -#include #include "upsclient.h" #include "common.h" diff --git a/drivers/dstate.h b/drivers/dstate.h index f4e244afd8..dd1b920122 100644 --- a/drivers/dstate.h +++ b/drivers/dstate.h @@ -22,6 +22,7 @@ #ifndef DSTATE_H_SEEN #define DSTATE_H_SEEN 1 +#include "timehead.h" #include "state.h" #include "attribute.h" From 9dd4fc57a374b8b31c2780dd12a7c97933cbfe1e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Thu, 24 Aug 2017 12:14:27 +0200 Subject: [PATCH 2/4] eaton-marlin : cosmetic whitespace fixes --- drivers/eaton-pdu-marlin-mib.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/eaton-pdu-marlin-mib.c b/drivers/eaton-pdu-marlin-mib.c index 3b2d61273c..bd1f623974 100644 --- a/drivers/eaton-pdu-marlin-mib.c +++ b/drivers/eaton-pdu-marlin-mib.c @@ -244,7 +244,7 @@ static snmp_info_t eaton_marlin_mib[] = { SU_FLAG_STATIC | SU_FLAG_ABSENT | SU_FLAG_OK, NULL, NULL }, /* FIXME: needs a date reformating callback * 2011-8-29,16:27:25.0,+1:0 - * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 + * Hex-STRING: 07 DB 08 1D 10 0C 36 00 2B 01 00 00 * { "ups.date", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", "", SU_FLAG_STATIC | SU_FLAG_OK, NULL, NULL }, * { "ups.time", ST_FLAG_STRING, SU_INFOSIZE, ".1.3.6.1.4.1.534.6.6.7.1.2.1.8.0", @@ -500,7 +500,7 @@ static snmp_info_t eaton_marlin_mib[] = { /* instant commands. */ /* Notes: - * - load.cycle might be replaced by / mapped on shutdown.reboot + * - load.cycle might be replaced by / mapped on shutdown.reboot * - outletControl{Off,On,Reboot}Cmd values: * 0-n : Timer * -1 : Cancel From 7641f3b45c9f640e5949f52f1b32bb58383e7b0f Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Sun, 27 Aug 2017 13:56:09 +0200 Subject: [PATCH 3/4] tests/Makefile.am : cppunit should build with C++11 --- tests/Makefile.am | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/Makefile.am b/tests/Makefile.am index 4f1e893859..dbca0c7452 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,7 @@ # Network UPS Tools: tests +CPPUNIT_NUT_CFLAGS = -g -O0 -std=c++11 + if HAVE_CPPUNIT TESTS = cppunittest @@ -11,7 +13,7 @@ check-local: $(check_PROGRAMS) RES=0; for P in $^ ; do $(VALGRIND) ./$$P || { RES=$$? ; echo "FAILED: $(VALGRIND) ./$$P" >&2; }; done; exit $$RES endif -cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) +cppunittest_CXXFLAGS = $(CPPUNIT_CFLAGS) $(CPPUNIT_NUT_CFLAGS) cppunittest_LDFLAGS = $(CPPUNIT_LIBS) cppunittest_LDADD = ../clients/libnutclient.la From 50a5a0e45a4fa9909e0bc6466eb7b7674bf17e2e Mon Sep 17 00:00:00 2001 From: Jim Klimov Date: Mon, 28 Aug 2017 14:55:43 +0200 Subject: [PATCH 4/4] .travis.yml : make sure to use "docker" env with its gcc-4.8+ for support of C++11 in cppunit tests --- .travis.yml | 15 +++++++++++++-- tests/Makefile.am | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index e72e542203..b65ff9cd54 100644 --- a/.travis.yml +++ b/.travis.yml @@ -14,6 +14,10 @@ os: sudo: false +# Tests for cppunit require C++11 which requires gcc-4.8 or newer +# This is available in either "trusty" or newer distros, or in "docker" envs +#dist: trusty + services: - docker @@ -91,8 +95,9 @@ matrix: - aspell-en - env: BUILD_TYPE=default-tgt:distcheck-valgrind os: linux -# dist: trusty -# sudo: required + sudo: false + services: + - docker addons: apt: packages: @@ -107,12 +112,18 @@ matrix: - *deps_driverlibs - env: BUILD_TYPE=default-alldrv os: linux + sudo: false + services: + - docker addons: apt: packages: - *deps_driverlibs - env: BUILD_TYPE=default-tgt:distcheck-light os: linux + sudo: false + services: + - docker addons: apt: packages: diff --git a/tests/Makefile.am b/tests/Makefile.am index dbca0c7452..e44bb084e8 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,5 +1,7 @@ # Network UPS Tools: tests +# Tests with gcc-4.8 require this C++11 option to be provided explicitly +# gcc-4.6 does not support this yet; newer gcc's should be ok by default CPPUNIT_NUT_CFLAGS = -g -O0 -std=c++11 if HAVE_CPPUNIT