Skip to content

Commit

Permalink
Merge branch 'master' into DaAwesomeP-debian-systemd-and-config-dir
Browse files Browse the repository at this point in the history
  • Loading branch information
DaAwesomeP committed Apr 9, 2024
2 parents e83dca1 + f87e79d commit 8aacbd4
Show file tree
Hide file tree
Showing 132 changed files with 5,457 additions and 211 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,14 @@ jobs:
if: always()
run: sha256sum ola-*.tar.gz
- name: Upload source tree artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always()
with:
name: ola-${{ matrix.id }}-source-tree
path: ola-${{ matrix.id }}-source-tree.tar.gz
- name: Upload built artifact
if: matrix.task == 'distcheck' || matrix.task == 'dist'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ola-${{ matrix.id }}-dist
path: |
Expand All @@ -149,7 +149,7 @@ jobs:
flag-name: ${{ matrix.id }}
- name: Upload coverage artifacts
if: always() && matrix.task == 'coverage'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: ola-${{ matrix.id }}-coverage
path: coverage/
Expand All @@ -167,7 +167,7 @@ jobs:
- id: "distcheck-debian-stable-amd64-clang"
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-${{ matrix.id }}-source-tree
path: .
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
shell: bash
run: find . -type f -exec sha256sum {} \;
working-directory: built
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always()
with:
name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }}
Expand Down Expand Up @@ -112,7 +112,7 @@ jobs:
echo "Debian Build Version: $OLA_DEBIAN_BUILD_VERSION"
id: generate-build-name
- name: Download build artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-built-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }}
path: built
Expand All @@ -125,7 +125,7 @@ jobs:
run: apt-get -y install autopkgtest
- name: Test
run: autopkgtest --output-dir=test-output built/*ges -- null
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: always() # Always upload the test output, even on failed tests
with:
name: ola-test-output-debian-${{ matrix.image_tag }}-${{ steps.generate-build-name.outputs.OLA_DEBIAN_BUILD_VERSION }}_${{ matrix.architecture }}
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/lint.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
tar --exclude=ola-debian-stable-built-source-tree.tar.gz -cvzf ola-debian-stable-built-source-tree.tar.gz .
- name: SHA256 artifact archive
run: sha256sum ola-debian-stable-built-source-tree.tar.gz
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: ola-debian-stable-built-source-tree.tar.gz
Expand All @@ -67,7 +67,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand Down Expand Up @@ -97,7 +97,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand All @@ -123,7 +123,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand Down Expand Up @@ -160,7 +160,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand Down Expand Up @@ -197,7 +197,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand Down Expand Up @@ -226,7 +226,7 @@ jobs:
needs: build
steps:
- name: Download built source tree archive
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-debian-stable-built-source-tree
path: .
Expand Down Expand Up @@ -262,7 +262,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Setup Node.js v18
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 18 # LTS
cache: 'npm'
Expand Down
8 changes: 5 additions & 3 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -272,8 +272,10 @@ COVERAGE_OUTPUTS = --txt coverage/coverage.txt \
--cobertura coverage/coverage.cobertura.xml \
--html-details coverage/details.html/coverage.details.html \
--coveralls coverage/coverage.coveralls.json
COVERAGE_GCOV_EXE=--gcov-executable /usr/bin/gcov
COVERAGE_FILTERS=-e '.*Test\.cpp$$' \
# See https://gcovr.com/en/stable/guide/gcov_parser.html#negative-hit-counts
COVERAGE_FLAGS = --gcov-ignore-parse-errors=negative_hits.warn_once_per_file
COVERAGE_GCOV_EXE = --gcov-executable /usr/bin/gcov
COVERAGE_FILTERS = -e '.*Test\.cpp$$' \
-e '.*\.pb\.cc$$' \
-e '.*\.pb\.cpp$$' \
-e '.*\.pb\.h$$' \
Expand All @@ -288,7 +290,7 @@ if !BUILD_GCOV
else
if FOUND_GCOVR
mkdir -p coverage/details.html/
gcovr --print-summary $(COVERAGE_OUTPUTS) $(COVERAGE_GCOV_EXE) --root . $(COVERAGE_FILTERS)
gcovr $(COVERAGE_FLAGS) --print-summary $(COVERAGE_OUTPUTS) $(COVERAGE_GCOV_EXE) --root . $(COVERAGE_FILTERS)
else
$(error gcovr not found. Install gcovr (e.g. via pip for the latest version) and re-run configure.)
endif
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
x/y/2023 ola-0.10.10
x/y/2024 ola-0.10.10
Features:
*

Expand Down
8 changes: 8 additions & 0 deletions common/messaging/DescriptorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ using ola::messaging::BoolFieldDescriptor;
using ola::messaging::FieldDescriptor;
using ola::messaging::FieldDescriptorGroup;
using ola::messaging::IPV4FieldDescriptor;
using ola::messaging::IPV6FieldDescriptor;
using ola::messaging::MACFieldDescriptor;
using ola::messaging::StringFieldDescriptor;
using ola::messaging::UIDFieldDescriptor;
Expand Down Expand Up @@ -77,6 +78,13 @@ void DescriptorTest::testFieldDescriptors() {
OLA_ASSERT_TRUE(ipv4_descriptor.LimitedSize());
OLA_ASSERT_EQ(4u, ipv4_descriptor.MaxSize());

// IPv6 address
IPV6FieldDescriptor ipv6_descriptor("ipv6");
OLA_ASSERT_EQ(string("ipv6"), ipv6_descriptor.Name());
OLA_ASSERT_TRUE(ipv6_descriptor.FixedSize());
OLA_ASSERT_TRUE(ipv6_descriptor.LimitedSize());
OLA_ASSERT_EQ(16u, ipv6_descriptor.MaxSize());

// MAC address
MACFieldDescriptor mac_descriptor("mac");
OLA_ASSERT_EQ(string("mac"), mac_descriptor.Name());
Expand Down
44 changes: 26 additions & 18 deletions common/messaging/MessagePrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,37 +45,44 @@ string MessagePrinter::AsString(const Message *message) {


void GenericMessagePrinter::Visit(const BoolMessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << ": "
<< (message->Value() ? "true" : "false") << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< (message->Value() ? "true" : "false") << endl;
}


void GenericMessagePrinter::Visit(const IPV4MessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value() << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value() << endl;
}


void GenericMessagePrinter::Visit(const IPV6MessageField *message) {
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value() << endl;
}


void GenericMessagePrinter::Visit(const MACMessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value().ToString() << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value().ToString() << endl;
}


void GenericMessagePrinter::Visit(const UIDMessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value().ToString() << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< message->Value().ToString() << endl;
}


void GenericMessagePrinter::Visit(const StringMessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << ": "
<< EncodeString(message->Value()) << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << ": "
<< EncodeString(message->Value()) << endl;
}


Expand Down Expand Up @@ -134,8 +141,8 @@ void GenericMessagePrinter::Visit(const BasicMessageField<int32_t> *message) {


void GenericMessagePrinter::Visit(const GroupMessageField *message) {
Stream() << string(m_indent, ' ') <<
TransformLabel(message->GetDescriptor()->Name()) << " {" << endl;
Stream() << string(m_indent, ' ')
<< TransformLabel(message->GetDescriptor()->Name()) << " {" << endl;
m_indent += m_indent_size;
}

Expand Down Expand Up @@ -178,8 +185,9 @@ void GenericMessagePrinter::AppendInt(const string &name,


void GenericMessagePrinter::AppendMultiplier(int8_t multiplier) {
if (multiplier)
if (multiplier) {
Stream() << " x 10 ^ " << static_cast<int>(multiplier);
}
}
} // namespace messaging
} // namespace ola
23 changes: 15 additions & 8 deletions common/messaging/MessagePrinterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,9 @@

using std::string;
using std::vector;
using ola::rdm::UID;
using ola::network::IPV6Address;
using ola::network::MACAddress;
using ola::rdm::UID;


using ola::messaging::BoolFieldDescriptor;
Expand All @@ -42,14 +43,16 @@ using ola::messaging::FieldDescriptor;
using ola::messaging::FieldDescriptorGroup;
using ola::messaging::GenericMessagePrinter;
using ola::messaging::GroupMessageField;
using ola::messaging::Int16FieldDescriptor;
using ola::messaging::Int16MessageField;
using ola::messaging::Int8FieldDescriptor;
using ola::messaging::Int8MessageField;
using ola::messaging::IPV4FieldDescriptor;
using ola::messaging::IPV4MessageField;
using ola::messaging::IPV6FieldDescriptor;
using ola::messaging::IPV6MessageField;
using ola::messaging::MACFieldDescriptor;
using ola::messaging::MACMessageField;
using ola::messaging::Int16FieldDescriptor;
using ola::messaging::Int16MessageField;
using ola::messaging::Int8FieldDescriptor;
using ola::messaging::Int8MessageField;
using ola::messaging::Message;
using ola::messaging::MessageFieldInterface;
using ola::messaging::StringFieldDescriptor;
Expand Down Expand Up @@ -90,6 +93,7 @@ void GenericMessagePrinterTest::testSimplePrinter() {
// setup some fields
BoolFieldDescriptor bool_descriptor("On/Off");
IPV4FieldDescriptor ipv4_descriptor("ip");
IPV6FieldDescriptor ipv6_descriptor("ipv6");
MACFieldDescriptor mac_descriptor("mac");
UIDFieldDescriptor uid_descriptor("uid");
StringFieldDescriptor string_descriptor("Name", 0, 32);
Expand All @@ -104,6 +108,9 @@ void GenericMessagePrinterTest::testSimplePrinter() {
fields.push_back(
new IPV4MessageField(&ipv4_descriptor,
ola::network::HostToNetwork(0x0a000001)));
fields.push_back(
new IPV6MessageField(&ipv6_descriptor,
IPV6Address::FromStringOrDie("::ffff:192.168.0.1")));
fields.push_back(
new MACMessageField(&mac_descriptor,
MACAddress::FromStringOrDie("01:23:45:67:89:ab")));
Expand All @@ -116,9 +123,9 @@ void GenericMessagePrinterTest::testSimplePrinter() {

Message message(fields);
string expected = (
"On/Off: false\nip: 10.0.0.1\nmac: 01:23:45:67:89:ab\n"
"uid: 7a70:00000001\nName: foobar\nId: 42\nCount: 4 x 10 ^ -3\n"
"Delta: 10 x 10 ^ 1\nRate: 10 x 10 ^ -1\n");
"On/Off: false\nip: 10.0.0.1\nipv6: ::ffff:192.168.0.1\n"
"mac: 01:23:45:67:89:ab\nuid: 7a70:00000001\nName: foobar\nId: 42\n"
"Count: 4 x 10 ^ -3\nDelta: 10 x 10 ^ 1\nRate: 10 x 10 ^ -1\n");
OLA_ASSERT_EQ(expected, m_printer.AsString(&message));
}

Expand Down
6 changes: 6 additions & 0 deletions common/messaging/SchemaPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,12 @@ void SchemaPrinter::Visit(const IPV4FieldDescriptor *descriptor) {
}


void SchemaPrinter::Visit(const IPV6FieldDescriptor *descriptor) {
m_str << string(m_indent, ' ') << descriptor->Name() << ": IPv6 address"
<< endl;
}


void SchemaPrinter::Visit(const MACFieldDescriptor *descriptor) {
m_str << string(m_indent, ' ') << descriptor->Name() << ": MAC" << endl;
}
Expand Down
7 changes: 6 additions & 1 deletion common/messaging/SchemaPrinterTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ using std::vector;

using ola::messaging::BoolFieldDescriptor;
using ola::messaging::IPV4FieldDescriptor;
using ola::messaging::IPV6FieldDescriptor;
using ola::messaging::MACFieldDescriptor;
using ola::messaging::Descriptor;
using ola::messaging::FieldDescriptor;
Expand Down Expand Up @@ -85,6 +86,8 @@ void SchemaPrinterTest::testPrinter() {
"Count", false, 10);
IPV4FieldDescriptor *ipv4_descriptor = new IPV4FieldDescriptor(
"Address");
IPV6FieldDescriptor *ipv6_descriptor = new IPV6FieldDescriptor(
"v6 Address");
MACFieldDescriptor *mac_descriptor = new MACFieldDescriptor(
"MAC Address");
UIDFieldDescriptor *uid_descriptor = new UIDFieldDescriptor("Device");
Expand All @@ -95,6 +98,7 @@ void SchemaPrinterTest::testPrinter() {
fields.push_back(string_descriptor);
fields.push_back(uint8_descriptor);
fields.push_back(ipv4_descriptor);
fields.push_back(ipv6_descriptor);
fields.push_back(mac_descriptor);
fields.push_back(uid_descriptor);

Expand All @@ -104,7 +108,8 @@ void SchemaPrinterTest::testPrinter() {

string expected = (
"On/Off: bool\nName: string [0, 32]\nCount: uint8\n"
"Address: IPv4 address\nMAC Address: MAC\nDevice: UID\n");
"Address: IPv4 address\nv6 Address: IPv6 address\nMAC Address: MAC\n"
"Device: UID\n");
OLA_ASSERT_EQ(expected, printer.AsString());
}

Expand Down
Loading

0 comments on commit 8aacbd4

Please sign in to comment.