mirror of https://github.com/ARMmbed/mbed-os.git
Enforced style consistency with mbed
see https://os.mbed.com/docs/v5.6/reference/guidelines.html#stylepull/5538/head
parent
9da2475099
commit
91a4f443fe
|
@ -1,23 +1,17 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2012 ARM Limited
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "LittleFileSystem.h"
|
||||
|
@ -29,7 +23,8 @@ extern "C" {
|
|||
|
||||
|
||||
////// Conversion functions //////
|
||||
static int lfs_toerror(int err) {
|
||||
static int lfs_toerror(int err)
|
||||
{
|
||||
switch (err) {
|
||||
case LFS_ERR_OK: return 0;
|
||||
case LFS_ERR_IO: return -EIO;
|
||||
|
@ -44,7 +39,8 @@ static int lfs_toerror(int err) {
|
|||
}
|
||||
}
|
||||
|
||||
static int lfs_fromflags(int flags) {
|
||||
static int lfs_fromflags(int flags)
|
||||
{
|
||||
return (
|
||||
(((flags & 3) == O_RDONLY) ? LFS_O_RDONLY : 0) |
|
||||
(((flags & 3) == O_WRONLY) ? LFS_O_WRONLY : 0) |
|
||||
|
@ -55,7 +51,8 @@ static int lfs_fromflags(int flags) {
|
|||
((flags & O_APPEND) ? LFS_O_APPEND : 0));
|
||||
}
|
||||
|
||||
static int lfs_fromwhence(int whence) {
|
||||
static int lfs_fromwhence(int whence)
|
||||
{
|
||||
switch (whence) {
|
||||
case SEEK_SET: return LFS_SEEK_SET;
|
||||
case SEEK_CUR: return LFS_SEEK_CUR;
|
||||
|
@ -64,7 +61,8 @@ static int lfs_fromwhence(int whence) {
|
|||
}
|
||||
}
|
||||
|
||||
static int lfs_tomode(int type) {
|
||||
static int lfs_tomode(int type)
|
||||
{
|
||||
int mode = S_IRWXU | S_IRWXG | S_IRWXO;
|
||||
switch (type) {
|
||||
case LFS_TYPE_DIR: return mode | S_IFDIR;
|
||||
|
@ -73,7 +71,8 @@ static int lfs_tomode(int type) {
|
|||
}
|
||||
}
|
||||
|
||||
static int lfs_totype(int type) {
|
||||
static int lfs_totype(int type)
|
||||
{
|
||||
switch (type) {
|
||||
case LFS_TYPE_DIR: return DT_DIR;
|
||||
case LFS_TYPE_REG: return DT_REG;
|
||||
|
@ -95,12 +94,14 @@ static int lfs_bd_prog(const struct lfs_config *c, lfs_block_t block,
|
|||
return bd->program(buffer, block*c->block_size + off, size);
|
||||
}
|
||||
|
||||
static int lfs_bd_erase(const struct lfs_config *c, lfs_block_t block) {
|
||||
static int lfs_bd_erase(const struct lfs_config *c, lfs_block_t block)
|
||||
{
|
||||
BlockDevice *bd = (BlockDevice *)c->context;
|
||||
return bd->erase(block*c->block_size, c->block_size);
|
||||
}
|
||||
|
||||
static int lfs_bd_sync(const struct lfs_config *c) {
|
||||
static int lfs_bd_sync(const struct lfs_config *c)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -126,7 +127,8 @@ LittleFileSystem::~LittleFileSystem() {
|
|||
unmount();
|
||||
}
|
||||
|
||||
int LittleFileSystem::mount(BlockDevice *bd) {
|
||||
int LittleFileSystem::mount(BlockDevice *bd)
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("mount(%p)", bd);
|
||||
_bd = bd;
|
||||
|
@ -167,7 +169,8 @@ int LittleFileSystem::mount(BlockDevice *bd) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::unmount() {
|
||||
int LittleFileSystem::unmount()
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("unmount(%s)", "");
|
||||
if (_bd) {
|
||||
|
@ -247,7 +250,8 @@ int LittleFileSystem::format(BlockDevice *bd,
|
|||
return 0;
|
||||
}
|
||||
|
||||
int LittleFileSystem::reformat(BlockDevice *bd) {
|
||||
int LittleFileSystem::reformat(BlockDevice *bd)
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("reformat(%p)", bd);
|
||||
if (_bd) {
|
||||
|
@ -289,7 +293,8 @@ int LittleFileSystem::reformat(BlockDevice *bd) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
int LittleFileSystem::remove(const char *filename) {
|
||||
int LittleFileSystem::remove(const char *filename)
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("remove(\"%s\")", filename);
|
||||
int err = lfs_remove(&_lfs, filename);
|
||||
|
@ -298,7 +303,8 @@ int LittleFileSystem::remove(const char *filename) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::rename(const char *oldname, const char *newname) {
|
||||
int LittleFileSystem::rename(const char *oldname, const char *newname)
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("rename(\"%s\", \"%s\")", oldname, newname);
|
||||
int err = lfs_rename(&_lfs, oldname, newname);
|
||||
|
@ -307,7 +313,8 @@ int LittleFileSystem::rename(const char *oldname, const char *newname) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::mkdir(const char *name, mode_t mode) {
|
||||
int LittleFileSystem::mkdir(const char *name, mode_t mode)
|
||||
{
|
||||
_mutex.lock();
|
||||
LFS_INFO("mkdir(\"%s\", 0x%lx)", name, mode);
|
||||
int err = lfs_mkdir(&_lfs, name);
|
||||
|
@ -316,7 +323,8 @@ int LittleFileSystem::mkdir(const char *name, mode_t mode) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::stat(const char *name, struct stat *st) {
|
||||
int LittleFileSystem::stat(const char *name, struct stat *st)
|
||||
{
|
||||
struct lfs_info info;
|
||||
_mutex.lock();
|
||||
LFS_INFO("stat(\"%s\", %p)", name, st);
|
||||
|
@ -330,7 +338,8 @@ int LittleFileSystem::stat(const char *name, struct stat *st) {
|
|||
|
||||
|
||||
////// File operations //////
|
||||
int LittleFileSystem::file_open(fs_file_t *file, const char *path, int flags) {
|
||||
int LittleFileSystem::file_open(fs_file_t *file, const char *path, int flags)
|
||||
{
|
||||
lfs_file_t *f = new lfs_file_t;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_open(%p, \"%s\", 0x%x)", *file, path, flags);
|
||||
|
@ -345,7 +354,8 @@ int LittleFileSystem::file_open(fs_file_t *file, const char *path, int flags) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::file_close(fs_file_t file) {
|
||||
int LittleFileSystem::file_close(fs_file_t file)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_close(%p)", file);
|
||||
|
@ -356,7 +366,8 @@ int LittleFileSystem::file_close(fs_file_t file) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
ssize_t LittleFileSystem::file_read(fs_file_t file, void *buffer, size_t len) {
|
||||
ssize_t LittleFileSystem::file_read(fs_file_t file, void *buffer, size_t len)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_read(%p, %p, %d)", file, buffer, len);
|
||||
|
@ -366,7 +377,8 @@ ssize_t LittleFileSystem::file_read(fs_file_t file, void *buffer, size_t len) {
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
ssize_t LittleFileSystem::file_write(fs_file_t file, const void *buffer, size_t len) {
|
||||
ssize_t LittleFileSystem::file_write(fs_file_t file, const void *buffer, size_t len)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_write(%p, %p, %d)", file, buffer, len);
|
||||
|
@ -376,7 +388,8 @@ ssize_t LittleFileSystem::file_write(fs_file_t file, const void *buffer, size_t
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
int LittleFileSystem::file_sync(fs_file_t file) {
|
||||
int LittleFileSystem::file_sync(fs_file_t file)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_sync(%p)", file);
|
||||
|
@ -386,7 +399,8 @@ int LittleFileSystem::file_sync(fs_file_t file) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
off_t LittleFileSystem::file_seek(fs_file_t file, off_t offset, int whence) {
|
||||
off_t LittleFileSystem::file_seek(fs_file_t file, off_t offset, int whence)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_seek(%p, %ld, %d)", file, offset, whence);
|
||||
|
@ -396,7 +410,8 @@ off_t LittleFileSystem::file_seek(fs_file_t file, off_t offset, int whence) {
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
off_t LittleFileSystem::file_tell(fs_file_t file) {
|
||||
off_t LittleFileSystem::file_tell(fs_file_t file)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_tell(%p)", file);
|
||||
|
@ -406,7 +421,8 @@ off_t LittleFileSystem::file_tell(fs_file_t file) {
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
off_t LittleFileSystem::file_size(fs_file_t file) {
|
||||
off_t LittleFileSystem::file_size(fs_file_t file)
|
||||
{
|
||||
lfs_file_t *f = (lfs_file_t *)file;
|
||||
_mutex.lock();
|
||||
LFS_INFO("file_size(%p)", file);
|
||||
|
@ -418,7 +434,8 @@ off_t LittleFileSystem::file_size(fs_file_t file) {
|
|||
|
||||
|
||||
////// Dir operations //////
|
||||
int LittleFileSystem::dir_open(fs_dir_t *dir, const char *path) {
|
||||
int LittleFileSystem::dir_open(fs_dir_t *dir, const char *path)
|
||||
{
|
||||
lfs_dir_t *d = new lfs_dir_t;
|
||||
_mutex.lock();
|
||||
LFS_INFO("dir_open(%p, \"%s\")", *dir, path);
|
||||
|
@ -433,7 +450,8 @@ int LittleFileSystem::dir_open(fs_dir_t *dir, const char *path) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
int LittleFileSystem::dir_close(fs_dir_t dir) {
|
||||
int LittleFileSystem::dir_close(fs_dir_t dir)
|
||||
{
|
||||
lfs_dir_t *d = (lfs_dir_t *)dir;
|
||||
_mutex.lock();
|
||||
LFS_INFO("dir_close(%p)", dir);
|
||||
|
@ -444,7 +462,8 @@ int LittleFileSystem::dir_close(fs_dir_t dir) {
|
|||
return lfs_toerror(err);
|
||||
}
|
||||
|
||||
ssize_t LittleFileSystem::dir_read(fs_dir_t dir, struct dirent *ent) {
|
||||
ssize_t LittleFileSystem::dir_read(fs_dir_t dir, struct dirent *ent)
|
||||
{
|
||||
lfs_dir_t *d = (lfs_dir_t *)dir;
|
||||
struct lfs_info info;
|
||||
_mutex.lock();
|
||||
|
@ -459,7 +478,8 @@ ssize_t LittleFileSystem::dir_read(fs_dir_t dir, struct dirent *ent) {
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
void LittleFileSystem::dir_seek(fs_dir_t dir, off_t offset) {
|
||||
void LittleFileSystem::dir_seek(fs_dir_t dir, off_t offset)
|
||||
{
|
||||
lfs_dir_t *d = (lfs_dir_t *)dir;
|
||||
_mutex.lock();
|
||||
LFS_INFO("dir_seek(%p, %ld)", dir, offset);
|
||||
|
@ -468,7 +488,8 @@ void LittleFileSystem::dir_seek(fs_dir_t dir, off_t offset) {
|
|||
_mutex.unlock();
|
||||
}
|
||||
|
||||
off_t LittleFileSystem::dir_tell(fs_dir_t dir) {
|
||||
off_t LittleFileSystem::dir_tell(fs_dir_t dir)
|
||||
{
|
||||
lfs_dir_t *d = (lfs_dir_t *)dir;
|
||||
_mutex.lock();
|
||||
LFS_INFO("dir_tell(%p)", dir);
|
||||
|
@ -478,7 +499,8 @@ off_t LittleFileSystem::dir_tell(fs_dir_t dir) {
|
|||
return lfs_toerror(res);
|
||||
}
|
||||
|
||||
void LittleFileSystem::dir_rewind(fs_dir_t dir) {
|
||||
void LittleFileSystem::dir_rewind(fs_dir_t dir)
|
||||
{
|
||||
lfs_dir_t *d = (lfs_dir_t *)dir;
|
||||
_mutex.lock();
|
||||
LFS_INFO("dir_rewind(%p)", dir);
|
||||
|
|
|
@ -1,23 +1,17 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2006-2012 ARM Limited
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#ifndef MBED_LFSFILESYSTEM_H
|
||||
#define MBED_LFSFILESYSTEM_H
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_directory_tests() {
|
||||
void test_directory_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_directory_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_root_directory() {
|
||||
void test_root_directory()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -98,7 +115,8 @@ void test_root_directory() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_creation() {
|
||||
void test_directory_creation()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -115,7 +133,8 @@ void test_directory_creation() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_file_creation() {
|
||||
void test_file_creation()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -134,7 +153,8 @@ void test_file_creation() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_iteration() {
|
||||
void test_directory_iteration()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -179,7 +199,8 @@ void test_directory_iteration() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_failures() {
|
||||
void test_directory_failures()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -204,7 +225,8 @@ void test_directory_failures() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_nested_directories() {
|
||||
void test_nested_directories()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -268,7 +290,8 @@ void test_nested_directories() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_multi_block_directory() {
|
||||
void test_multi_block_directory()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -322,7 +345,8 @@ void test_multi_block_directory() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_remove() {
|
||||
void test_directory_remove()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -432,7 +456,8 @@ void test_directory_remove() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_rename() {
|
||||
void test_directory_rename()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -632,7 +657,8 @@ void test_directory_rename() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -652,6 +678,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_file_tests() {
|
||||
void test_file_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_file_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_test() {
|
||||
void test_simple_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -111,7 +128,8 @@ void test_simple_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_small_file_test() {
|
||||
void test_small_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -164,7 +182,8 @@ void test_small_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_medium_file_test() {
|
||||
void test_medium_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -217,7 +236,8 @@ void test_medium_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_test() {
|
||||
void test_large_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -270,7 +290,8 @@ void test_large_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_non_overlap_check() {
|
||||
void test_non_overlap_check()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -347,7 +368,8 @@ void test_non_overlap_check() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_dir_check() {
|
||||
void test_dir_check()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -403,7 +425,8 @@ void test_dir_check() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -420,6 +443,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_parallel_tests() {
|
||||
void test_parallel_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_parallel_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_parallel_file_test() {
|
||||
void test_parallel_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -196,7 +213,8 @@ void test_parallel_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_parallel_remove_file_test() {
|
||||
void test_parallel_remove_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -269,7 +287,8 @@ void test_parallel_remove_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_remove_inconveniently_test() {
|
||||
void test_remove_inconveniently_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -367,7 +386,8 @@ void test_remove_inconveniently_test() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -381,6 +401,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_seek_tests() {
|
||||
void test_seek_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -99,7 +115,8 @@ void test_seek_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_dir_seek() {
|
||||
void test_simple_dir_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -168,7 +185,8 @@ void test_simple_dir_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_dir_seek() {
|
||||
void test_large_dir_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -237,7 +255,8 @@ void test_large_dir_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_seek() {
|
||||
void test_simple_file_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -302,7 +321,8 @@ void test_simple_file_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_seek() {
|
||||
void test_large_file_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -367,7 +387,8 @@ void test_large_file_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_seek_and_write() {
|
||||
void test_simple_file_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -432,7 +453,8 @@ void test_simple_file_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_seek_and_write() {
|
||||
void test_large_file_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -499,7 +521,8 @@ void test_large_file_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_boundary_seek_and_write() {
|
||||
void test_boundary_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -544,7 +567,8 @@ void test_boundary_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_out_of_bounds_seek() {
|
||||
void test_out_of_bounds_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -593,7 +617,8 @@ void test_out_of_bounds_seek() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -612,6 +637,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017-2017 ARM Limited
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mbed.h"
|
||||
#include "unity.h"
|
||||
#include "utest.h"
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017-2017 ARM Limited
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mbed.h"
|
||||
#include "unity.h"
|
||||
#include "utest.h"
|
||||
|
|
|
@ -1,25 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017-2017 ARM Limited
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
* of this software and associated documentation files (the "Software"), to deal
|
||||
* in the Software without restriction, including without limitation the rights
|
||||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
* copies of the Software, and to permit persons to whom the Software is
|
||||
* furnished to do so, subject to the following conditions:
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
* SOFTWARE.
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include "mbed.h"
|
||||
#include "unity.h"
|
||||
#include "utest.h"
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_directory_tests() {
|
||||
void test_directory_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_directory_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_root_directory() {
|
||||
void test_root_directory()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -98,7 +115,8 @@ void test_root_directory() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_creation() {
|
||||
void test_directory_creation()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -115,7 +133,8 @@ void test_directory_creation() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_file_creation() {
|
||||
void test_file_creation()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -134,7 +153,8 @@ void test_file_creation() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_iteration() {
|
||||
void test_directory_iteration()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -179,7 +199,8 @@ void test_directory_iteration() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_failures() {
|
||||
void test_directory_failures()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -204,7 +225,8 @@ void test_directory_failures() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_nested_directories() {
|
||||
void test_nested_directories()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -268,7 +290,8 @@ void test_nested_directories() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_multi_block_directory() {
|
||||
void test_multi_block_directory()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -322,7 +345,8 @@ void test_multi_block_directory() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_remove() {
|
||||
void test_directory_remove()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -432,7 +456,8 @@ void test_directory_remove() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_directory_rename() {
|
||||
void test_directory_rename()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -632,7 +657,8 @@ void test_directory_rename() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -652,6 +678,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_file_tests() {
|
||||
void test_file_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_file_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_test() {
|
||||
void test_simple_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -111,7 +128,8 @@ void test_simple_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_small_file_test() {
|
||||
void test_small_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -164,7 +182,8 @@ void test_small_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_medium_file_test() {
|
||||
void test_medium_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -217,7 +236,8 @@ void test_medium_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_test() {
|
||||
void test_large_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -270,7 +290,8 @@ void test_large_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_non_overlap_check() {
|
||||
void test_non_overlap_check()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -347,7 +368,8 @@ void test_non_overlap_check() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_dir_check() {
|
||||
void test_dir_check()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -403,7 +425,8 @@ void test_dir_check() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -420,6 +443,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_parallel_tests() {
|
||||
void test_parallel_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -79,7 +95,8 @@ void test_parallel_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_parallel_file_test() {
|
||||
void test_parallel_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -196,7 +213,8 @@ void test_parallel_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_parallel_remove_file_test() {
|
||||
void test_parallel_remove_file_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -269,7 +287,8 @@ void test_parallel_remove_file_test() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_remove_inconveniently_test() {
|
||||
void test_remove_inconveniently_test()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -367,7 +386,8 @@ void test_remove_inconveniently_test() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -381,6 +401,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -1,3 +1,18 @@
|
|||
/* mbed Microcontroller Library
|
||||
* Copyright (c) 2017 ARM Limited
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
#include "mbed.h"
|
||||
#include "greentea-client/test_env.h"
|
||||
#include "unity.h"
|
||||
|
@ -66,7 +81,8 @@ uint8_t wbuffer[MBED_TEST_BUFFER];
|
|||
|
||||
// tests
|
||||
|
||||
void test_seek_tests() {
|
||||
void test_seek_tests()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -99,7 +115,8 @@ void test_seek_tests() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_dir_seek() {
|
||||
void test_simple_dir_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -168,7 +185,8 @@ void test_simple_dir_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_dir_seek() {
|
||||
void test_large_dir_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -237,7 +255,8 @@ void test_large_dir_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_seek() {
|
||||
void test_simple_file_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -301,7 +320,8 @@ void test_simple_file_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_seek() {
|
||||
void test_large_file_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -365,7 +385,8 @@ void test_large_file_seek() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_simple_file_seek_and_write() {
|
||||
void test_simple_file_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -429,7 +450,8 @@ void test_simple_file_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_large_file_seek_and_write() {
|
||||
void test_large_file_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -495,7 +517,8 @@ void test_large_file_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_boundary_seek_and_write() {
|
||||
void test_boundary_seek_and_write()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -540,7 +563,8 @@ void test_boundary_seek_and_write() {
|
|||
TEST_ASSERT_EQUAL(0, res);
|
||||
}
|
||||
|
||||
void test_out_of_bounds_seek() {
|
||||
void test_out_of_bounds_seek()
|
||||
{
|
||||
int res = bd.init();
|
||||
TEST_ASSERT_EQUAL(0, res);
|
||||
|
||||
|
@ -591,7 +615,8 @@ void test_out_of_bounds_seek() {
|
|||
|
||||
|
||||
// test setup
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases) {
|
||||
utest::v1::status_t test_setup(const size_t number_of_cases)
|
||||
{
|
||||
GREENTEA_SETUP(MBED_TEST_TIMEOUT, "default_auto");
|
||||
return verbose_test_setup_handler(number_of_cases);
|
||||
}
|
||||
|
@ -610,6 +635,7 @@ Case cases[] = {
|
|||
|
||||
Specification specification(test_setup, cases);
|
||||
|
||||
int main() {
|
||||
int main()
|
||||
{
|
||||
return !Harness::run(specification);
|
||||
}
|
||||
|
|
|
@ -223,11 +223,11 @@ static bool perform_file_rename(FileSystem *fs)
|
|||
|
||||
struct stat st;
|
||||
int res = fs->stat(FILE_RENAME_A, &st);
|
||||
const char *src = (0 == res) ? FILE_RENAME_A : FILE_RENAME_B;
|
||||
const char *dst = (0 == res) ? FILE_RENAME_B : FILE_RENAME_A;
|
||||
const char *src = (res == 0) ? FILE_RENAME_A : FILE_RENAME_B;
|
||||
const char *dst = (res == 0) ? FILE_RENAME_B : FILE_RENAME_A;
|
||||
|
||||
DEBUG(" stat result %i\n", res);
|
||||
TEST_ASSERT_OR_EXIT((res == -ENOENT) || (0 == res));
|
||||
TEST_ASSERT_OR_EXIT((res == -ENOENT) || (res == 0));
|
||||
|
||||
DEBUG(" Renaming %s to %s\n", src, dst);
|
||||
res = fs->rename(src, dst);
|
||||
|
@ -258,7 +258,7 @@ static void check_file_rename(FileSystem *fs)
|
|||
|
||||
for (int i = 0; i < 2; i++) {
|
||||
File file;
|
||||
if (0 == file.open(fs, filenames[i], O_RDONLY)) {
|
||||
if (file.open(fs, filenames[i], O_RDONLY) == 0) {
|
||||
uint8_t buf[BUFFER_SIZE];
|
||||
files++;
|
||||
memset(buf, 0, sizeof(buf));
|
||||
|
@ -409,11 +409,11 @@ static bool perform_directory_rename(FileSystem *fs)
|
|||
|
||||
struct stat st;
|
||||
int res = fs->stat(DIRECTORY_RENAME_A, &st);
|
||||
const char *src = (0 == res) ? DIRECTORY_RENAME_A : DIRECTORY_RENAME_B;
|
||||
const char *dst = (0 == res) ? DIRECTORY_RENAME_B : DIRECTORY_RENAME_A;
|
||||
const char *src = (res == 0) ? DIRECTORY_RENAME_A : DIRECTORY_RENAME_B;
|
||||
const char *dst = (res == 0) ? DIRECTORY_RENAME_B : DIRECTORY_RENAME_A;
|
||||
|
||||
DEBUG(" stat result %i\n", res);
|
||||
TEST_ASSERT_OR_EXIT((res == -ENOENT) || (0 == res));
|
||||
TEST_ASSERT_OR_EXIT((res == -ENOENT) || (res == 0));
|
||||
|
||||
DEBUG(" Renaming %s to %s\n", src, dst);
|
||||
res = fs->rename(src, dst);
|
||||
|
@ -444,8 +444,8 @@ static void check_directory_rename(FileSystem *fs)
|
|||
for (size_t i = 0; i < ARRAY_LENGTH(directory_names); i++) {
|
||||
Dir dir;
|
||||
int res = dir.open(fs, directory_names[i]);
|
||||
TEST_ASSERT_OR_EXIT((-ENOENT == res) || (0 == res));
|
||||
if (0 == res) {
|
||||
TEST_ASSERT_OR_EXIT((res == -ENOENT) || (res == 0));
|
||||
if (res == 0) {
|
||||
directories++;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue