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

Refactor tests to use an event style and fix some found bugs #70

Merged
merged 188 commits into from
Sep 16, 2023
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
188 commits
Select commit Hold shift + click to select a range
ce05976
Refactor tests to use an event style
TrentHouliston Jul 21, 2023
c72cafe
Refactor some more tests
TrentHouliston Jul 21, 2023
b602864
Refactor trigger
TrentHouliston Jul 21, 2023
cdbb213
Refactor last
TrentHouliston Jul 21, 2023
0d091fd
More refactored tests
TrentHouliston Jul 21, 2023
05c8192
Missing header for strlen
TrentHouliston Jul 21, 2023
584d88b
clang-tidy
TrentHouliston Jul 21, 2023
bdfc9b0
IO test
TrentHouliston Jul 26, 2023
3c07855
Reaction handle
TrentHouliston Jul 26, 2023
cd1fa6f
Optional test
TrentHouliston Jul 26, 2023
ce46a53
Replace single test with more robust buffer test
TrentHouliston Jul 27, 2023
441103b
clang-tidy
TrentHouliston Jul 27, 2023
7f310fd
Fix IO test as read/write could be out of order
TrentHouliston Jul 27, 2023
2967a18
Sync order test is pretty good already
TrentHouliston Jul 27, 2023
a24577f
Priority test
TrentHouliston Aug 3, 2023
3acb343
Shutdown test
TrentHouliston Aug 3, 2023
fdcbd0b
Raw function test
TrentHouliston Aug 3, 2023
11463a6
Combine and improve the every test
TrentHouliston Aug 3, 2023
d9580da
Swap argument fission test to do an implicit conversion
TrentHouliston Aug 3, 2023
a59b120
Fix the bug with dynamic every
TrentHouliston Aug 3, 2023
65cafe4
Fix shadow
TrentHouliston Aug 3, 2023
2ebb063
Sync test
TrentHouliston Aug 3, 2023
deff1ef
Watchdog test
TrentHouliston Aug 3, 2023
919e41d
remove weird comment
TrentHouliston Aug 3, 2023
46cd107
Floor is safer than round
TrentHouliston Aug 3, 2023
0cd84de
Update custom clock test
TrentHouliston Aug 3, 2023
62cb8f0
Finished time is closer to the correct time
TrentHouliston Aug 3, 2023
fc3664f
Split off the DSL ordering test and add a proper With test
TrentHouliston Aug 3, 2023
e2be993
Fix some tests
TrentHouliston Aug 3, 2023
f05015b
Make watchdog behave like every with a stable tick rate
TrentHouliston Aug 3, 2023
43ac810
Improve transients test
TrentHouliston Aug 3, 2023
715b5c7
Reaction statistics test
TrentHouliston Aug 3, 2023
4670b60
revamp the TCP test
TrentHouliston Aug 4, 2023
5bd1006
error
TrentHouliston Aug 4, 2023
10b4f22
Make ReactionStatistics test more repeatable
TrentHouliston Aug 4, 2023
286a258
Include fnctl
TrentHouliston Aug 4, 2023
f35f6d6
ok
TrentHouliston Aug 4, 2023
d9cd03a
Windows error
TrentHouliston Aug 4, 2023
abcdcfb
clang-tidy
TrentHouliston Aug 4, 2023
0943208
/shrug
TrentHouliston Aug 4, 2023
a435df9
Make test end at the end
TrentHouliston Aug 4, 2023
07af03f
Fix
TrentHouliston Aug 4, 2023
1b58247
clang-tidy
TrentHouliston Aug 4, 2023
f513224
clang-tidy
TrentHouliston Aug 4, 2023
929d4a1
clang-tidy
TrentHouliston Aug 4, 2023
a5ea925
.
TrentHouliston Aug 4, 2023
f49212d
.
TrentHouliston Aug 4, 2023
2b5c7e6
windows
TrentHouliston Aug 4, 2023
ffbf130
Windows!!! "shakes fist"
TrentHouliston Aug 5, 2023
7473fd0
windows wants to be difficult
TrentHouliston Aug 5, 2023
41c91b5
more windows nonsense
TrentHouliston Aug 7, 2023
dcb3044
clang tidy rules
TrentHouliston Aug 7, 2023
59fb065
clang-tidy
TrentHouliston Aug 7, 2023
44b35ca
Refactor and update the IO/TCP to make it's behaviour more consistent…
TrentHouliston Aug 9, 2023
9173fd0
OSX closes differently
TrentHouliston Aug 9, 2023
f0a12f4
fix warnings clang-tidy etc
TrentHouliston Aug 9, 2023
1e5c5e9
Test margin of 1ms
TrentHouliston Aug 9, 2023
2a5fbf3
clang-tidy
TrentHouliston Aug 9, 2023
5f8daa9
windows platform changes
TrentHouliston Aug 9, 2023
414034f
clang-tidy
TrentHouliston Aug 9, 2023
c0e9081
Fix the reactor name for windows
TrentHouliston Aug 9, 2023
96e2000
Fix log level
TrentHouliston Aug 9, 2023
54a4e7b
/shrug
TrentHouliston Aug 9, 2023
c6c57bc
Didn't mean to swap both
TrentHouliston Aug 9, 2023
7c217c8
How could this possibly have made windows fail to run reaction statis…
TrentHouliston Aug 9, 2023
df816d7
How does this make reaction stats not run on windows?
TrentHouliston Aug 9, 2023
7b26974
Move the demangling normalisation into demangle
TrentHouliston Aug 10, 2023
dca757d
.
TrentHouliston Aug 10, 2023
fff3a4b
.
TrentHouliston Aug 10, 2023
cd9a11f
Demangle
TrentHouliston Aug 10, 2023
ac1b471
Review comments
TrentHouliston Aug 10, 2023
41ce4f4
more review comments
TrentHouliston Aug 10, 2023
6831bf1
Build already!
TrentHouliston Aug 10, 2023
edeefa3
Test a potential refactor for chrono controller to improve windows ac…
TrentHouliston Aug 10, 2023
2df9f82
.
TrentHouliston Aug 10, 2023
4daf418
.
TrentHouliston Aug 10, 2023
92781e4
.
TrentHouliston Aug 10, 2023
5da9e10
I don't even need those!
TrentHouliston Aug 10, 2023
e741d47
.
TrentHouliston Aug 10, 2023
4fed00d
.
TrentHouliston Aug 10, 2023
37a7a4b
.
TrentHouliston Aug 10, 2023
59ce1f1
See if this makes windows pass the tests
TrentHouliston Aug 10, 2023
5440261
Try a few loops to get better wait accuracy
TrentHouliston Aug 10, 2023
9752334
Remove connection accepted from TCP as it's implied by having a conne…
TrentHouliston Aug 10, 2023
c0f7484
clang-tidy
TrentHouliston Aug 10, 2023
e2a5349
Continuously update the error
TrentHouliston Aug 11, 2023
251ddd6
Merge branch 'main' into houliston/testrefactor
TrentHouliston Aug 11, 2023
19a61dd
.
TrentHouliston Aug 11, 2023
6abd417
Attempt to update the windows iocontroller to be similar to posix
TrentHouliston Aug 11, 2023
9d3149e
.
TrentHouliston Aug 11, 2023
401c13f
.
TrentHouliston Aug 11, 2023
31bda94
.
TrentHouliston Aug 11, 2023
f7f0d1f
.
TrentHouliston Aug 11, 2023
3613ffd
.
TrentHouliston Aug 11, 2023
7d38150
.
TrentHouliston Aug 11, 2023
6793e0c
.
TrentHouliston Aug 11, 2023
6ff441f
Try the same bytes trick on windows
TrentHouliston Aug 11, 2023
fb9c844
Windows loves being different
TrentHouliston Aug 11, 2023
907d5d7
Doubt this makes a difference
TrentHouliston Aug 11, 2023
9cd6016
Make it clearer that it's a bitwise or
TrentHouliston Aug 11, 2023
38144fc
Try disabling the eof detector again?
TrentHouliston Aug 11, 2023
d6efc49
.
TrentHouliston Aug 11, 2023
f4351c7
Add timeouts to UDP
TrentHouliston Aug 11, 2023
6cd5a3e
Update min cmake version
TrentHouliston Aug 11, 2023
0261a49
This works fine locally
TrentHouliston Aug 11, 2023
3c46aa9
clang-tidy
TrentHouliston Aug 11, 2023
db1075d
Add timeouts to emit tests (need to refactor these)
TrentHouliston Aug 11, 2023
8dad0a4
Update the delay test
TrentHouliston Aug 14, 2023
636b86a
Update emit fusion test
TrentHouliston Aug 14, 2023
a0c9517
Refactor the task scheduler to take generic tasks and use it to updat…
TrentHouliston Aug 15, 2023
d772d5d
Try fix older gcc/clang
TrentHouliston Aug 15, 2023
24baaed
clang-tidy
TrentHouliston Aug 15, 2023
e89e351
Fix shadowing
TrentHouliston Aug 15, 2023
3027a7a
Merge branch 'main' into houliston/testrefactor
TrentHouliston Aug 15, 2023
800dd85
Merge branch 'main' into houliston/testrefactor
TrentHouliston Aug 16, 2023
990d4d4
Merge branch 'main' into houliston/testrefactor
TrentHouliston Aug 16, 2023
49bc5b8
Clang-tidy
TrentHouliston Aug 17, 2023
0f0b033
Move socket size onto sock_t as a member
TrentHouliston Aug 18, 2023
cf408cc
Add a resolve utility
TrentHouliston Aug 18, 2023
d620443
Lots of refactoring and combining tests
TrentHouliston Aug 22, 2023
f237931
add unit tests for resolve
TrentHouliston Aug 22, 2023
a725768
Remove couts
TrentHouliston Aug 22, 2023
3cccf8f
Add expected output
TrentHouliston Aug 22, 2023
6058466
.
TrentHouliston Aug 22, 2023
77009b2
Fix filtering and make UDP tests pass
TrentHouliston Aug 24, 2023
c1ba0c0
Update NUClearNet based on changes to UDP
TrentHouliston Aug 24, 2023
b0170d5
fixes from osx
TrentHouliston Aug 24, 2023
238409e
clang-tidy
TrentHouliston Aug 24, 2023
ce31581
clang-tidy
TrentHouliston Aug 24, 2023
967c202
Bind IPv6 tests to any rather than localhost
TrentHouliston Aug 24, 2023
aa9260f
Fix IPv6 problems on osx
TrentHouliston Aug 31, 2023
6389d8b
Remove unused code
TrentHouliston Aug 31, 2023
2f11c3f
No need for memset when doing {} initialisation
TrentHouliston Aug 31, 2023
27afc80
clang-tidy
TrentHouliston Aug 31, 2023
7b7c99f
Try to fix windows build
TrentHouliston Aug 31, 2023
41cc1a8
clang-tidy
TrentHouliston Sep 1, 2023
236522d
clang-tidy
TrentHouliston Sep 4, 2023
36e9567
Test for ipv6 to see if the runners have it
TrentHouliston Sep 4, 2023
c48e91a
add a test utility to check if any interface has ipv6
TrentHouliston Sep 4, 2023
77c184e
use locally built nuclear in tests
TrentHouliston Sep 4, 2023
547a664
Make the TCP test only do IPv6 tests if there is IPv6
TrentHouliston Sep 4, 2023
d2c425a
Allow the UDP test to dynamically test for IPv6 if available
TrentHouliston Sep 4, 2023
5b5185b
Print out on success
TrentHouliston Sep 4, 2023
fc6262f
clang-tidy
TrentHouliston Sep 4, 2023
4a02617
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 4, 2023
7964c4e
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 5, 2023
c38ea4b
Merge remote-tracking branch 'origin/main' into houliston/testrefactor
TrentHouliston Sep 5, 2023
c717de9
Fix return before close
TrentHouliston Sep 5, 2023
5674920
Some cmake fixes
TrentHouliston Sep 5, 2023
6adbd4d
Make the sync order test check the sequence
TrentHouliston Sep 5, 2023
deb553b
Add numeric header
TrentHouliston Sep 5, 2023
aa6060b
Just add a check on timeout so the rest of the checks print still
TrentHouliston Sep 5, 2023
e2cd44e
Move WSA to a static holder so I don't have to think about it
TrentHouliston Sep 5, 2023
64de873
Make TCP timeout on error
TrentHouliston Sep 5, 2023
b550ac5
.
TrentHouliston Sep 5, 2023
580c8f3
Shutdown before catch does stuff
TrentHouliston Sep 5, 2023
5b3d043
...
TrentHouliston Sep 5, 2023
69d55ed
.
TrentHouliston Sep 5, 2023
22a3640
Fix instance
TrentHouliston Sep 5, 2023
19f41f8
Windows can't do leading 0s and it's not that important
TrentHouliston Sep 6, 2023
0811e5f
Refactor the iocontroller to make it handle event timing better
TrentHouliston Sep 6, 2023
4a78e2b
Fix closes on linux
TrentHouliston Sep 8, 2023
7e9d1c9
clang-tidy
TrentHouliston Sep 8, 2023
4511323
Make the IO read read as much as it can
TrentHouliston Sep 8, 2023
49a21cc
More time for tests
TrentHouliston Sep 8, 2023
6e43eee
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 10, 2023
a1e3276
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 10, 2023
9124ec8
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 15, 2023
7a62355
Make the IO nonblocking to avoid hanging
TrentHouliston Sep 15, 2023
b9a5131
clang-tidy
TrentHouliston Sep 15, 2023
d0155be
lint rule no longer violated
TrentHouliston Sep 15, 2023
13b4602
Add a test for demangle
TrentHouliston Sep 15, 2023
acaf2f9
Add license string
TrentHouliston Sep 15, 2023
824a7d0
Remove unused code
TrentHouliston Sep 15, 2023
33ab54c
Add exceptions when sending fails
TrentHouliston Sep 15, 2023
245287d
Windows returns "??" sometimes for demangle
TrentHouliston Sep 15, 2023
9fa1ada
Always return the if number even if it's not multicast
TrentHouliston Sep 15, 2023
733b02d
Formatting
TrentHouliston Sep 15, 2023
526e660
Change UDP test so it works on linux
TrentHouliston Sep 15, 2023
e66f493
Just short circuit for empty strings
TrentHouliston Sep 15, 2023
08d522a
Remove -s it's too hard to read
TrentHouliston Sep 15, 2023
8a5200f
Windows hates resolving ipv6 sometimes
TrentHouliston Sep 15, 2023
8fa71c4
Who let this obvious bug through!
TrentHouliston Sep 15, 2023
fdf098c
Increase timeouts (CI is slow) and add log line for when echos time out
TrentHouliston Sep 15, 2023
93f2a1c
.
TrentHouliston Sep 15, 2023
73cfd62
.
TrentHouliston Sep 15, 2023
aeb5ad9
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 16, 2023
c3702ea
Merge branch 'main' into houliston/testrefactor
TrentHouliston Sep 16, 2023
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
35 changes: 10 additions & 25 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@ jobs:

strategy:
matrix:
container: ['gcc:5', 'gcc:7', 'gcc:9', 'gcc:10', 'gcc:11', 'gcc:12', 'gcc:13']
container:
["gcc:5", "gcc:7", "gcc:9", "gcc:10", "gcc:11", "gcc:12", "gcc:13"]

# The type of runner that the job will run on
runs-on: ubuntu-latest
Expand All @@ -33,9 +34,7 @@ jobs:
# Use the container for this specific version of gcc
container: ${{ matrix.container }}

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3

Expand All @@ -57,7 +56,7 @@ jobs:
run: cmake --build build --config Release --parallel 2

- name: Test
timeout-minutes: 5
timeout-minutes: 10
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
Expand All @@ -66,13 +65,9 @@ jobs:

build-osx:
name: MacOS Clang

# The type of runner that the job will run on
runs-on: macos-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3

Expand All @@ -87,7 +82,7 @@ jobs:
run: cmake --build build --config Release --parallel 2

- name: Test
timeout-minutes: 5
timeout-minutes: 10
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
Expand All @@ -100,9 +95,7 @@ jobs:
# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3

Expand All @@ -117,7 +110,7 @@ jobs:
run: cmake --build build --config Release --parallel 2

- name: Test
timeout-minutes: 5
timeout-minutes: 10
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: |
Expand All @@ -127,21 +120,17 @@ jobs:

