1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2024-12-01 09:24:10 +01:00

ut_logfs: do not pollute the source tree with temp files

This commit is contained in:
Oleg Semyonov 2013-02-24 04:24:25 +02:00 committed by Alessio Morale
parent c038f6b987
commit 776ec4f3ea
4 changed files with 8 additions and 2 deletions

View File

@ -34,6 +34,8 @@ CFLAGS += -Wall -Werror
CFLAGS += -g
CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) -I.
CFLAGS += "-DFLASH_IMAGE_FILE=\"$(OUTDIR)/theflash.bin\""
CONLYFLAGS += -std=gnu99
SRC := $(PIOS)/Common/pios_flashfs_logfs.c

View File

@ -41,7 +41,7 @@ int32_t PIOS_Flash_UT_Init(uintptr_t * flash_id, const struct pios_flash_ut_cfg
flash_dev->cfg = cfg;
flash_dev->transaction_in_progress = false;
flash_dev->flash_file = fopen ("theflash.bin", "rb+");
flash_dev->flash_file = fopen (FLASH_IMAGE_FILE, "rb+");
if (flash_dev->flash_file == NULL) {
return -1;
}

View File

@ -8,3 +8,7 @@ struct pios_flash_ut_cfg {
int32_t PIOS_Flash_UT_Init(uintptr_t * flash_id, const struct pios_flash_ut_cfg * cfg);
extern const struct pios_flash_driver pios_ut_flash_driver;
#if !defined(FLASH_IMAGE_FILE)
#define FLASH_IMAGE_FILE "theflash.bin"
#endif

View File

@ -35,7 +35,7 @@ class LogfsTestRaw : public testing::Test {
protected:
virtual void SetUp() {
/* create an empty, appropriately sized flash filesystem */
FILE * theflash = fopen("theflash.bin", "wb");
FILE * theflash = fopen(FLASH_IMAGE_FILE, "wb");
uint8_t sector[flash_config.size_of_sector];
memset(sector, 0xFF, sizeof(sector));
for (uint32_t i = 0; i < flash_config.size_of_flash / flash_config.size_of_sector; i++) {