From 0e6edba44d58a4196ec551b0173bbcd249fb6db7 Mon Sep 17 00:00:00 2001 From: paradajz <2544094+paradajz@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:47:46 +0100 Subject: [PATCH] tests/bootloader: check if required files exist --- tests/src/bootloader/test.cpp | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/src/bootloader/test.cpp b/tests/src/bootloader/test.cpp index fdf28e710..fe2efe454 100644 --- a/tests/src/bootloader/test.cpp +++ b/tests/src/bootloader/test.cpp @@ -8,6 +8,7 @@ #include "board/Internal.h" #include "helpers/MIDI.h" +#include #include #include #include @@ -67,8 +68,20 @@ namespace TEST(Bootloader, FwUpdate) { - const std::string SYX_PATH = fw_build_dir + BOARD_STRING + "/" + fw_build_type_subdir + "merged/" + BOARD_STRING + ".sysex.syx"; - const std::string BINARY_PATH = fw_build_dir + BOARD_STRING + "/" + fw_build_type_subdir + "merged/" + BOARD_STRING + "_sysex.bin"; + const std::filesystem::path SYX_PATH = std::string(fw_build_dir + BOARD_STRING + "/" + fw_build_type_subdir + "merged/" + BOARD_STRING + ".sysex.syx"); + const std::filesystem::path BINARY_PATH = std::string(fw_build_dir + BOARD_STRING + "/" + fw_build_type_subdir + "merged/" + BOARD_STRING + "_sysex.bin"); + + if (!std::filesystem::exists(SYX_PATH)) + { + LOG(ERROR) << SYX_PATH << " doesn't exist"; + ASSERT_TRUE(true == false); + } + + if (!std::filesystem::exists(BINARY_PATH)) + { + LOG(ERROR) << BINARY_PATH << " doesn't exist"; + ASSERT_TRUE(true == false); + } std::ifstream sysExStream(SYX_PATH, std::ios::in | std::ios::binary); std::vector sysExVector((std::istreambuf_iterator(sysExStream)), std::istreambuf_iterator());