check-clang-tidy-linux:
name: Clang-Tidy Linux

# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Install clang-tidy-15
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee /etc/apt/sources.list.d/llvm-15
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list.d/llvm-15
sudo apt-get update
sudo apt-get install -y clang-tidy-15
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee /etc/apt/sources.list.d/llvm-15
echo "deb http://apt.llvm.org/jammy/ llvm-toolchain-jammy-15 main" | sudo tee -a /etc/apt/sources.list.d/llvm-15
sudo apt-get update
sudo apt-get install -y clang-tidy-15

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3

Expand All @@ -164,13 +153,9 @@ jobs:

check-clang-tidy-msvc:
name: Clang-Tidy MSVC

# The type of runner that the job will run on
runs-on: windows-latest

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Code
uses: actions/checkout@v3

Expand Down
21 changes: 13 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,15 @@
# WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
# OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

cmake_minimum_required(VERSION 3.15.0)

# Set the project after the build type as the Project command can change the build type
project(
NUClear
VERSION 1.0.0
LANGUAGES C CXX
)

# We use additional modules that cmake needs to know about
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

Expand All @@ -35,13 +41,6 @@ if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif()

# Set the project after the build type as the Project command can change the build type
project(
NUClear
VERSION 1.0.0
LANGUAGES C CXX
)

# NUClear targets c++14
set(CMAKE_CXX_STANDARD 14)

Expand All @@ -51,6 +50,12 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MASTER_PROJECT ON)
endif()

if(MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -pedantic)
endif(MSVC)

# If this option is set we are building using continous integration
option(CI_BUILD "Enable build options for building in the CI server" OFF)

Expand Down
5 changes: 2 additions & 3 deletions src/dsl/word/TCP.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,8 @@ namespace dsl {
in_port_t port = 0,
const std::string& bind_address = "") {

// Make our socket
util::FileDescriptor fd(::socket(AF_INET, SOCK_STREAM, IPPROTO_TCP),
[](fd_t fd) { ::shutdown(fd, SHUT_RDWR); });
// Resolve the bind address if we have one
util::network::sock_t address{};

if (!bind_address.empty()) {
address = util::network::resolve(bind_address, port);
Expand Down
Loading
Loading