Skip to content

Commit

Permalink
Merge pull request #56 from VCTLabs/dev-workflows
Browse files Browse the repository at this point in the history
pre-release cleanup
  • Loading branch information
SJLC committed Oct 7, 2023
2 parents b4bed0f + e472545 commit cf6c362
Show file tree
Hide file tree
Showing 5 changed files with 76 additions and 39 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@
# To update the pre-commit hooks run:
# pre-commit install-hooks

exclude: '^(debian/.*|.tox/)$'
exclude: '^(debian/.*|.tox/|test/)$'
repos:
- repo: meta
hooks:
- id: check-useless-excludes
- id: check-hooks-apply
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.0.1
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
Expand All @@ -30,7 +30,7 @@ repos:
exclude: 'conda/meta.yaml'

- repo: https://github.com/PyCQA/doc8
rev: 0.10.1
rev: v1.1.1
hooks:
- id: doc8
args:
Expand All @@ -39,7 +39,7 @@ repos:
exclude: ChangeLog\.rst$

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.9.0
rev: v1.10.0
hooks:
- id: rst-backticks
exclude: ChangeLog\.rst$
Expand Down Expand Up @@ -70,7 +70,7 @@ repos:

# current cpplint hook ignores top-level CPPLINT.cfg
- repo: https://github.com/cpplint/cpplint
rev: 1.5.5
rev: 1.6.1
hooks:
- id: cpplint
args:
Expand All @@ -82,6 +82,6 @@ repos:
files: \.(h|hh|hpp|hxx|h|c|cc|cpp|cxx|c)$

- repo: https://github.com/jorisroovers/gitlint
rev: v0.16.0
rev: v0.19.1
hooks:
- id: gitlint
5 changes: 3 additions & 2 deletions src/redis_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
//
// use the following to suppress false positives
// coverity[EVENT_TAG_NAME]
// LINT_C_FILE

#define _GNU_SOURCE // for gettid()
#include <unistd.h>
Expand Down Expand Up @@ -1078,7 +1079,7 @@ char * redis_ipc_read_setting_field(const char *owner_component, const char *fie
return field_value;
}

