Skip to content

Commit cf6c362

Browse files
authored
Merge pull request #56 from VCTLabs/dev-workflows
pre-release cleanup
2 parents b4bed0f + e472545 commit cf6c362

File tree

5 files changed

+76
-39
lines changed

5 files changed

+76
-39
lines changed

.pre-commit-config.yaml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
# To update the pre-commit hooks run:
44
# pre-commit install-hooks
55

6-
exclude: '^(debian/.*|.tox/)$'
6+
exclude: '^(debian/.*|.tox/|test/)$'
77
repos:
88
- repo: meta
99
hooks:
1010
- id: check-useless-excludes
1111
- id: check-hooks-apply
1212
- repo: https://github.com/pre-commit/pre-commit-hooks
13-
rev: v4.0.1
13+
rev: v4.4.0
1414
hooks:
1515
- id: trailing-whitespace
1616
- id: end-of-file-fixer
@@ -30,7 +30,7 @@ repos:
3030
exclude: 'conda/meta.yaml'
3131

3232
- repo: https://github.com/PyCQA/doc8
33-
rev: 0.10.1
33+
rev: v1.1.1
3434
hooks:
3535
- id: doc8
3636
args:
@@ -39,7 +39,7 @@ repos:
3939
exclude: ChangeLog\.rst$
4040

4141
- repo: https://github.com/pre-commit/pygrep-hooks
42-
rev: v1.9.0
42+
rev: v1.10.0
4343
hooks:
4444
- id: rst-backticks
4545
exclude: ChangeLog\.rst$
@@ -70,7 +70,7 @@ repos:
7070

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

8484
- repo: https://github.com/jorisroovers/gitlint
85-
rev: v0.16.0
85+
rev: v0.19.1
8686
hooks:
8787
- id: gitlint

src/redis_ipc.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
//
55
// use the following to suppress false positives
66
// coverity[EVENT_TAG_NAME]
7+
// LINT_C_FILE
78

89
#define _GNU_SOURCE // for gettid()
910
#include <unistd.h>
@@ -1078,7 +1079,7 @@ char * redis_ipc_read_setting_field(const char *owner_component, const char *fie
10781079
return field_value;
10791080
}
10801081

