Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Updated with suggestion from PR review.

Co-authored-by: Andreas Heinrich <[email protected]>
Signed-off-by: Coury Richards <[email protected]>
  • Loading branch information
couryrr-afs and andistorm authored Feb 5, 2024
1 parent 201e918 commit 9b194d6
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 18 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Please reference work here https://github.com/EVerest/everest-core/tree/main/.github/workflows
See also https://github.com/EVerest/everest-core/tree/main/.github/workflows
# TODO: modify to reuse the above workflow to DRY up CI.

name: Build and test libtimer
Expand All @@ -18,10 +18,7 @@ on:
jobs:
lint:
name: Lint
strategy:
matrix:
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
runs-on: ${{ matrix.os }}](runs-on: ${{ inputs.runner || 'ubuntu-22.04' }})
steps:
- name: Checkout libtimer
uses: actions/checkout@v3
Expand All @@ -35,10 +32,7 @@ jobs:
exclude: cache
install_and_test:
name: Install and test
strategy:
matrix:
os: [ubuntu-22.04]
runs-on: ${{ matrix.os }}
runs-on: ${{ inputs.runner || 'ubuntu-22.04' }}
steps:
- name: Checkout libtimer
uses: actions/checkout@v3
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
build/
dist/
workspace.yaml
dist/
workspace.yaml
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ if(CMAKE_RUN_CLANG_TIDY)
-checks=${CLANG_TIDY_CHECKS})
endif()

if(BUILD_TESTING)
if((${CMAKE_PROJECT_NAME} STREQUAL ${PROJECT_NAME} OR ${PROJECT_NAME}_BUILD_TESTING) AND BUILD_TESTING)
include(CTest)
add_subdirectory(tests)
endif()
9 changes: 5 additions & 4 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
find_package(GTest REQUIRED)
add_executable(libtimer_unit_test libtimer_unit_test.cpp)
set(TEST_TARGET_NAME ${PROJECT_NAME}_tests)
add_executable(${TEST_TARGET_NAME} libtimer_unit_test.cpp)

target_include_directories(libtimer_unit_test PUBLIC${GTEST_INCLUDE_DIRS})
target_include_directories(${TEST_TARGET_NAME} PUBLIC${GTEST_INCLUDE_DIRS})

target_link_libraries(libtimer_unit_test PRIVATE
target_link_libraries(${TEST_TARGET_NAME} PRIVATE
${GTEST_LIBRARIES}
${GTEST_MAIN_LIBRARIES}
)

add_test(libtimer_unit_test libtimer_unit_test)
add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
4 changes: 2 additions & 2 deletions tests/libtimer_unit_test.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// SPDX-License-Identifier: Apache-2.0
// Copyright 2020 - 2023 Pionix GmbH and Contributors to EVerest
// Copyright Pionix GmbH and Contributors to EVerest

#include <gtest/gtest.h>
namespace libtimer {
Expand All @@ -15,4 +15,4 @@ class LibTimerUnitTest : public ::testing::Test {
TEST_F(LibTimerUnitTest, just_an_example) {
ASSERT_TRUE(1 == 1);
}
} // namespace libtimer
} // namespace libtimer

0 comments on commit 9b194d6

Please sign in to comment.