Skip to content

Commit

Permalink
Merge branch 'main' into feat/charging-schedule-definition
Browse files Browse the repository at this point in the history
  • Loading branch information
james-ctc authored Mar 19, 2024
2 parents 66af61f + aed024b commit 755ac65
Show file tree
Hide file tree
Showing 44 changed files with 2,804 additions and 385 deletions.
File renamed without changes.
3 changes: 3 additions & 0 deletions .ci/build-kit/run_unit_tests.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh

ninja -j$(nproc) -C build test
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Bazel Build
run-name: ${{ github.actor }} is building with bazel
on: [pull_request]
jobs:
bazel-build:
bazel-build-and-test:
runs-on: ubuntu-22.04
steps:
- run: echo branch name is ${{ github.ref }}
Expand All @@ -16,3 +16,5 @@ jobs:
- name: Build all
run: >
bazelisk build //...
- name: Test all
run: bazelisk test //...
14 changes: 11 additions & 3 deletions .github/workflows/build_and_test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -55,15 +55,23 @@ jobs:
--volume "$(pwd):/ext" \
--name compile-container \
build-kit run-script compile
- name: Create integration-image
- name: Commit compile-container
run: |
docker commit compile-container build-image
- name: Run unit tests
run: |
docker run \
--volume "$(pwd):/ext" \
--name unit-tests-container \
build-image run-script run_unit_tests
- name: Create integration-image
run: |
docker run \
--volume "$(pwd):/ext" \
--name test-container \
build-image run-script test_and_install
build-image run-script prepare_integration_tests
docker commit test-container integration-image
- name: Run integration tests
run: |
pushd source/.ci/e2e
docker-compose run e2e-test-server run-script tests
docker-compose run e2e-test-server run-script run_integration_tests
19 changes: 11 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,17 @@ endif()
# tests requires hardware.
option(BUILD_DEV_TESTS "Build dev tests" OFF)

# Already include CTest here to allow it to find tests defined in subdirectories like lib and modules
if(EVEREST_CORE_BUILD_TESTING)
include(CTest)

set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)

evc_include(CodeCoverage)

append_coverage_compiler_flags()
endif()

include(ev-define-dependency)

include("module-dependencies.cmake")
Expand Down Expand Up @@ -125,14 +136,6 @@ endif()

# testing
if(EVEREST_CORE_BUILD_TESTING)
include(CTest)
enable_testing()
set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build type" FORCE)

evc_include(CodeCoverage)

append_coverage_compiler_flags()

add_subdirectory(tests)

