From e1ecc02185ee445b103087d38bb77e5cebd99340 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 10:53:50 -0700 Subject: [PATCH 01/11] feat: initial commit with workflows --- .github/CODEOWNERS | 1 + .github/workflows/build.yaml | 23 +++++++++++++++++++++++ .github/workflows/test.yaml | 26 ++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 .github/CODEOWNERS create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..9d51dae --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @nasa-jpl/nasa-jpl-ethercat-devs diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..63cc1de --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,23 @@ +name: build + +on: + workflow_dispatch: + push: + paths: + - "src/**" + - "test/**" + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: egor-tensin/setup-clang@v1 + with: + version: latest + platform: x64 + - run: | + mkdir -p build + cd build + cmake .. + make diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..c2c3c6f --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,26 @@ +name: test + +on: + workflow_dispatch: + push: + paths: + - "src/**" + - "test/**" + +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - uses: egor-tensin/setup-clang@v1 + - uses: ConorMacBride/install-package@v1 + with: + apt: valgrind + version: latest + platform: x64 + - run: | + mkdir -p build + cd build + cmake -DBUILD_JSD_TESTS=ON .. + make test + make memcheck From 50c434796cd3d8ec8e8bc40b9dde623e89829a64 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 11:10:47 -0700 Subject: [PATCH 02/11] fix: necessary install --- .github/workflows/build.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 63cc1de..ac35595 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -16,6 +16,8 @@ jobs: with: version: latest platform: x64 + - name: install yamlcpp + run: sudo apt install libyaml-cpp-dev - run: | mkdir -p build cd build From 614fdc2bc223f481c33632d80f306f89b55df392 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 11:15:42 -0700 Subject: [PATCH 03/11] fix: add yaml cpp install to test as well --- .github/workflows/test.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index c2c3c6f..f5ed047 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,6 +18,8 @@ jobs: apt: valgrind version: latest platform: x64 + - name: install yamlcpp + run: sudo apt install libyaml-cpp-dev - run: | mkdir -p build cd build From 3364ab5338af14e585df16354c21fedd023597d5 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 11:23:07 -0700 Subject: [PATCH 04/11] fix: install all dependencies --- .github/workflows/test.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index f5ed047..9b42a60 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -18,8 +18,8 @@ jobs: apt: valgrind version: latest platform: x64 - - name: install yamlcpp - run: sudo apt install libyaml-cpp-dev + - name: install packages + run: sudo apt install libyaml-cpp-dev libgtest-dev doxygen - run: | mkdir -p build cd build From 21a9baff6af5723e5086c7c8930e05c943f52cd7 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 13:06:23 -0700 Subject: [PATCH 05/11] fix: incorrect names in trapezoidal test --- test/test_unit/test_trap.cc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/test_unit/test_trap.cc b/test/test_unit/test_trap.cc index e4e5601..e996b81 100644 --- a/test/test_unit/test_trap.cc +++ b/test/test_unit/test_trap.cc @@ -9,7 +9,7 @@ class TrapTest : public ::testing::Test protected: void SetUp() override {} - trap_t trap_1_; + fastcat_trap_t trap_1_; }; TEST_F(TrapTest, TrapVelocityReInit) @@ -22,7 +22,7 @@ TEST_F(TrapTest, TrapVelocityReInit) double max_time = 10.0; // Generate the first version of the trap - trap_generate_vel(&trap_1_, time_initial, position_initial, velocity_initial, + fastcat_trap_generate_vel(&trap_1_, time_initial, position_initial, velocity_initial, velocity_final, acceleration, max_time); double dt = 0.01; @@ -33,14 +33,14 @@ TEST_F(TrapTest, TrapVelocityReInit) for (int i = 0; i < 1000; i++) { // Update trap before any change in time has occurred - trap_update_vel(&trap_1_, tracking_time, &tracking_position, + fastcat_trap_update_vel(&trap_1_, tracking_time, &tracking_position, &tracking_velocity); // Increment time tracking_time += dt; // Regenerate trap to simulate incoming updated setpoint - trap_generate_vel(&trap_1_, tracking_time, tracking_position, + fastcat_trap_generate_vel(&trap_1_, tracking_time, tracking_position, tracking_velocity, velocity_final, acceleration, max_time); } From d327602869356a4a526e535c85734cb5d7f52eb3 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 13:07:38 -0700 Subject: [PATCH 06/11] fix: need to make first --- .github/workflows/test.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 9b42a60..84ab1cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -24,5 +24,6 @@ jobs: mkdir -p build cd build cmake -DBUILD_JSD_TESTS=ON .. + make make test make memcheck From 8f058d7228982eaa32b1444ee41f095f1ce38b21 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 14:04:22 -0700 Subject: [PATCH 07/11] fix: small changes to ensure we pass github action --- test/test_unit/test_gold_actuator.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/test_unit/test_gold_actuator.cc b/test/test_unit/test_gold_actuator.cc index f1e4732..b952045 100644 --- a/test/test_unit/test_gold_actuator.cc +++ b/test/test_unit/test_gold_actuator.cc @@ -5,6 +5,7 @@ #include "fastcat/config.h" #include "fastcat/jsd/gold_actuator_offline.h" #include "fastcat/signal_handling.h" +#include "jsd/jsd_egd_types.h" #include "jsd/jsd_print.h" #include "jsd/jsd_pub.h" @@ -40,7 +41,8 @@ class ActuatorTest : public ::testing::Test void SetUp() override { jsd_context_ = jsd_alloc(); - + jsd_context_->ecx_context.slavelist[0].eep_id = JSD_EGD_PRODUCT_CODE; + // FASTCAT_UNIT_TEST_DIR contains path to . base_dir_ = FASTCAT_UNIT_TEST_DIR; base_dir_ += "test_gold_actuator_yamls/"; @@ -153,9 +155,10 @@ TEST_F(ActuatorTest, RejectMotionCommandsWhenFaulted) EXPECT_TRUE(device_.Write(cmd)); cmd.type = fastcat::ACTUATOR_SET_OUTPUT_POSITION_CMD; + cmd.actuator_set_digital_output_cmd.digital_output_index = 1; // Avoid 0-index'ing assert error EXPECT_TRUE(device_.Write(cmd)); - cmd.type = fastcat::ACTUATOR_SET_DIGITAL_OUTPUT_CMD; + EXPECT_TRUE(device_.Write(cmd)); cmd.type = fastcat::ACTUATOR_SET_MAX_CURRENT_CMD; From 752c07bf2b831180d0bf957c57f44971999fdd12 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Mon, 12 Jun 2023 14:22:33 -0700 Subject: [PATCH 08/11] chore: tidying up --- test/test_unit/test_gold_actuator.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/test_unit/test_gold_actuator.cc b/test/test_unit/test_gold_actuator.cc index b952045..9b0ed23 100644 --- a/test/test_unit/test_gold_actuator.cc +++ b/test/test_unit/test_gold_actuator.cc @@ -42,7 +42,7 @@ class ActuatorTest : public ::testing::Test { jsd_context_ = jsd_alloc(); jsd_context_->ecx_context.slavelist[0].eep_id = JSD_EGD_PRODUCT_CODE; - + // FASTCAT_UNIT_TEST_DIR contains path to . base_dir_ = FASTCAT_UNIT_TEST_DIR; base_dir_ += "test_gold_actuator_yamls/"; @@ -157,8 +157,8 @@ TEST_F(ActuatorTest, RejectMotionCommandsWhenFaulted) cmd.type = fastcat::ACTUATOR_SET_OUTPUT_POSITION_CMD; cmd.actuator_set_digital_output_cmd.digital_output_index = 1; // Avoid 0-index'ing assert error EXPECT_TRUE(device_.Write(cmd)); - cmd.type = fastcat::ACTUATOR_SET_DIGITAL_OUTPUT_CMD; + cmd.type = fastcat::ACTUATOR_SET_DIGITAL_OUTPUT_CMD; EXPECT_TRUE(device_.Write(cmd)); cmd.type = fastcat::ACTUATOR_SET_MAX_CURRENT_CMD; From f606bbecbeaf1951fc4d75f2ba6219716ef35342 Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Thu, 15 Jun 2023 13:09:02 -0700 Subject: [PATCH 09/11] fix: revert to japrozs workflows --- .github/workflows/build.yaml | 4 +--- .github/workflows/test.yaml | 5 +---- 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ac35595..ad6c8c1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,11 +1,11 @@ name: build on: - workflow_dispatch: push: paths: - "src/**" - "test/**" + - "tools/**" jobs: build: @@ -16,8 +16,6 @@ jobs: with: version: latest platform: x64 - - name: install yamlcpp - run: sudo apt install libyaml-cpp-dev - run: | mkdir -p build cd build diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 84ab1cc..2a22153 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,11 +1,11 @@ name: test on: - workflow_dispatch: push: paths: - "src/**" - "test/**" + - "tools/**" jobs: test: @@ -18,12 +18,9 @@ jobs: apt: valgrind version: latest platform: x64 - - name: install packages - run: sudo apt install libyaml-cpp-dev libgtest-dev doxygen - run: | mkdir -p build cd build cmake -DBUILD_JSD_TESTS=ON .. - make make test make memcheck From c9040951ac4cf4fab8acd7bb541bd3341ebb69aa Mon Sep 17 00:00:00 2001 From: Preston Rogers Date: Thu, 15 Jun 2023 13:13:02 -0700 Subject: [PATCH 10/11] Revert "fix: revert to japrozs workflows" This reverts commit f606bbecbeaf1951fc4d75f2ba6219716ef35342. --- .github/workflows/build.yaml | 4 +++- .github/workflows/test.yaml | 5 ++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index ad6c8c1..ac35595 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,11 +1,11 @@ name: build on: + workflow_dispatch: push: paths: - "src/**" - "test/**" - - "tools/**" jobs: build: @@ -16,6 +16,8 @@ jobs: with: version: latest platform: x64 + - name: install yamlcpp + run: sudo apt install libyaml-cpp-dev - run: | mkdir -p build cd build diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 2a22153..84ab1cc 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -1,11 +1,11 @@ name: test on: + workflow_dispatch: push: paths: - "src/**" - "test/**" - - "tools/**" jobs: test: @@ -18,9 +18,12 @@ jobs: apt: valgrind version: latest platform: x64 + - name: install packages + run: sudo apt install libyaml-cpp-dev libgtest-dev doxygen - run: | mkdir -p build cd build cmake -DBUILD_JSD_TESTS=ON .. + make make test make memcheck From c628d9a4b3eb5ffb7ddfb423dfa6bbe0d20fb63e Mon Sep 17 00:00:00 2001 From: parogers Date: Mon, 18 Sep 2023 09:03:29 -0700 Subject: [PATCH 11/11] chore: removing extra space --- test/test_unit/test_gold_actuator.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/test_unit/test_gold_actuator.cc b/test/test_unit/test_gold_actuator.cc index 4796366..55d7deb 100644 --- a/test/test_unit/test_gold_actuator.cc +++ b/test/test_unit/test_gold_actuator.cc @@ -160,7 +160,7 @@ TEST_F(ActuatorTest, RejectMotionCommandsWhenFaulted) cmd.type = fastcat::ACTUATOR_SET_OUTPUT_POSITION_CMD; cmd.actuator_set_digital_output_cmd.digital_output_index = 1; // Avoid 0-index'ing assert error EXPECT_TRUE(device_.Write(cmd)); - + cmd.type = fastcat::ACTUATOR_SET_DIGITAL_OUTPUT_CMD; EXPECT_TRUE(device_.Write(cmd));