ref: d5cb40f453a0fd873dbcee924d120a0e683ffef2
parent: 0e812379de04940b434165da07466980d46b4d65
author: gkostka <[email protected]>
date: Sun Oct 18 18:26:56 EDT 2015
Improve generic & stm32f4 demos 1. test_lwext4_file_test parameter list change 2. Update generic demo help & readme (short & long parameters) 3. Update readme.mediawiki
--- a/blockdev/test_lwext4.c
+++ b/blockdev/test_lwext4.c
@@ -34,12 +34,6 @@
#include "test_lwext4.h"
-/**@brief Read-write size*/
-#define READ_MAX_WRITE_SZIZE 1024 * 16
-
-/**@brief File read/write buffer*/
-static uint8_t rw_buff[READ_MAX_WRITE_SZIZE];
-
/**@brief Block device handle.*/
static struct ext4_blockdev *bd;
@@ -219,7 +213,7 @@
return 0;
}
-bool test_lwext4_file_test(uint32_t rw_size, uint32_t rw_count)
+bool test_lwext4_file_test(uint8_t *rw_buff, uint32_t rw_size, uint32_t rw_count)
{
int r;
size_t size;
@@ -231,9 +225,6 @@
uint64_t size_bytes;
ext4_file f;
-
- if (rw_size > READ_MAX_WRITE_SZIZE)
- return false;
printf("file_test:\n");
printf(" rw size: %" PRIu32 "\n", rw_size);
--- a/blockdev/test_lwext4.h
+++ b/blockdev/test_lwext4.h
@@ -36,7 +36,7 @@
void test_lwext4_mp_stats(void);
void test_lwext4_block_stats(void);
bool test_lwext4_dir_test(int len);
-bool test_lwext4_file_test(uint32_t rw_szie, uint32_t rw_count);
+bool test_lwext4_file_test(uint8_t *rw_buff, uint32_t rw_size, uint32_t rw_count);
void test_lwext4_cleanup(void);
bool test_lwext4_mount(struct ext4_blockdev *bdev, struct ext4_bcache *bcache);
--- a/demos/generic/generic.c
+++ b/demos/generic/generic.c
@@ -73,12 +73,6 @@
/**@brief Indicates that input is windows partition.*/
static bool winpart = false;
-/**@brief File write buffer*/
-static uint8_t *wr_buff;
-
-/**@brief File read buffer.*/
-static uint8_t *rd_buff;
-
/**@brief Block device handle.*/
static struct ext4_blockdev *bd;
@@ -92,15 +86,15 @@
Welcome in ext4 generic demo. \n\
Copyright (c) 2013 Grzegorz Kostka ([email protected]) \n\
Usage: \n\
- --i - input file (default = ext2) \n\
- --rws - single R/W size (default = 1024 * 1024) \n\
- --rwc - R/W count (default = 10) \n\
- --cache - 0 static, 1 dynamic (default = 1) \n\
- --dirs - directory test count (default = 0) \n\
- --clean - clean up after test \n\
- --bstat - block device stats \n\
- --sbstat - superblock stats \n\
- --wpart - windows partition mode \n\
+[-i] --input - input file (default = ext2) \n\
+[-w] --rw_size - single R/W size (default = 1024 * 1024) \n\
+[-c] --rw_count - R/W count (default = 10) \n\
+[-a] --cache - 0 static, 1 dynamic (default = 1) \n\
+[-d] --dirs - directory test count (default = 0) \n\
+[-l] --clean - clean up after test \n\
+[-b] --bstat - block device stats \n\
+[-t] --sbstat - superblock stats \n\
+[-w] --wpart - windows partition mode \n\
\n";
void io_timings_clear(void)
@@ -161,46 +155,46 @@
int c;
static struct option long_options[] = {
- {"in", required_argument, 0, 'a'},
- {"rws", required_argument, 0, 'b'},
- {"rwc", required_argument, 0, 'c'},
- {"cache", required_argument, 0, 'd'},
- {"dirs", required_argument, 0, 'e'},
- {"clean", no_argument, 0, 'f'},
- {"bstat", no_argument, 0, 'g'},
- {"sbstat", no_argument, 0, 'h'},
- {"wpart", no_argument, 0, 'i'},
+ {"input", required_argument, 0, 'i'},
+ {"rw_size", required_argument, 0, 's'},
+ {"rw_count", required_argument, 0, 'c'},
+ {"cache", required_argument, 0, 'a'},
+ {"dirs", required_argument, 0, 'd'},
+ {"clean", no_argument, 0, 'l'},
+ {"bstat", no_argument, 0, 'b'},
+ {"sbstat", no_argument, 0, 't'},
+ {"wpart", no_argument, 0, 'w'},
{0, 0, 0, 0}};
- while (-1 != (c = getopt_long(argc, argv, "a:b:c:d:e:fghi",
+ while (-1 != (c = getopt_long(argc, argv, "i:s:c:q:d:lbtw",
long_options, &option_index))) {
switch (c) {
- case 'a':
+ case 'i':
strcpy(input_name, optarg);
break;
- case 'b':
+ case 's':
rw_szie = atoi(optarg);
break;
case 'c':
rw_count = atoi(optarg);
break;
- case 'd':
+ case 'a':
cache_mode = atoi(optarg);
break;
- case 'e':
+ case 'd':
dir_cnt = atoi(optarg);
break;
- case 'f':
+ case 'l':
cleanup_flag = true;
break;
- case 'g':
+ case 'b':
bstat = true;
break;
- case 'h':
+ case 't':
sbstat = true;
break;
- case 'i':
+ case 'w':
winpart = true;
break;
default:
@@ -245,7 +239,10 @@
return EXIT_FAILURE;
fflush(stdout);
- if (!test_lwext4_file_test(rw_count, rw_szie))
+ uint8_t *rw_buff = malloc(rw_szie);
+ if (!rw_buff)
+ return EXIT_FAILURE;
+ if (!test_lwext4_file_test(rw_buff, rw_szie, rw_count))
return EXIT_FAILURE;
fflush(stdout);
--- a/demos/stm32f429_disco/main.c
+++ b/demos/stm32f429_disco/main.c
@@ -55,6 +55,9 @@
/**@brief Read-write size*/
static int rw_szie = READ_WRITE_SZIZE;
+/**@brief Read-write buffer*/
+static uint8_t rw_buff[READ_WRITE_SZIZE];
+
/**@brief Read-write size*/
static int rw_count = 100;
@@ -136,7 +139,7 @@
return EXIT_FAILURE;
tim_wait_ms(TEST_DELAY_MS);
- if (!test_lwext4_file_test(rw_szie, rw_count))
+ if (!test_lwext4_file_test(rw_buff, rw_szie, rw_count))
return EXIT_FAILURE;
if (sbstat) {
--- a/readme.mediawiki
+++ b/readme.mediawiki
@@ -141,18 +141,7 @@
Linux block devices:
cd build_generic
- generic --in /dev/your_block_device
-
-Usage:
- --i - input file (default = ext2)
- --rws - single R/W size (default = 1024 * 1024)
- --rwc - R/W count (default = 10)
- --cache - 0 static, 1 dynamic (default = 1)
- --dirs - directory test count (default = 0)
- --clean - clean up after test
- --bstat - block device stats
- --sbstat - superblock stats
- --wpart - windows partition mode
+ generic -i /dev/your_block_device
==Build and run automatic tests==
Build and run automatic tests