Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue #660 - Add additional pre-commit hooks #662

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -528,7 +528,7 @@ jobs:
run: |
echo "coredump.%e.%p" > /proc/sys/kernel/core_pattern
ulimit -c unlimited

threads=12
if [[ "${{ matrix.runtimeCheck }}" == "tsan" ]]; then
threads=6
Expand Down
9 changes: 9 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
# See https://pre-commit.com for more information
# See https://pre-commit.com/hooks.html for more hooks
repos:

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

# https://betterprogramming.pub/2-use-cases-of-python-pre-commit-hooks-to-tidy-up-your-git-repositories-8d86c9c4f06b
- repo: local
hooks:
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -77,22 +77,22 @@ if(NOT DEFINED VERSION)
OUTPUT_VARIABLE DEFAULT_VERSION
RESULT_VARIABLE GIT_RESULT
OUTPUT_STRIP_TRAILING_WHITESPACE)


# You might sometimes get a fatal error when running the above command (when this is not a git repo).
# GIT_RESULT will contain the result of last child process. It will be zero if successful.
if (GIT_RESULT EQUAL 0)
# Git succeeded, we will use the DEFAULT_VERSION as the QPID_DISPATCH_VERSION
set(QPID_DISPATCH_VERSION ${DEFAULT_VERSION})
else()
# The git command failed, set QPID_DISPATCH_VERSION to "UNKNOWN"
# The git command failed, set QPID_DISPATCH_VERSION to "UNKNOWN"
set(QPID_DISPATCH_VERSION "UNKNOWN")
endif(GIT_RESULT EQUAL 0)
else(Git_FOUND)
# Git executable was not available, we will not be able to determine the version, just set it to "UNKNOWN"
set(QPID_DISPATCH_VERSION "UNKNOWN")
endif(Git_FOUND)

else(NOT DEFINED VERSION)

# What if VERSION is defined but someone passed in an empty value for VERSION? Deal with that case here.
Expand All @@ -105,7 +105,7 @@ else(NOT DEFINED VERSION)
else()
set(QPID_DISPATCH_VERSION ${VERSION})
endif()
endif(VERSION STREQUAL "")
endif(VERSION STREQUAL "")
endif(NOT DEFINED VERSION)

message(STATUS "Setting skupper-router version to ${QPID_DISPATCH_VERSION}")
Expand Down
16 changes: 8 additions & 8 deletions README.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ From the `<build>` directory you can run all the system- and unit-tests with:
$ ctest -VV
----

The `ctest` tool uses the script `<build>/test/run.py` to set up the correct environment for tests.
The `ctest` tool uses the script `<build>/test/run.py` to set up the correct environment for tests.
You can use it to run tests individually from the `<build>/tests` directory.

.Example
Expand Down Expand Up @@ -185,8 +185,8 @@ And run the following command to generate grpc code:
python -m grpc_tools.protoc -I. --python_out=. --grpc_python_out=. ./friendship.proto
----

The system tests are implemented using Python's unittest library.
This library is used to run the tests by default.
The system tests are implemented using Python's unittest library.
This library is used to run the tests by default.
The tests can be also run using `xmlrunner` or `pytest`.
Pytest can generate a JUnit-compatible XML report containing an entry for each Python test method.
After running the tests, all XML reports can be found under `tests/junitxmls` in your build directory:
Expand All @@ -209,7 +209,7 @@ cmake .. -DQDROUTERD_RUNNER="gdb -quiet -iex 'set pagination off' -iex 'set debu

=== Test Suite Code Coverage (GNU tools only)

Use coverage analysis to ensure that all code paths are exercised by the test suite.
Use coverage analysis to ensure that all code paths are exercised by the test suite.
To run the tests and perform code coverage analysis:

. Install the lcov package
Expand Down Expand Up @@ -250,11 +250,11 @@ This script then does the following:
The CTest test suite can be configured to enable extra run time
validation checks against the skupper router.

Since run time validation slows down `skrouterd` considerably it is disabled by default.
Since run time validation slows down `skrouterd` considerably it is disabled by default.

It can be enabled by setting the `RUNTIME_CHECK` build flag via the `cmake` command.

NOTE: Depending on your environment the `ctest` suite may time out if validation is enabled due to the additional run time overhead it adds.
NOTE: Depending on your environment the `ctest` suite may time out if validation is enabled due to the additional run time overhead it adds.
You can extend the default test time via the `ctest --timeout`
option.

Expand All @@ -269,7 +269,7 @@ The Skupper Router test suite supports the following run time validation tools:
==== Valgrind Memcheck

