-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[EGD-7031] Remove UT deps to the production image
Remove dependency to the production image by creating separate sysroot for test assets alongside with a test image Test.img. Signed-off-by: Marcin Smoczyński <smoczynski.marcin@gmail.com>
- Loading branch information
Showing
48 changed files
with
447 additions
and
285 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,2 @@ | ||
add_library(board STATIC) | ||
add_subdirectory(${PROJECT_TARGET_NAME}) |
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 @@ | ||
add_subdirectory(libiosyscalls) |
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,7 @@ | ||
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. | ||
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md | ||
|
||
#pragma once | ||
|
||
void iosyscalls_set_image_name(const char *newImageName); | ||
void iosyscalls_set_sysroot(const char *newSysroot); |
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 |
---|---|---|
@@ -1,56 +1,5 @@ | ||
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. | ||
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md | ||
|
||
#pragma once | ||
#include <stddef.h> | ||
#include <stdio.h> | ||
#include <purefs/vfs_subsystem.hpp> | ||
|
||
struct __dirstream; | ||
|
||
namespace vfsn::linux::internal | ||
extern "C" | ||
{ | ||
bool redirect_to_image(); | ||
bool is_image_handle(const FILE *fil); | ||
bool is_image_fd(int fd); | ||
bool redirect_to_image(const char *inpath); | ||
const char *npath_translate(const char *inpath, char *buffer); | ||
|
||
struct FILEX | ||
{ | ||
int fd{0}; | ||
int error{0}; | ||
int ungetchar{-1}; | ||
}; | ||
|
||
int to_native_fd(int fd); | ||
int to_image_fd(int fd); | ||
|
||
FILEX *allocate_filex(int fd); | ||
bool is_filex(const void *fd); | ||
void remove_filex(FILEX *fil); | ||
|
||
void add_DIR_to_image_list(__dirstream *indir); | ||
void remove_DIR_from_image_list(__dirstream *indir); | ||
bool is_image_DIR(__dirstream *indir); | ||
|
||
template <class Base, typename T, typename... Args> | ||
auto invoke_fs(T Base::*lfs_fun, Args &&... args) | ||
-> decltype((static_cast<Base *>(nullptr)->*lfs_fun)(std::forward<Args>(args)...)) | ||
{ | ||
auto vfs = purefs::subsystem::vfs_core(); | ||
if (!vfs) { | ||
errno = EIO; | ||
return -1; | ||
} | ||
auto ret = (vfs.get()->*lfs_fun)(std::forward<Args>(args)...); | ||
if (ret < 0) { | ||
errno = -ret; | ||
ret = -1; | ||
} | ||
else { | ||
errno = 0; | ||
} | ||
return ret; | ||
} | ||
} // namespace vfsn::linux::internal | ||
#include "iosyscalls.h" | ||
} |
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,19 @@ | ||
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. | ||
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md | ||
|
||
#include "iosyscalls-internal.hpp" | ||
|
||
extern "C" | ||
{ | ||
namespace vfs = vfsn::linux::internal; | ||
|
||
void iosyscalls_set_sysroot(const char *newSysroot) | ||
{ | ||
vfs::set_sysroot(newSysroot); | ||
} | ||
|
||
void iosyscalls_set_image_name(const char *newImageName) | ||
{ | ||
vfs::set_image_path(newImageName); | ||
} | ||
} |
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,58 @@ | ||
// Copyright (c) 2017-2021, Mudita Sp. z.o.o. All rights reserved. | ||
// For licensing, see https://github.com/mudita/MuditaOS/LICENSE.md | ||
|
||
#pragma once | ||
#include <stddef.h> | ||
#include <stdio.h> | ||
#include <purefs/vfs_subsystem.hpp> | ||
|
||
struct __dirstream; | ||
|
||
namespace vfsn::linux::internal | ||
{ | ||
void set_image_path(const char *newImageName); | ||
void set_sysroot(const char *newSysroot); | ||
bool redirect_to_image(); | ||
bool is_image_handle(const FILE *fil); | ||
bool is_image_fd(int fd); | ||
bool redirect_to_image(const char *inpath); | ||
const char *npath_translate(const char *inpath, char *buffer); | ||
|
||
struct FILEX | ||
{ | ||
int fd{0}; | ||
int error{0}; | ||
int ungetchar{-1}; | ||
}; | ||
|
||
int to_native_fd(int fd); | ||
int to_image_fd(int fd); | ||
|
||
FILEX *allocate_filex(int fd); | ||
bool is_filex(const void *fd); | ||
void remove_filex(FILEX *fil); | ||
|
||
void add_DIR_to_image_list(__dirstream *indir); | ||
void remove_DIR_from_image_list(__dirstream *indir); | ||
bool is_image_DIR(__dirstream *indir); | ||
|
||
template <class Base, typename T, typename... Args> | ||
auto invoke_fs(T Base::*lfs_fun, Args &&... args) | ||
-> decltype((static_cast<Base *>(nullptr)->*lfs_fun)(std::forward<Args>(args)...)) | ||
{ | ||
auto vfs = purefs::subsystem::vfs_core(); | ||
if (!vfs) { | ||
errno = EIO; | ||
return -1; | ||
} | ||
auto ret = (vfs.get()->*lfs_fun)(std::forward<Args>(args)...); | ||
if (ret < 0) { | ||
errno = -ret; | ||
ret = -1; | ||
} | ||
else { | ||
errno = 0; | ||
} | ||
return ret; | ||
} | ||
} // namespace vfsn::linux::internal |
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
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
Oops, something went wrong.