1081-
char * redis_ipc_read_status_field(const char *owner_component, const char *field_name)
1082+
const char * redis_ipc_read_status_field(const char *owner_component, const char *field_name)
10821083
{
10831084
char status_hash_path[RIPC_MAX_IPC_PATH_LEN];
10841085
const char *field_value = NULL;
@@ -1477,7 +1478,7 @@ json_object * redis_ipc_get_message_timeout(struct timeval timeout)
14771478
// block until a message is available or timeout is reached,
14781479
// using special redis context for subscriptions
14791480
redisSetTimeout(thread_info->redis_sub_state, timeout);
1480-
ret = redisGetReply(thread_info->redis_sub_state, &reply);
1481+
ret = redisGetReply(thread_info->redis_sub_state, (void *)&reply);
14811482
if (ret != REDIS_OK)
14821483
{
14831484
// must reconnect to redis server after an error

src/redis_ipc.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Copyright (c) 2011-2021 Vanguard Computer Technology Labs <[email protected]>
22
//
33
// SPDX-License-Identifier: GPL-2.0-only
4+
// LINT_C_FILE
45

56
#ifndef __REDIS_IPC_H__
67
#define __REDIS_IPC_H__
@@ -184,7 +185,7 @@ char * redis_ipc_read_setting_field(const char *owner_component, const char *fie
184185
int redis_ipc_write_status(const json_object *fields);
185186
json_object * redis_ipc_read_status(const char *owner_component);
186187
int redis_ipc_write_status_field(const char *field_name, const char *field_value);
187-
char * redis_ipc_read_status_field(const char *owner_component, const char *field_name);
188+
const char * redis_ipc_read_status_field(const char *owner_component, const char *field_name);
188189

189190

190191
// Each component can only send event messages to its own event channel(s),

test/pub_sub_test.out

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
(web) [MESSAGE] { "severity": "info", "message": "save trees, go digital", "channel": "channel.events.printer", "timestamp": "1668597828.839953", "component": "printer", "thread": "monitor", "tid": 26522 }
1616
(printer) HSET settings.redis-ipc settings_writer *
1717
** This full setting write should generate 'hset' message...
18-
(printer) HMSET settings.web colorspace purple and more purple theme boisterous
18+
(printer) HMSET settings.web colorspace purple and more purple theme boisterous
1919
(web) [MESSAGE] hset
2020
** This single setting field write should generate 'hset' message...
2121
(printer) HSET settings.web theme stealth

tox.ini

Lines changed: 64 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ skipsdist = true
88
#basepython = python3.8
99
install_command = pip install {opts} {packages}
1010
skip_install = true
11-
envdir = {toxinidir}/.env
11+
12+
[testenv:{tests,clang,ctest,bionic,lcov,lint,grind,clean,cover}]
13+
envdir = {toxworkdir}/build
1214
runner = ignore_env_name_mismatch
1315

1416
passenv =
@@ -20,48 +22,41 @@ passenv =
2022
PIP_DOWNLOAD_CACHE
2123

2224
setenv =
23-
clang: CC = {env:CC:clang}
25+
clang: CC = {env:CC:clang}
2426
clang: CXX = {env:CXX:clang++}
2527
clang: ENV_LLVM_VER = {env:ENV_LLVM_VER:15}
26-
{auto,bionic}: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}
28+
bionic: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}
2729

2830
allowlist_externals =
29-
{tests,clang,ctest,bionic,lint,grind,clean,auto,autoclean,dist}: bash
31+
{tests,clang,ctest,bionic,lint,grind,clean}: bash
3032
{tests,clang,bionic,grind,cover}: mkdir
3133

3234
changedir =
3335
{tests,bionic,clang,grind}: build
3436

3537
deps =
36-
pip>=21.0.1
37-
gcovr
38-
{tests,bionic,clang,ctest,grind,lcov}: lcov_cobertura
39-
{tests,bionic,clang,ctest,grind,lcov}: cmake
40-
{tests,bionic,clang,ctest,grind,lcov}: ninja
41-
{tests,bionic,clang,ctest,grind,lcov}: ValgrindCI
42-
{auto,dist,cover}: this-cli
38+
{tests,bionic,clang,ctest,grind,lcov,lint,cover}: pip>=21.0.1
39+
{tests,bionic,clang,ctest,grind,lcov,cover}: gcovr
40+
{tests,bionic,clang,ctest,grind,lcov,cover}: lcov_cobertura
41+
{tests,bionic,clang,ctest,grind,lcov,cover}: cmake
42+
{tests,bionic,clang,ctest,grind,lcov,cover}: ninja
43+
{tests,bionic,clang,ctest,grind,lcov,cover}: ValgrindCI
4344
lint: cpplint
4445
lint: beautysh
4546

4647
commands_pre =
4748
bionic: mkdir -p {toxinidir}/coverage
4849
{tests,clang,bionic,grind}: mkdir -p {toxinidir}/build
49-
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
50-
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh status'
50+
{tests,clang,ctest,grind}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
51+
{tests,clang,ctest,grind}: bash -c '{toxinidir}/scripts/run_redis.sh status'
5152

5253
commands =
53-
# sadly this-cli cannot pass args to configure
54-
dist: this check
55-
dist: bash -c 'make clean'
56-
dist: bash -c 'make dist'
5754
bionic: bash -c 'cmake -G {posargs:"Unix Makefiles"} -DWITH_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..'
5855
bionic: bash -c 'cmake --build .'
59-
auto: bash -c 'autoreconf -fiv'
60-
auto: bash -c './configure {posargs:"--with-coverage"}'
61-
{auto,bionic}: bash -c 'make cov || true'
62-
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
63-
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
64-
{auto,bionic}: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
56+
bionic: bash -c 'make cov || true'
57+
bionic: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
58+
bionic: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
59+
bionic: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
6560
clang: bash -c 'cmake -DRIPC_BUILD_TESTING=ON -DCOVERAGE_BUILD=ON -DCOVERAGE_HTML=ON -DLLVM_VER=$ENV_LLVM_VER ..'
6661
tests: bash -c 'cmake -DWITH_COVERAGE=1 -DCMAKE_BUILD_TYPE=Debug ..'
6762
grind: bash -c 'cmake -DRIPC_BUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug ..'
@@ -70,12 +65,10 @@ commands =
7065
clang: bash -c 'cmake --build . --target coverage'
7166
lcov: lcov_cobertura build/coverage/lcov.info --base-dir {toxinidir} --output coverage.xml
7267
lint: bash -c 'cpplint --output=gsed {toxinidir}/src/* {toxinidir}/inc/*'
73-
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b src/.libs/ test/
74-
auto: gcovr --xml-pretty -o coverage.xml src/.libs/ test/
7568
{bionic,tests}: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b -r {toxinidir} .
7669
bionic: gcovr -r {toxinidir} --xml-pretty -o coverage.xml .
7770
bionic: gcovr -r {toxinidir} --html --html-details -o {toxinidir}/coverage/coverage.html .
78-
{auto,bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
71+
{bionic}: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
7972
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'
8073
ctest: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b build/
8174
cover: gcovr --xml-pretty -o coverage.xml build/
@@ -91,9 +84,51 @@ commands =
9184
# xml exception (no errors in report) => junk after document element
9285
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --number-of-errors || true'
9386
#grind: bash -c '[[ -f command_check.xml ]] && valgrind-ci command_check.xml --summary || true'
94-
clean: bash -c 'rm -rf build/ coverage/ coverage.xml *.gcov'
95-
autoclean: bash -c 'make distclean-recursive'
96-
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'
87+
clean: bash -c 'rm -rf build/ coverage/ coverage.xml *.gcov __pycache__/'
9788

9889
commands_post =
9990
{tests,clang,ctest,grind,dist}: bash -c '{toxinidir}/scripts/run_redis.sh stop > /dev/null'
91+
92+
[testenv:{auto,autoclean,dist}]
93+
envdir = {toxworkdir}/auto
94+
runner = ignore_env_name_mismatch
95+
96+
passenv =
97+
pythonLocation
98+
CC
99+
CXX
100+
CI
101+
GITHUB*
102+
PIP_DOWNLOAD_CACHE
103+
104+
setenv =
105+
auto: ENV_RIPC_RUNTIME_DIR = {env:ENV_RIPC_RUNTIME_DIR:{envtmpdir}}
106+
107+
allowlist_externals =
108+
{auto,autoclean,dist}: bash
109+
110+
deps =
111+
{auto,autoclean,dist}: pip>=21.0.1
112+
{auto,autoclean,dist}: this-cli
113+
{auto,autoclean,dist}: gcovr
114+
115+
commands_pre =
116+
{dist}: bash -c '{toxinidir}/scripts/run_redis.sh start > /dev/null'
117+
{dist}: bash -c '{toxinidir}/scripts/run_redis.sh status'
118+
119+
commands =
120+
# sadly this-cli cannot pass args to configure
121+
dist: this check
122+
dist: bash -c 'make clean'
123+
dist: bash -c 'make dist'
124+
auto: bash -c 'autoreconf -fiv'
125+
auto: bash -c './configure {posargs:"--with-coverage"}'
126+
auto: bash -c 'make cov || true'
127+
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh start > /dev/null'
128+
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh status'
129+
auto: bash -c 'RIPC_SERVER_PATH=$ENV_RIPC_RUNTIME_DIR/socket make cov'
130+
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn -s -b src/.libs/ test/
131+
auto: gcovr --gcov-ignore-parse-errors=negative_hits.warn --xml-pretty -o coverage.xml src/.libs/ test/
132+
auto: bash -c 'RIPC_RUNTIME_DIR=$ENV_RIPC_RUNTIME_DIR {toxinidir}/scripts/run_redis.sh stop'
133+
autoclean: bash -c 'make distclean-recursive'
134+
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 commit comments

Comments
 (0)