char * redis_ipc_read_status_field(const char *owner_component, const char *field_name)
const char * redis_ipc_read_status_field(const char *owner_component, const char *field_name)
{
char status_hash_path[RIPC_MAX_IPC_PATH_LEN];
const char *field_value = NULL;
Expand Down Expand Up @@ -1477,7 +1478,7 @@ json_object * redis_ipc_get_message_timeout(struct timeval timeout)
// block until a message is available or timeout is reached,
// using special redis context for subscriptions
redisSetTimeout(thread_info->redis_sub_state, timeout);
ret = redisGetReply(thread_info->redis_sub_state, &reply);
ret = redisGetReply(thread_info->redis_sub_state, (void *)&reply);
if (ret != REDIS_OK)
{
// must reconnect to redis server after an error
Expand Down
3 changes: 2 additions & 1 deletion src/redis_ipc.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// Copyright (c) 2011-2021 Vanguard Computer Technology Labs <answers@vctlabs.com>
//
// SPDX-License-Identifier: GPL-2.0-only
// LINT_C_FILE

#ifndef __REDIS_IPC_H__
#define __REDIS_IPC_H__
Expand Down Expand Up @@ -184,7 +185,7 @@ char * redis_ipc_read_setting_field(const char *owner_component, const char *fie
int redis_ipc_write_status(const json_object *fields);
json_object * redis_ipc_read_status(const char *owner_component);
int redis_ipc_write_status_field(const char *field_name, const char *field_value);
char * redis_ipc_read_status_field(const char *owner_component, const char *field_name);
const char * redis_ipc_read_status_field(const char *owner_component, const char *field_name);


// Each component can only send event messages to its own event channel(s),
Expand Down
2 changes: 1 addition & 1 deletion test/pub_sub_test.out
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
(web) [MESSAGE] { "severity": "info", "message": "save trees, go digital", "channel": "channel.events.printer", "timestamp": "1668597828.839953", "component": "printer", "thread": "monitor", "tid": 26522 }
(printer) HSET settings.redis-ipc settings_writer *
** This full setting write should generate 'hset' message...
(printer) HMSET settings.web colorspace purple and more purple theme boisterous
(printer) HMSET settings.web colorspace purple and more purple theme boisterous
(web) [MESSAGE] hset
** This single setting field write should generate 'hset' message...
(printer) HSET settings.web theme stealth
Expand Down
93 changes: 64 additions & 29 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ skipsdist = true
#basepython = python3.8
install_command = pip install {opts} {packages}
skip_install = true
envdir = {toxinidir}/.env

[testenv:{tests,clang,ctest,bionic,lcov,lint,grind,clean,cover}]
envdir = {toxworkdir}/build
runner = ignore_env_name_mismatch

passenv =
Expand All @@ -20,48 +22,41 @@ passenv =
PIP_DOWNLOAD_CACHE

setenv =
clang: CC = {env:CC:clang}
clang: CC = {env:CC:clang}
clang: CXX = {env:CXX:clang++}
clang: ENV_LLVM_VER = {env:ENV_LLVM_VER:15}
{auto,bionic}: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}
bionic: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}

allowlist_externals =
{tests,clang,ctest,bionic,lint,grind,clean,auto,autoclean,dist}: bash
{tests,clang,ctest,bionic,lint,grind,clean}: bash
{tests,clang,bionic,grind,cover}: mkdir

changedir =
{tests,bionic,clang,grind}: build

deps =
pip>=21.0.1
gcovr
{tests,bionic,clang,ctest,grind,lcov}: lcov_cobertura
{tests,bionic,clang,ctest,grind,lcov}: cmake
{tests,bionic,clang,ctest,grind,lcov}: ninja
{tests,bionic,clang,ctest,grind,lcov}: ValgrindCI
{auto,dist,cover}: this-cli
{tests,bionic,clang,ctest,grind,lcov,lint,cover}: pip>=21.0.1
{tests,bionic,clang,ctest,grind,lcov,cover}: gcovr
{tests,bionic,clang,ctest,grind,lcov,cover}: lcov_cobertura
{tests,bionic,clang,ctest,grind,lcov,cover}: cmake
{tests,bionic,clang,ctest,grind,lcov,cover}: ninja
{tests,bionic,clang,ctest,grind,lcov,cover}: ValgrindCI
lint: cpplint
lint: beautysh

commands_pre =
bionic: mkdir -p {toxinidir}/coverage
{tests,clang,bionic,grind}: mkdir -p {toxinidir}/build
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh status'
{tests,clang,ctest,grind}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
{tests,clang,ctest,grind}: bash -c '{toxinidir}/scripts/run_redis.sh status'

commands =
# sadly this-cli cannot pass args to configure
dist: this check
dist: bash -c 'make clean'
dist: bash -c 'make dist'
bionic: bash -c 'cmake -G {posargs:"Unix Makefiles"} -DWITH_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..'
bionic: bash -c 'cmake --build .'
auto: bash -c 'autoreconf -fiv'
auto: bash -c './configure {posargs:"--with-coverage"}'
{auto,bionic}: bash -c 'make cov || true'
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
{auto,bionic}: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
bionic: bash -c 'make cov || true'
bionic: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
bionic: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
bionic: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
clang: bash -c 'cmake -DRIPC_BUILD_TESTING=ON -DCOVERAGE_BUILD=ON -DCOVERAGE_HTML=ON -DLLVM_VER=$ENV_LLVM_VER ..'
tests: bash -c 'cmake -DWITH_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..'
grind: bash -c 'cmake -DRIPC_BUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug ..'
Expand All @@ -70,12 +65,10 @@ commands =
clang: bash -c 'cmake --build . --target coverage'
lcov: lcov_cobertura build/coverage/lcov.info --base-dir {toxinidir} --output coverage.xml
lint: bash -c 'cpplint --output=gsed {toxinidir}/src/* {toxinidir}/inc/*'
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b src/.libs/ test/
auto: gcovr --xml-pretty -o coverage.xml src/.libs/ test/
{bionic,tests}: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b -r {toxinidir} .
bionic: gcovr -r {toxinidir} --xml-pretty -o coverage.xml .
bionic: gcovr -r {toxinidir} --html --html-details -o {toxinidir}/coverage/coverage.html .
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
{bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
ctest: bash -c 'ctest --build-generator {posargs:"Unix Makefiles"} --build-and-test . build --build-options -DWITH_COVERAGE=ON -DCMAKE_BUILD_TYPE=Debug --test-command ctest --rerun-failed --output-on-failure -V'
ctest: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b build/
cover: gcovr --xml-pretty -o coverage.xml build/
Expand All @@ -91,9 +84,51 @@ commands =
# xml exception (no errors in report) => junk after document element
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --number-of-errors || true'
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --summary || true'
clean: bash -c 'rm -rf build/ coverage/ coverage.xml *.gcov'
autoclean: bash -c 'make distclean-recursive'
autoclean: bash -c 'rm -rf Makefile Makefile.in aclocal.m4 ar-lib autom4te.cache/ compile config.* coverage* configure configure~ depcomp install-sh libltdl/ ltmain.sh m4/ missing src/Makefile.in test-driver test/gmon.out test/Makefile.in'
clean: bash -c 'rm -rf build/ coverage/ coverage.xml *.gcov __pycache__/'

commands_post =
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh stop > /dev/null'

[testenv:{auto,autoclean,dist}]
envdir = {toxworkdir}/auto
runner = ignore_env_name_mismatch

passenv =
pythonLocation
CC
CXX
CI
GITHUB*
PIP_DOWNLOAD_CACHE

setenv =
auto: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}

allowlist_externals =
{auto,autoclean,dist}: bash

deps =
{auto,autoclean,dist}: pip>=21.0.1
{auto,autoclean,dist}: this-cli
{auto,autoclean,dist}: gcovr

commands_pre =
{dist}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
{dist}: bash -c '{toxinidir}/scripts/run_redis.sh status'

commands =
# sadly this-cli cannot pass args to configure
dist: this check
dist: bash -c 'make clean'
dist: bash -c 'make dist'
auto: bash -c 'autoreconf -fiv'
auto: bash -c './configure {posargs:"--with-coverage"}'
auto: bash -c 'make cov || true'
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
auto: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b src/.libs/ test/
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn --xml-pretty -o coverage.xml src/.libs/ test/
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
autoclean: bash -c 'make distclean-recursive'
autoclean: bash -c 'rm -rf Makefile Makefile.in aclocal.m4 ar-lib autom4te.cache/ compile config.* coverage* configure configure~ depcomp install-sh libltdl/ ltmain.sh m4/ missing src/Makefile.in test-driver test/gmon.out test/Makefile.in'

0 comments on commit cf6c362

Please sign in to comment.