Browse Source

Add new tests (large files tests).

Server mount in write back mode.
pull/1/head
gkostka 11 years ago
parent
commit
34dd733043
  1. 68
      fs_test.mk
  2. 26
      fs_test/lwext4_server.c

68
fs_test.mk

@ -426,6 +426,74 @@ t20:
$(LWEXT4_CLIENT) -c "stats_check /"
$(LWEXT4_CLIENT) -c "umount /"
t21:
@echo "T21: 128MB file write/read:"
$(LWEXT4_CLIENT) -c "device_register 0 0 bdev"
$(LWEXT4_CLIENT) -c "mount bdev /"
$(LWEXT4_CLIENT) -c "stats_save /"
$(LWEXT4_CLIENT) -c "dir_mk $(TEST_DIR)"
$(LWEXT4_CLIENT) -c "fopen 0 $(TEST_DIR)/test.txt wb+"
$(LWEXT4_CLIENT) -c "ftell 0 0"
$(LWEXT4_CLIENT) -c "fsize 0 0"
$(LWEXT4_CLIENT) -c "fwrite 0 0 134217728 0"
$(LWEXT4_CLIENT) -c "ftell 0 134217728"
$(LWEXT4_CLIENT) -c "fsize 0 134217728"
$(LWEXT4_CLIENT) -c "fseek 0 0 0"
$(LWEXT4_CLIENT) -c "ftell 0 0"
$(LWEXT4_CLIENT) -c "fsize 0 134217728"
$(LWEXT4_CLIENT) -c "fread 0 0 134217728 0"
$(LWEXT4_CLIENT) -c "ftell 0 134217728"
$(LWEXT4_CLIENT) -c "fsize 0 134217728"
$(LWEXT4_CLIENT) -c "fclose 0"
$(LWEXT4_CLIENT) -c "fremove $(TEST_DIR)/test.txt"
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)"
$(LWEXT4_CLIENT) -c "stats_check /"
$(LWEXT4_CLIENT) -c "umount /"
t22:
@echo "T22: 1GB file write/read:"
$(LWEXT4_CLIENT) -c "device_register 0 0 bdev"
$(LWEXT4_CLIENT) -c "mount bdev /"
$(LWEXT4_CLIENT) -c "stats_save /"
$(LWEXT4_CLIENT) -c "dir_mk $(TEST_DIR)"
$(LWEXT4_CLIENT) -c "fopen 0 $(TEST_DIR)/test.txt wb+"
$(LWEXT4_CLIENT) -c "ftell 0 0"
$(LWEXT4_CLIENT) -c "fsize 0 0"
$(LWEXT4_CLIENT) -c "fwrite 0 0 1073741824 0"
$(LWEXT4_CLIENT) -c "ftell 0 1073741824"
$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
$(LWEXT4_CLIENT) -c "fseek 0 0 0"
$(LWEXT4_CLIENT) -c "ftell 0 0"
$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
$(LWEXT4_CLIENT) -c "fread 0 0 1073741824 0"
$(LWEXT4_CLIENT) -c "ftell 0 1073741824"
$(LWEXT4_CLIENT) -c "fsize 0 1073741824"
$(LWEXT4_CLIENT) -c "fclose 0"
$(LWEXT4_CLIENT) -c "fremove $(TEST_DIR)/test.txt"
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)"
$(LWEXT4_CLIENT) -c "stats_check /"
$(LWEXT4_CLIENT) -c "umount /"
server_ext2:
$(LWEXT4_SERVER) -i ext_images/ext2

26
fs_test/lwext4_server.c

@ -52,6 +52,8 @@ static int winpart = 0;
/**@brief Blockdev handle*/
static struct ext4_blockdev *bd;
static int cache_wb = 0;
static char read_buffer[MAX_RW_BUFFER];
static char write_buffer[MAX_RW_BUFFER];
@ -60,10 +62,11 @@ static const char *usage = " \n\
Welcome in lwext4_server. \n\
Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) \n\
Usage: \n\
--image (-i) - ext2/3/4 image file \n\
--port (-p) - server port \n\
--verbose (-v) - verbose mode \n\
--winpart (-w) - windows_partition mode \n\
--image (-i) - ext2/3/4 image file \n\
--port (-p) - server port \n\
--verbose (-v) - verbose mode \n\
--winpart (-w) - windows_partition mode \n\
--cache_wb (-c) - cache writeback_mode \n\
\n";
@ -275,10 +278,11 @@ static bool parse_opt(int argc, char **argv)
{"port", required_argument, 0, 'p'},
{"verbose", required_argument, 0, 'v'},
{"winpart", required_argument, 0, 'w'},
{"cache_wb",required_argument, 0, 'c'},
{0, 0, 0, 0}
};
while(-1 != (c = getopt_long (argc, argv, "i:p:v:w:", long_options, &option_index))) {
while(-1 != (c = getopt_long (argc, argv, "i:p:v:w:c:", long_options, &option_index))) {
switch(c){
case 'i':
@ -290,8 +294,8 @@ static bool parse_opt(int argc, char **argv)
case 'v':
verbose = atoi(optarg);
break;
case 'w':
winpart = atoi(optarg);
case 'c':
cache_wb = atoi(optarg);
break;
default:
printf("%s", usage);
@ -383,7 +387,10 @@ int _mount(char *p)
return -1;
}
return ext4_mount(dev_name, mount_point);
rc = ext4_mount(dev_name, mount_point);
if(cache_wb)
ext4_cache_write_back(mount_point, 1);
return rc;
}
int _umount(char *p)
@ -395,6 +402,9 @@ int _umount(char *p)
return -1;
}
if(cache_wb)
ext4_cache_write_back(mount_point, 0);
return ext4_umount(mount_point);
}

Loading…
Cancel
Save