setup_target_for_coverage_gcovr_html(
Expand Down
5 changes: 3 additions & 2 deletions WORKSPACE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,11 @@ load("@rules_rust//crate_universe:defs.bzl", "crates_repository", "crate")

crates_repository(
name = "crate_index",
cargo_lockfile = "//modules/rust_examples:Cargo.lock",
cargo_lockfile = "//modules:Cargo.lock",
isolated = False,
manifests = [
"//modules/rust_examples:Cargo.toml",
"//modules:Cargo.toml",
"//modules/RsIskraMeter:Cargo.toml",
"//modules/rust_examples/RsExample:Cargo.toml",
"//modules/rust_examples/RsExampleUser:Cargo.toml",
],
Expand Down
2 changes: 1 addition & 1 deletion dependencies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ libcurl:
# OCPP
libocpp:
git: https://github.com/EVerest/libocpp.git
git_tag: 5a4f95f
git_tag: 86adda6
cmake_condition: "EVEREST_DEPENDENCY_ENABLED_LIBOCPP"
# Josev
Josev:
Expand Down
2 changes: 1 addition & 1 deletion interfaces/evse_security.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ cmds:
result:
description: Result of the verification
type: string
$ref: /evse_security#/InstallCertificateResult
$ref: /evse_security#/CertificateValidationResult
get_installed_certificates:
description: Command to retrieve installed certificates of the EVSE
arguments:
Expand Down
23 changes: 22 additions & 1 deletion lib/staging/ocpp/evse_security_ocpp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ EvseSecurity::update_leaf_certificate(const std::string& certificate_chain,
this->r_security.call_update_leaf_certificate(certificate_chain, conversions::from_ocpp(certificate_type)));
}

ocpp::InstallCertificateResult
ocpp::CertificateValidationResult
EvseSecurity::verify_certificate(const std::string& certificate_chain,
const ocpp::CertificateSigningUseEnum& certificate_type) {
return conversions::to_ocpp(
Expand Down Expand Up @@ -194,6 +194,27 @@ ocpp::InstallCertificateResult to_ocpp(types::evse_security::InstallCertificateR
}
}

ocpp::CertificateValidationResult to_ocpp(types::evse_security::CertificateValidationResult other) {
switch (other) {
case types::evse_security::CertificateValidationResult::Valid:
return ocpp::CertificateValidationResult::Valid;
case types::evse_security::CertificateValidationResult::InvalidSignature:
return ocpp::CertificateValidationResult::InvalidSignature;
case types::evse_security::CertificateValidationResult::IssuerNotFound:
return ocpp::CertificateValidationResult::IssuerNotFound;
case types::evse_security::CertificateValidationResult::InvalidLeafSignature:
return ocpp::CertificateValidationResult::InvalidLeafSignature;
case types::evse_security::CertificateValidationResult::InvalidChain:
return ocpp::CertificateValidationResult::InvalidChain;
case types::evse_security::CertificateValidationResult::Unknown:
return ocpp::CertificateValidationResult::Unknown;
;
default:
throw std::runtime_error("Could not convert types::evse_security::CertificateValidationResult to "
"ocpp::CertificateValidationResult");
}
}

ocpp::DeleteCertificateResult to_ocpp(types::evse_security::DeleteCertificateResult other) {
switch (other) {
case types::evse_security::DeleteCertificateResult::Accepted:
Expand Down
6 changes: 4 additions & 2 deletions lib/staging/ocpp/evse_security_ocpp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ class EvseSecurity : public ocpp::EvseSecurity {
const ocpp::CaCertificateType& certificate_type) override;
ocpp::DeleteCertificateResult
delete_certificate(const ocpp::CertificateHashDataType& certificate_hash_data) override;
ocpp::InstallCertificateResult verify_certificate(const std::string& certificate_chain,
const ocpp::CertificateSigningUseEnum& certificate_type) override;
ocpp::CertificateValidationResult
verify_certificate(const std::string& certificate_chain,
const ocpp::CertificateSigningUseEnum& certificate_type) override;
ocpp::InstallCertificateResult
update_leaf_certificate(const std::string& certificate_chain,
const ocpp::CertificateSigningUseEnum& certificate_type) override;
Expand All @@ -47,6 +48,7 @@ ocpp::CertificateSigningUseEnum to_ocpp(types::evse_security::LeafCertificateTyp
ocpp::CertificateType to_ocpp(types::evse_security::CertificateType other);
ocpp::HashAlgorithmEnumType to_ocpp(types::evse_security::HashAlgorithm other);
ocpp::InstallCertificateResult to_ocpp(types::evse_security::InstallCertificateResult other);
ocpp::CertificateValidationResult to_ocpp(types::evse_security::CertificateValidationResult other);
ocpp::DeleteCertificateResult to_ocpp(types::evse_security::DeleteCertificateResult other);

ocpp::CertificateHashDataType to_ocpp(types::evse_security::CertificateHashData other);
Expand Down
10 changes: 5 additions & 5 deletions modules/Auth/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@

add_executable(auth_tests auth_tests.cpp)
set(TEST_TARGET_NAME ${PROJECT_NAME}_auth_tests)
add_executable(${TEST_TARGET_NAME} auth_tests.cpp)

set(INCLUDE_DIR
"${PROJECT_SOURCE_DIR}/modules/Auth/include"
"${PROJECT_SOURCE_DIR}/modules/Auth/tests")

get_target_property(GENERATED_INCLUDE_DIR generate_cpp_files EVEREST_GENERATED_INCLUDE_DIR)

target_include_directories(auth_tests PUBLIC
target_include_directories(${TEST_TARGET_NAME} PUBLIC
${INCLUDE_DIR}
${GENERATED_INCLUDE_DIR}
)

target_link_libraries(auth_tests PRIVATE
target_link_libraries(${TEST_TARGET_NAME} PRIVATE
GTest::gmock
GTest::gtest_main
everest::timer
Expand All @@ -26,4 +26,4 @@ target_link_libraries(auth_tests PRIVATE
date::date-tz
)

add_test(auth_tests auth_tests)
add_test(${TEST_TARGET_NAME} ${TEST_TARGET_NAME})
Empty file added modules/BUILD.bazel
Empty file.
1 change: 1 addition & 0 deletions modules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,6 @@ add_subdirectory(examples)
add_subdirectory(simulation)

if(${EVEREST_ENABLE_RS_SUPPORT})
ev_add_module(RsIskraMeter)
add_subdirectory(rust_examples)
endif()
Loading

0 comments on commit 755ac65

Please sign in to comment.