-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧪 (tests): on device - add firmwarekit version tests
- Loading branch information
Showing
3 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
# Leka - LekaOS | ||
# Copyright 2022 APF France handicap | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
register_functional_test( | ||
TARGET | ||
functional_ut_firmware_kit | ||
|
||
INCLUDE_DIRECTORIES | ||
|
||
SOURCES | ||
suite_firmware_kit.cpp | ||
|
||
LINK_LIBRARIES | ||
FirmwareKit | ||
) |
36 changes: 36 additions & 0 deletions
36
tests/functional/tests/firmware_kit/suite_firmware_kit.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// Leka - LekaOS | ||
// Copyright 2022 APF France handicap | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
#include <cstddef> | ||
|
||
#include "CoreFlashIS25LP016D.h" | ||
#include "CoreFlashManagerIS25LP016D.h" | ||
#include "CoreQSPI.h" | ||
#include "FirmwareKit.h" | ||
#include "os_version.h" | ||
#include "semver/semver.hpp" | ||
#include "tests/config.h" | ||
#include "tests/utils.h" | ||
#include "tests/utils_sleep.h" | ||
|
||
using namespace leka; | ||
using namespace boost::ut; | ||
using namespace std::chrono; | ||
|
||
auto qspi = CoreQSPI(); | ||
auto flash_manager = CoreFlashManagerIS25LP016D(qspi); | ||
auto flash_memory = CoreFlashIS25LP016D(qspi, flash_manager); | ||
|
||
suite suite_firmware_kit = [] { | ||
"config version and firmware kit version are the same"_test = [&] { | ||
auto firmwarekit = FirmwareKit(flash_memory, FirmwareKit::DEFAULT_CONFIG); | ||
auto firmwarekit_version = firmwarekit.getCurrentVersion(); | ||
|
||
auto semver_version = semver::version {OS_VERSION}; | ||
|
||
expect(eq(firmwarekit_version.major, semver_version.major)); | ||
expect(eq(firmwarekit_version.minor, semver_version.minor)); | ||
expect(eq(firmwarekit_version.revision, semver_version.patch)); | ||
}; | ||
}; |