Skip to content

Commit

Permalink
Merge branch 'master' into master-resync
Browse files Browse the repository at this point in the history
  • Loading branch information
peternewman authored Feb 28, 2024
2 parents 41f4725 + 522c5a9 commit 4cc59af
Show file tree
Hide file tree
Showing 36 changed files with 497 additions and 67 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,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 @@ -147,7 +147,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 @@ -165,7 +165,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 @@ -53,7 +53,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 }}-${{ matrix.architecture }}
Expand All @@ -72,7 +72,7 @@ jobs:
steps:
- uses: actions/checkout@master
- name: Download build artifact
uses: actions/download-artifact@v3
uses: actions/download-artifact@v4
with:
name: ola-built-debian-${{ matrix.image_tag }}-${{ matrix.architecture }}
path: built
Expand All @@ -85,7 +85,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 }}-${{ matrix.architecture }}
Expand Down
14 changes: 7 additions & 7 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
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
5 changes: 5 additions & 0 deletions common/rdm/DescriptorConsistencyChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ void DescriptorConsistencyChecker::Visit(
}


void DescriptorConsistencyChecker::Visit(
const ola::messaging::IPV6FieldDescriptor*) {
}


void DescriptorConsistencyChecker::Visit(
const ola::messaging::MACFieldDescriptor*) {
}
Expand Down
1 change: 1 addition & 0 deletions common/rdm/DescriptorConsistencyChecker.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ class DescriptorConsistencyChecker

void Visit(const ola::messaging::BoolFieldDescriptor*);
void Visit(const ola::messaging::IPV4FieldDescriptor*);
void Visit(const ola::messaging::IPV6FieldDescriptor*);
void Visit(const ola::messaging::MACFieldDescriptor*);
void Visit(const ola::messaging::UIDFieldDescriptor*);
void Visit(const ola::messaging::StringFieldDescriptor*);
Expand Down
12 changes: 12 additions & 0 deletions common/rdm/GroupSizeCalculator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,12 @@ void GroupSizeCalculator::Visit(
}


void GroupSizeCalculator::Visit(
const ola::messaging::IPV6FieldDescriptor *descriptor) {
m_non_groups.push_back(descriptor);
}


void GroupSizeCalculator::Visit(
const ola::messaging::MACFieldDescriptor *descriptor) {
m_non_groups.push_back(descriptor);
Expand Down Expand Up @@ -246,6 +252,12 @@ void StaticGroupTokenCalculator::Visit(
}


void StaticGroupTokenCalculator::Visit(
OLA_UNUSED const ola::messaging::IPV6FieldDescriptor *descriptor) {
m_token_count.top()++;
}


void StaticGroupTokenCalculator::Visit(
OLA_UNUSED const ola::messaging::MACFieldDescriptor *descriptor) {
m_token_count.top()++;
Expand Down
Loading

0 comments on commit 4cc59af

Please sign in to comment.