Memcheck runs `skrouterd` under Valgrind's memcheck leak checker during the CTest suite.
This causes tests to fail if a memory error is encountered.
This causes tests to fail if a memory error is encountered.
Use the grinder tool (in the bin directory) to create a summary of the errors found during the test run.

The valgrind toolset must be installed in order to use memcheck.
Expand All @@ -281,7 +281,7 @@ To enable memcheck set the RUNTIME_CHECK build flag to "memcheck":
cmake .. -DRUNTIME_CHECK=memcheck
----

If valgrind detects errors, the `skrouterd` process exits with an exit code of `42` and a message is displayed in the CTest output.
If valgrind detects errors, the `skrouterd` process exits with an exit code of `42` and a message is displayed in the CTest output.
For example:

[source]
Expand Down
12 changes: 6 additions & 6 deletions bin/export.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,17 @@

# export.sh - Create a release archive.

# run this script like this -
# run this script like this -
# Before executing this script, change directory to the folder in which this file is located, for example.
# 1. cd /home/jdoe/skupper-router/bin
# Run the script like so -
# 2. ./export.sh <output_folder-full-path> <tag-name>
# (Example : ./export.sh /home/jdoe/ 1.5.1
# (/home/jdoe is the folder you want the tar.gz file to be put - specify the full path)
# Run the script like so -
# 2. ./export.sh <output_folder-full-path> <tag-name>
# (Example : ./export.sh /home/jdoe/ 1.5.1
# (/home/jdoe is the folder you want the tar.gz file to be put - specify the full path)
# 1.5.1 is the tag name
# A file named skupper-router-<tag-name>.tar.gz will be created at <output_folder-full-path>

# Simply running ./export.sh will put the tar.gz file in the current folder and use the very latest createed tag
# Simply running ./export.sh will put the tar.gz file in the current folder and use the very latest createed tag

set -e
trap "cleanup" 0 1 2 3 9 11 13 15
Expand Down
1 change: 0 additions & 1 deletion bin/find_ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,3 @@
# With no dir search under current directory.

find "$@" -name '*.log' | xargs gawk 'match($0, /Listening on .* ([0-9]+)/, m) { print m[1] } match($0, /Configured Listener: .*:([0-9]+)/, m) { print m[1] }'

1 change: 0 additions & 1 deletion bin/record-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,3 @@ lcov --remove dispatch-total-raw.info "/usr/include*" "/usr/share*" "${SRCPATH}/
# Generate report
rm -rf html
genhtml -p $SRCPATH -p $BLDPATH dispatch-total.info --title "Dispatch Router Test Coverage" --demangle-cpp -o html

6 changes: 3 additions & 3 deletions docs/man/skmanage.8.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ SYNOPSIS

DESCRIPTION
-----------
An AMQP management client for use with the skupper-router daemon
('skrouterd'). Sends AMQP management operations requests and prints
the response in JSON format. This is a generic AMQP management tool
An AMQP management client for use with the skupper-router daemon
('skrouterd'). Sends AMQP management operations requests and prints
the response in JSON format. This is a generic AMQP management tool
and can be used with any AMQP endpoint that follows the AMQP Management
specification, not just with 'skrouterd'.

Expand Down
1 change: 0 additions & 1 deletion docs/notes/router-annotations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -131,4 +131,3 @@ Interior routers will include the full set of router annotations -
including the ingress-router and trace list fields - on messages sent
to an edge router. It is expected that the edge router can safely
ignore the ingress-router and trace field values in this case.

18 changes: 6 additions & 12 deletions docs/notes/shutdown.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ How does the router shut down when interrupted with ctrl-C ?
including itself as one of the worker threads.

... thread_run() +
is in a loop processing batches of events, calling
is in a loop processing batches of events, calling
handle() on each event.

.... handle() +
Expand All @@ -43,9 +43,9 @@ How does the router shut down when interrupted with ctrl-C ?
thread, and then returns 'false'.

... thread_run() receives false return from handle(), indicating
that the thread is no longer running. It drops out of the
running loop. If there is a connection, it calls
qd_conn_event_batch_complete() with last arg false, indicating that
that the thread is no longer running. It drops out of the
running loop. If there is a connection, it calls
qd_conn_event_batch_complete() with last arg false, indicating that
the connection has not closed. It then calls pn_proactor_done()
and returns, to be joined by qd_server_run().

Expand All @@ -61,8 +61,8 @@ How does the router shut down when interrupted with ctrl-C ?

