Move greentea test closure to library

pull/13300/head
Rajkumar Kanagaraj 2020-07-15 07:23:12 -07:00
parent b340492142
commit 41f0796484
65 changed files with 22 additions and 25 deletions

View File

@ -113,7 +113,10 @@ set(unittest-includes-base
"${PROJECT_SOURCE_DIR}/../features"
"${PROJECT_SOURCE_DIR}/../features/netsocket"
"${PROJECT_SOURCE_DIR}/../platform"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/littlefs/include"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/fat/include"
"${PROJECT_SOURCE_DIR}/../storage/blockdevice/include"
"${PROJECT_SOURCE_DIR}/../storage/filesystem/include"
"${PROJECT_SOURCE_DIR}/../drivers"
"${PROJECT_SOURCE_DIR}/../hal"
"${PROJECT_SOURCE_DIR}/../events"

View File

@ -12,9 +12,6 @@ set(unittest-includes ${unittest-includes}
)
set(unittest-sources
../storage/filesystem/Dir.cpp
../storage/filesystem/FileSystem.cpp
../storage/filesystem/File.cpp
../storage/kvstore/global_api/kvstore_global_api.cpp
../storage/kvstore/securestore/SecureStore.cpp
../storage/kvstore/kv_map/KVMap.cpp

View File

@ -17,7 +17,7 @@
#include "gtest/gtest.h"
#include "blockdevice/HeapBlockDevice.h"
#include "storage/kvstore/filesystemstore/FileSystemStore.h"
#include "storage/filesystem/littlefs/LittleFileSystem.h"
#include "littlefs/LittleFileSystem.h"
#include "mbed_error.h"
#include <stdlib.h>

View File

@ -11,10 +11,10 @@ set(unittest-includes ${unittest-includes}
set(unittest-sources
../storage/blockdevice/source/HeapBlockDevice.cpp
../storage/kvstore/filesystemstore/FileSystemStore.cpp
../storage/filesystem/littlefs/LittleFileSystem.cpp
../storage/filesystem/Dir.cpp
../storage/filesystem/File.cpp
../storage/filesystem/FileSystem.cpp
../storage/filesystem/littlefs/source/LittleFileSystem.cpp
../storage/filesystem/source/Dir.cpp
../storage/filesystem/source/File.cpp
../storage/filesystem/source/FileSystem.cpp
../features/frameworks/mbed-trace/source/mbed_trace.c
../storage/filesystem/littlefs/littlefs/lfs_util.c
../storage/filesystem/littlefs/littlefs/lfs.c

0
storage/filesystem/littlefs/littlefs/scripts/prefix.py Normal file → Executable file
View File

View File

View File

@ -22,7 +22,7 @@ from time import sleep
class UnexpectedResetTest(BaseHostTest):
"""This test checks that a device's RTC keeps count through a reset
It does this by setting the RTC's time, triggering a reset,
delaying and then reading the RTC's time again to ensure
that the RTC is still counting.
@ -58,7 +58,7 @@ class UnexpectedResetTest(BaseHostTest):
def unexpected_reset_test(self):
"""Generator for running the reset test
This function calls yield to wait for the next event from
the device. If the device gives the wrong response, then the
generator terminates by returing which raises a StopIteration
@ -100,4 +100,3 @@ class UnexpectedResetTest(BaseHostTest):
self.send_kv("exit", "pass")
yield # No more events expected

View File

@ -4,13 +4,13 @@ all: test_dirs test_files test_seek test_parallel
test_%: ../../littlefs/tests/test_%.sh
cp $< $(notdir $<)
sed -i -e 's/tests\//.\//' -e 's/echo/.\/echo.py/' $(notdir $<)
./clean.sh
ln -f -s replacements_mbed.yml replacements.yml
./$(notdir $<)
mkdir -p ../filesystem/$(patsubst test_%,%,$@)
cp main.cpp ../filesystem/$(patsubst test_%,%,$@)/main.cpp
./clean.sh
ln -f -s replacements_retarget.yml replacements.yml
./$(notdir $<)

View File

@ -4,14 +4,14 @@
- ['lfs_mkdir\(&lfs, (.*)\)', 'fs.mkdir(\1, 0777)']
- ['lfs_remove\(&lfs, (.*)\)', 'fs.remove(\1)']
- ['lfs_rename\(&lfs, (.*), ?(.*)\)', 'fs.rename(\1, \2)']
- ['lfs_dir_open\(&lfs, &dir\[(.*)\], ?(.*)\)', 'dir[\1].open(&fs, \2)']
- ['lfs_dir_close\(&lfs, &dir\[(.*)\]\)', 'dir[\1].close()']
- ['lfs_dir_read\(&lfs, &dir\[(.*)\], &info\)', 'dir[\1].read(&ent)']
- ['lfs_dir_seek\(&lfs, &dir\[(.*)\], ?(.*)\).*;', 'dir[\1].seek(\2);'] # no dir errors
- ['lfs_dir_rewind\(&lfs, &dir\[(.*)\]\).*;', 'dir[\1].rewind();'] # no dir errors
- ['lfs_dir_tell\(&lfs, &dir\[(.*)\]\)', 'dir[\1].tell()']
- ['lfs_file_open\(&lfs, &file\[(.*)\], ?(.*)\)', 'file[\1].open(&fs, \2)']
- ['lfs_file_close\(&lfs, &file\[(.*)\]\)', 'file[\1].close()']
- ['lfs_file_sync\(&lfs, &file\[(.*)\]\)', 'file[\1].sync()']
@ -21,7 +21,7 @@
- ['lfs_file_tell\(&lfs, &file\[(.*)\]\)', 'file[\1].tell()']
- ['lfs_file_rewind\(&lfs, &file\[(.*)\]\).*;', 'file[\1].rewind();'] # no errors
- ['lfs_file_size\(&lfs, &file\[(.*)\]\)', 'file[\1].size()']
- ['LFS_TYPE_([A-Z]+)', 'DT_\1']
- ['LFS_O_([A-Z]+)', 'O_\1']
- ['LFS_SEEK_([A-Z]+)', 'SEEK_\1']

View File

View File

View File

View File

View File

0
storage/filesystem/littlefsv2/littlefs/scripts/test.py Normal file → Executable file
View File

View File

@ -22,7 +22,7 @@ from time import sleep
class UnexpectedResetTest(BaseHostTest):
"""This test checks that a device's RTC keeps count through a reset
It does this by setting the RTC's time, triggering a reset,
delaying and then reading the RTC's time again to ensure
that the RTC is still counting.
@ -58,7 +58,7 @@ class UnexpectedResetTest(BaseHostTest):
def unexpected_reset_test(self):
"""Generator for running the reset test
This function calls yield to wait for the next event from
the device. If the device gives the wrong response, then the
generator terminates by returing which raises a StopIteration
@ -100,4 +100,3 @@ class UnexpectedResetTest(BaseHostTest):
self.send_kv("exit", "pass")
yield # No more events expected

View File

@ -4,13 +4,13 @@ all: test_dirs test_files test_seek test_parallel
test_%: ../../littlefs/tests/test_%.sh
cp $< $(notdir $<)
sed -i -e 's/tests\//.\//' -e 's/echo/.\/echo.py/' $(notdir $<)
./clean.sh
ln -f -s replacements_mbed.yml replacements.yml
./$(notdir $<)
mkdir -p ../filesystem/$(patsubst test_%,%,$@)
cp main.cpp ../filesystem/$(patsubst test_%,%,$@)/main.cpp
./clean.sh
ln -f -s replacements_retarget.yml replacements.yml
./$(notdir $<)

View File

@ -4,14 +4,14 @@
- ['lfs2_mkdir\(&lfs2, (.*)\)', 'fs.mkdir(\1, 0777)']
- ['lfs2_remove\(&lfs2, (.*)\)', 'fs.remove(\1)']
- ['lfs2_rename\(&lfs2, (.*), ?(.*)\)', 'fs.rename(\1, \2)']
- ['lfs2_dir_open\(&lfs2, &dir\[(.*)\], ?(.*)\)', 'dir[\1].open(&fs, \2)']
- ['lfs2_dir_close\(&lfs2, &dir\[(.*)\]\)', 'dir[\1].close()']
- ['lfs2_dir_read\(&lfs2, &dir\[(.*)\], &info\)', 'dir[\1].read(&ent)']
- ['lfs2_dir_seek\(&lfs2, &dir\[(.*)\], ?(.*)\).*;', 'dir[\1].seek(\2);'] # no dir errors
- ['lfs2_dir_rewind\(&lfs2, &dir\[(.*)\]\).*;', 'dir[\1].rewind();'] # no dir errors
- ['lfs2_dir_tell\(&lfs2, &dir\[(.*)\]\)', 'dir[\1].tell()']
- ['lfs2_file_open\(&lfs2, &file\[(.*)\], ?(.*)\)', 'file[\1].open(&fs, \2)']
- ['lfs2_file_close\(&lfs2, &file\[(.*)\]\)', 'file[\1].close()']
- ['lfs2_file_sync\(&lfs2, &file\[(.*)\]\)', 'file[\1].sync()']
@ -21,7 +21,7 @@
- ['lfs2_file_tell\(&lfs2, &file\[(.*)\]\)', 'file[\1].tell()']
- ['lfs2_file_rewind\(&lfs2, &file\[(.*)\]\).*;', 'file[\1].rewind();'] # no errors
- ['lfs2_file_size\(&lfs2, &file\[(.*)\]\)', 'file[\1].size()']
- ['LFS2_TYPE_([A-Z]+)', 'DT_\1']
- ['LFS2_O_([A-Z]+)', 'O_\1']
- ['LFS2_SEEK_([A-Z]+)', 'SEEK_\1']

View File

@ -2136,4 +2136,3 @@ int main()
{
return !Harness::run(specification);
}