Skip to content

Commit

Permalink
Merge pull request #2789 from jimklimov/ci-fix-oi
Browse files Browse the repository at this point in the history
Various small CI fixes
  • Loading branch information
jimklimov authored Jan 29, 2025
2 parents e3ef649 + 16ee3da commit b42eda0
Show file tree
Hide file tree
Showing 11 changed files with 153 additions and 81 deletions.
2 changes: 1 addition & 1 deletion Jenkinsfile-dynamatrix
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ import org.nut.dynamatrix.*;
if ( env?.BRANCH_NAME ==~ dynacfgPipeline.branchStableRegex ) {
// For our main branches we want all builds in full,
// to keep reference for warnings-ng up to date, so do
// not limit ny appliesToChangedFilesRegex categories
// not limit any appliesToChangedFilesRegex categories

// Be sure to not make noise in long-lived branches'
// overview pages by enabling quick analysis publishing
Expand Down
12 changes: 8 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -5236,6 +5236,10 @@ dnl # some clang versions sanity-check Doxygen style comments, but do not
dnl # recognize "\retval" key word. These options try to both ignore the
dnl # problematic area, and to add it as recognized (TODO: scripted check
dnl # for abilities of the current build's compiler instead)
dnl # -Wno-missing-include-dirs -- do not break on missing include directories,
dnl # whether from user-provided config options, or pkg-config, or our own
dnl # ci_build.sh preparations (e.g. -I${top_srcdir}/tmp/include when it
dnl # is not populated yet)
dnl ### Special exclusion picks for clang-medium (same as hard, plus...):
dnl # -Wno-global-constructors -- using "const something" out of method context
dnl # potentially impacts start-up time and may be prone to race conditions
Expand Down Expand Up @@ -5281,12 +5285,12 @@ AS_CASE(["${nut_enable_warnings}"],
CXXFLAGS="${CXXFLAGS} -Wall"
],
[clang-hard], [
CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage"
CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage"
CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage"
CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage"
],
[clang-medium], [
CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion"
CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion"
CFLAGS="${CFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -pedantic -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-float-conversion -Wno-double-promotion -Wno-implicit-float-conversion -Wno-conversion -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types-strict -Wno-nullable-to-nonnull-conversion"
CXXFLAGS="${CXXFLAGS} -ferror-limit=0 -Wno-system-headers -Wno-missing-include-dirs -Wall -Wextra -Weverything -Wno-disabled-macro-expansion -Wno-unused-macros -Wno-reserved-id-macro -Wno-padded -Wno-documentation -fcomment-block-commands=retval -Wno-documentation-unknown-command -Wno-cast-qual -Wno-c++98-compat-pedantic -Wno-c++98-compat -Wno-exit-time-destructors -Wno-global-constructors -Wno-fuse-ld-path -Wno-unsafe-buffer-usage -Wno-nullable-to-nonnull-conversion"
],
[clang-minimal], [
CFLAGS="${CFLAGS} -ferror-limit=0 -Wall -Wextra -Wno-documentation -Wno-documentation-unknown-command -fcomment-block-commands=retval"
Expand Down
29 changes: 22 additions & 7 deletions docs/config-prereqs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1206,24 +1206,31 @@ For extra compiler coverage, we can install a large selection of versions,
although to meet NUT CI farm expectations we also need to expose "numbered"
filenames, as automated below:
------
# NOTE: not all compiler versions may be served, some are obsoleted over time.
# Check current distro repository offers with:
:; pkg info -r '*clang*' '*gcc*'
:; pkg search -r '*bin/g++*'
:; pkg search -r '*bin/clang++*'

:; pkg install \
gcc-48 gcc-49 gcc-5 gcc-6 gcc-7 gcc-9 gcc-10 gcc-11 \
clang-80 clang-90 \
ccache

# As of this writing, clang-13 refused to link (claiming issues with
# --fuse-ld which was never specified) on OI; maybe later it will:
:; pkg install \
developer/clang-13 runtime/clang-13
#:; pkg install \
# developer/clang-13 runtime/clang-13

# With OI 2024.04 there's also clang-18 available in the mix:
# With OI 2024.04 there's also clang-18 available in the mix, and as of
# 2025 packaging, clang-19 as well:
:; pkg install \
developer/clang-18 runtime/clang-18
developer/clang-19 runtime/clang-19

# Get clang-cpp-X visible in standard PATH (for CI to reference the right one),
# and make sure other frontends are exposed with versions (not all OI distro
# releases have such symlinks packaged right), e.g.:
:; (cd /usr/bin && for X in 8 9 13 18 ; do for T in "" "++" "-cpp"; do \
:; (cd /usr/bin && for X in 8 9 19 ; do for T in "" "++" "-cpp"; do \
ln -fs "../clang/$X.0/bin/clang$T" "clang${T}-${X}" ; \
done; done)

Expand Down Expand Up @@ -1286,14 +1293,22 @@ site for setup details.
# Optionally, make the environment comfortable, e.g.:
:; pkg install sudo bash application/mc wget rsync pigz pbzip2 p7zip top

# NOTE: OmniOS currently does not deliver clang in its Core/Extra repositories
# NOTE: not all compiler versions may be served, some are obsoleted over time.
# While OmniOS LTS 151046 offers a range of clang 13 to 17, current stable
# includes also 18 and 19. OmniOS does not provide implicit (not numbered)
# packages for clang or gcc. Check your distro repository offers with:
:; pkg info -r '*clang*' '*gcc*'
:; pkg search -r '*bin/g++*'
:; pkg search -r '*bin/clang++*'

:; pkg install \
developer/build/autoconf developer/build/automake \
developer/build/libtool library/libtool/libltdl \
build-essential ccache git developer/pkg-config \
runtime/perl \
asciidoc \
libgd
libgd \
developer/clang-17

:; pkg install \
net-snmp
Expand Down
4 changes: 2 additions & 2 deletions drivers/libusb1.c
Original file line number Diff line number Diff line change
Expand Up @@ -730,8 +730,8 @@ static int nut_libusb_open(libusb_device_handle **udevp,
#if (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_PUSH_POP) && ( (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TYPE_LIMITS) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_CONSTANT_OUT_OF_RANGE_COMPARE) || (defined HAVE_PRAGMA_GCC_DIAGNOSTIC_IGNORED_TAUTOLOGICAL_UNSIGNED_ZERO_COMPARE) )
# pragma GCC diagnostic pop
#endif
upsdebugx(2, "HID descriptor too long %d (max %d)",
rdlen, UINT16_MAX);
upsdebugx(2, "HID descriptor too long %d (max %" PRIuMAX ")",
rdlen, (uintmax_t)UINT16_MAX);
goto next_device;
}

Expand Down
6 changes: 3 additions & 3 deletions drivers/nut-libfreeipmi.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ int nut_ipmi_open(int ipmi_id, IPMIDevice_t *ipmi_dev)
if (area_length > (int)UINT8_MAX) {
libfreeipmi_cleanup();
fatal_with_errno(EXIT_FAILURE,
"nut_ipmi_open: got area_length %d is too large for libfreeipmi",
"nut_ipmi_open: got area_length %u is too large for libfreeipmi",
area_length);
}

Expand Down Expand Up @@ -794,7 +794,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
if (tmp_entity_id == entity_id
&& tmp_entity_instance == entity_instance)
{
upsdebugx (1, "Found record id = %u for device id %u",
upsdebugx (1, "Found record id = %u for device id %i",
record_id, ipmi_dev->ipmi_id);

/* Add it to the tracked list */
Expand All @@ -817,7 +817,7 @@ static int libfreeipmi_get_sensors_info (IPMIDevice_t *ipmi_dev)
#endif /* HAVE_FREEIPMI_11X_12X */

if (ipmi_dev->sensors_count > INT_MAX) {
upsdebugx(1, "%s: Found %i sensors which is too many",
upsdebugx(1, "%s: Found %u sensors which is too many",
__func__, ipmi_dev->sensors_count);
}
return (int)ipmi_dev->sensors_count;
Expand Down
78 changes: 39 additions & 39 deletions drivers/optiups.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#include "nut_stdint.h"

#define DRIVER_NAME "Opti-UPS driver"
#define DRIVER_VERSION "1.06"
#define DRIVER_VERSION "1.07"

/* driver description structure */
upsdrv_info_t upsdrv_info = {
Expand Down Expand Up @@ -77,7 +77,7 @@ upsdrv_info_t upsdrv_info = {
#define OPTI_POWERUP "powerup"

/* All serial commands put their response in the same buffer space */
static char _buf[256];
static char opti_buf[256];

/* Model */
static int optimodel = 0;
Expand Down Expand Up @@ -108,14 +108,14 @@ typedef struct ezfill_s {

/* These can be polled right into a string usable by NUT.
* Others such as "AG" and "BV" require some transformation of the return value */
static ezfill_t _pollv[] = {
static ezfill_t opti_pollv[] = {
{ "NV", "input.voltage", 0 },
{ "OL", "ups.load", 1.0 },
{ "OV", "output.voltage", 0 },
{ "FF", "input.frequency", 0.1 },
{ "BT", "ups.temperature", 0 },
};
static ezfill_t _pollv_zinto[] = {
static ezfill_t opti_pollv_zinto[] = {
{ "NV", "input.voltage", 2.0 },
{ "OL", "ups.load", 1.0 },
{ "OV", "output.voltage", 2.0 },
Expand All @@ -131,14 +131,14 @@ static ezfill_t _pollv_zinto[] = {
* I suspect this will be the case for other Opti-UPS models, but as I can only
* test with a PS-1440RM at 230V the change is only applied to PowerSeries models.
*/
static ezfill_t _pollv_ps[] = {
static ezfill_t opti_pollv_ps[] = {
{ "OL", "ups.load", 1.0 },
{ "FF", "input.frequency", 0.1 },
{ "BT", "ups.temperature", 0 },
};

/* model "IO" is parsed differently in upsdrv_initinfo() */
static ezfill_t _initv[] = {
static ezfill_t opti_initv[] = {
{ "IM", "ups.mfr", 0 },
{ "IZ", "ups.serial", 0 },
{ "IS", "ups.firmware", 0 },
Expand All @@ -151,32 +151,32 @@ static inline ssize_t optireadline(void)
{
ssize_t r;
usleep(150000);
r = ser_get_line(upsfd, _buf, sizeof(_buf), ENDCHAR, IGNCHARS, 0, 500000 );
_buf[sizeof(_buf)-1] = 0;
r = ser_get_line(upsfd, opti_buf, sizeof(opti_buf), ENDCHAR, IGNCHARS, 0, 500000 );
opti_buf[sizeof(opti_buf)-1] = 0;
if ( r > 0 )
{
if ( r < (int)sizeof(_buf) )
_buf[r] = 0;
if ( _buf[0] == 0x15 )
if ( r < (int)sizeof(opti_buf) )
opti_buf[r] = 0;
if ( opti_buf[0] == 0x15 )
{
r=-2;
upsdebugx(1, "READ: <unsupported command>");
}
if ( _buf[0] == 0x06 )
if ( opti_buf[0] == 0x06 )
{
upsdebugx(2, "READ: <command done>");
}
else
{
upsdebugx(2, "READ: \"%s\"", _buf );
upsdebugx(2, "READ: \"%s\"", opti_buf );
}
}
else
upsdebugx(1, "READ ERROR: %" PRIiSIZE, r);
return r;
}

/* Send a command and read the response. Command response is in global _buf.
/* Send a command and read the response. Command response is in global opti_buf.
* Return
* > 0 implies success.
* -1 serial timeout
Expand Down Expand Up @@ -221,12 +221,12 @@ static void optifill( ezfill_t *a, size_t len )
}
if ( a[i].scale > 1e-20 )
{
float f = strtol( _buf, NULL, 10 ) * a[i].scale;
float f = strtol( opti_buf, NULL, 10 ) * a[i].scale;
dstate_setinfo( a[i].var, "%.1f", f );
}
else
{
dstate_setinfo( a[i].var, "%s", _buf);
dstate_setinfo( a[i].var, "%s", opti_buf);
}
}
}
Expand Down Expand Up @@ -340,8 +340,8 @@ void upsdrv_initinfo(void)
if ( testvar(OPTI_POWERUP) && optiquery( "AG" ) < 1 )
{
ser_send( upsfd, "AG\r\n" );
r = ser_get_char(upsfd, &_buf[0], 1, 0);
if ( r == 1 && _buf[0] == '2' )
r = ser_get_char(upsfd, &opti_buf[0], 1, 0);
if ( r == 1 && opti_buf[0] == '2' )
{
upslogx( LOG_WARNING, "ups was off, switching it on" );
optiquery( "Ct1" );
Expand All @@ -353,7 +353,7 @@ void upsdrv_initinfo(void)

/* Autodetect an Online-USV (only Zinto D is known to work) */
r = optiquery( "IM" );
if ( r > 0 && !strcasecmp(_buf, "ONLINE") )
if ( r > 0 && !strcasecmp(opti_buf, "ONLINE") )
{
optimodel = OPTIMODEL_ZINTO;
optiquery( "Om11" );
Expand All @@ -363,47 +363,47 @@ void upsdrv_initinfo(void)

/* Autodetect an Opti-UPS PS series */
r = optiquery( "IO" );
if ( r > 0 && !strncasecmp(_buf, "PS-", 3) )
if ( r > 0 && !strncasecmp(opti_buf, "PS-", 3) )
{
optimodel = OPTIMODEL_PS;
}

optifill( _initv, SIZEOF_ARRAY(_initv) );
optifill( opti_initv, SIZEOF_ARRAY(opti_initv) );

/* Parse out model into longer string -- is this really USEFUL??? */
r = optiquery( "IO" );
if ( r < 1 )
fatal_with_errno(EXIT_FAILURE, "can't retrieve model" );
else
{
switch ( _buf[r-1] )
switch ( opti_buf[r-1] )
{
case 'E':
case 'P':
case 'V':
dstate_setinfo("ups.model", "Power%cS %s", _buf[r-1], _buf );
dstate_setinfo("ups.model", "Power%cS %s", opti_buf[r-1], opti_buf );
break;
default:
dstate_setinfo("ups.model", "%s", _buf );
dstate_setinfo("ups.model", "%s", opti_buf );
break;
}
}

/* Parse out model into longer string */
r = optiquery( "IM" );
if ( r > 0 && !strcasecmp(_buf, "ONLINE") )
if ( r > 0 && !strcasecmp(opti_buf, "ONLINE") )
{
dstate_setinfo("ups.mfr", "ONLINE USV-Systeme AG");
r = optiquery( "IO" );
if ( r < 1 )
fatal_with_errno(EXIT_FAILURE, "can't retrieve model" );
switch ( _buf[0] )
switch ( opti_buf[0] )
{
case 'D':
dstate_setinfo("ups.model", "Zinto %s", _buf );
dstate_setinfo("ups.model", "Zinto %s", opti_buf );
break;
default:
dstate_setinfo("ups.model", "%s", _buf );
dstate_setinfo("ups.model", "%s", opti_buf );
break;
}
}
Expand Down Expand Up @@ -440,8 +440,8 @@ void upsdrv_updateinfo(void)
if ( r < 1 && optimodel == OPTIMODEL_ZINTO )
{
ser_send( upsfd, "AG\r\n" );
r = ser_get_char(upsfd, &_buf[0], 1, 0);
if ( r == 1 && _buf[0] == '2' )
r = ser_get_char(upsfd, &opti_buf[0], 1, 0);
if ( r == 1 && opti_buf[0] == '2' )
{
status_init();
status_set("OFF");
Expand All @@ -457,7 +457,7 @@ void upsdrv_updateinfo(void)
}
else
{
long s = strtol( _buf, NULL, 16 );
long s = strtol( opti_buf, NULL, 16 );
status_init();
if ( s & OPTISBIT_OVERLOAD )
status_set("OVER");
Expand All @@ -483,21 +483,21 @@ void upsdrv_updateinfo(void)

/* read some easy settings */
if ( optimodel == OPTIMODEL_ZINTO )
optifill( _pollv_zinto, SIZEOF_ARRAY(_pollv_zinto) );
optifill( opti_pollv_zinto, SIZEOF_ARRAY(opti_pollv_zinto) );
else if ( optimodel == OPTIMODEL_PS ) {
short inV, outV, fV;

optifill( _pollv_ps, SIZEOF_ARRAY(_pollv_ps) );
optifill( opti_pollv_ps, SIZEOF_ARRAY(opti_pollv_ps) );

r = optiquery( "NV" );
str_to_short ( _buf, &inV, 10 );
str_to_short ( opti_buf, &inV, 10 );
r = optiquery( "OV" );
str_to_short ( _buf, &outV, 10 );
str_to_short ( opti_buf, &outV, 10 );

r = optiquery( "FV" );
if ( r >= 1 )
{
str_to_short ( _buf, &fV, 10 );
str_to_short ( opti_buf, &fV, 10 );
if ( fV > 180 )
{
inV = inV * 2;
Expand All @@ -508,15 +508,15 @@ void upsdrv_updateinfo(void)
dstate_setinfo( "output.voltage", "%d", outV );
}
else
optifill( _pollv, SIZEOF_ARRAY(_pollv) );
optifill( opti_pollv, SIZEOF_ARRAY(opti_pollv) );

/* Battery voltage is harder */
r = optiquery( "BV" );
if ( r < 1 )
upslogx( LOG_WARNING, "cannot retrieve battery voltage" );
else
{
float p, v = strtol( _buf, NULL, 10 ) / 10.0;
float p, v = strtol( opti_buf, NULL, 10 ) / 10.0;
dstate_setinfo("battery.voltage", "%.1f", v );

if (v > 20)
Expand Down Expand Up @@ -553,7 +553,7 @@ void upsdrv_shutdown(void)
}
else
{
s = strtol( _buf, NULL, 16 );
s = strtol( opti_buf, NULL, 16 );
}

/* Turn output stage back on if power returns - but really means
Expand Down
Loading

0 comments on commit b42eda0

Please sign in to comment.