. main_process() +
nulls out and dispatch pointer, and calls qd_dispatch_free().
It then flushes any remaining content in stdout, disables its
SIGINT handler, and sends SIGINT
It then flushes any remaining content in stdout, disables its
SIGINT handler, and sends SIGINT
to itself, terminating the qdrouterd process.

.. qd_dispatch_free() +
Expand Down Expand Up @@ -126,9 +126,3 @@ How does the router shut down when interrupted with ctrl-C ?

... qd_alloc_finalize() +
All allocated items should have been released by now, and there should be only a single thread running. No locking will be done. Clean up all items on the types list. Reclaim the items on the global free pool. Reclaim items on thread pools. Check stats to detect allocated items that have not been freed.






19 changes: 8 additions & 11 deletions etc/sasl2/skrouterd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@
#---------------------------------
#
# This default mech list allows for PLAIN, but that
# mechanism sends credentials in the clear, and is normally
# mechanism sends credentials in the clear, and is normally
# only used along with SSL transport-layer security.
#
# This default also permits DIGEST-MD5, but you must have
# a user and password defined in your sasldb file to use
# this mechanism. ( See notes below. )
#
# PLEASE NOTE
# PLEASE NOTE
# For production messaging systems, a high-security mechanism such as
# DIGEST-MD5 or PLAIN+SSL should be used.
#
Expand All @@ -50,23 +50,23 @@ mech_list: ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN
# configuration attribute.
#
# If your nonstandard sasl directory is $MY_SASL_DIR, put a copy
# of this file at $MY_SASL_DIR/skrouterd.conf, alter the mech list as
# appropriate for your installation, and then use the saslpasswd2
# of this file at $MY_SASL_DIR/skrouterd.conf, alter the mech list as
# appropriate for your installation, and then use the saslpasswd2
# command to add new user+passwd pairs:
# echo $PASSWD | saslpasswd2 -c -p -f $MY_SASL_DIR/skrouterd.sasldb -u QPID $USERNAME
#
#
# 2. The standard location for the skrouterd sasldb file is
#
# 2. The standard location for the skrouterd sasldb file is
# /var/lib/skrouterd/skrouterd.sasldb
#
# 3. You can see what usernames have been stored in the sasldb, with the
# command "sasldblistusers2 -f /var/lib/skrouterd/skrouterd.sasldb"
#
# 4. The sasldb file must be readable by the user running the skrouterd
# daemon, ( the user name is skrouterd ) and should be readable only
# daemon, ( the user name is skrouterd ) and should be readable only
# by that user.
#
# 5. The EXTERNAL mechanism allows you to use SSL transport layer
# 5. The EXTERNAL mechanism allows you to use SSL transport layer
# security. In that case, you can also set the broker option
# --ssl-require-client-authentication .

Expand All @@ -75,6 +75,3 @@ mech_list: ANONYMOUS DIGEST-MD5 EXTERNAL PLAIN
# The following line stops spurious 'sql_select option missing' errors when
# cyrus-sql-sasl plugin is installed
sql_select: dummy select



2 changes: 0 additions & 2 deletions etc/skrouterd.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,3 @@ address {
prefix: broadcast
distribution: multicast
}


4 changes: 2 additions & 2 deletions include/qpid/dispatch/atomic.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
5 changes: 2 additions & 3 deletions include/qpid/dispatch/bitmask.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -58,4 +58,3 @@ void _qdbm_next(qd_bitmask_t *b, int *v);
///@}

#endif

4 changes: 2 additions & 2 deletions include/qpid/dispatch/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
8 changes: 3 additions & 5 deletions include/qpid/dispatch/compose.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand All @@ -25,10 +25,9 @@
/** A linked list of buffers composing a sequence of AMQP data objects. */
typedef struct qd_composed_field_t qd_composed_field_t;


/**@file
* Composing AMQP data trees.
*
*
* @defgroup compose compose
*
* Compose a tree-structure representing an AMQP datatype that can
Expand Down Expand Up @@ -263,4 +262,3 @@ void qd_compose_insert_double(qd_composed_field_t *field, double value);
///@}

#endif

4 changes: 2 additions & 2 deletions include/qpid/dispatch/container.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
4 changes: 2 additions & 2 deletions include/qpid/dispatch/ctools.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down
5 changes: 2 additions & 3 deletions include/qpid/dispatch/delivery_state.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
Expand Down Expand Up @@ -74,4 +74,3 @@ static inline bool qd_delivery_state_is_terminal(uint64_t type)
}

#endif

Loading