mirror of https://github.com/gkostka/lwext4.git
gkostka
11 years ago
16 changed files with 1814 additions and 115 deletions
@ -0,0 +1,9 @@ |
|||
include_directories(blockdev/filedev) |
|||
include_directories(blockdev/filedev_win) |
|||
|
|||
aux_source_directory(blockdev/filedev GENERIC_SRC) |
|||
aux_source_directory(blockdev/filedev_win GENERIC_SRC) |
|||
aux_source_directory(demos/generic GENERIC_SRC) |
|||
|
|||
add_executable(fileimage_demo ${GENERIC_SRC}) |
|||
target_link_libraries(fileimage_demo lwext4) |
@ -0,0 +1,38 @@ |
|||
#Discoery disco demo |
|||
enable_language(ASM) |
|||
set (STM32F429_DEMO_ASM |
|||
demos/stm32f429_disco/startup.S |
|||
) |
|||
|
|||
|
|||
include_directories(demos/stm32f429_disco) |
|||
include_directories(demos/stm32f429_disco/cmsis) |
|||
include_directories(demos/stm32f429_disco/stm/lcd_utils) |
|||
include_directories(demos/stm32f429_disco/stm/stm32f4_spl/inc) |
|||
include_directories(demos/stm32f429_disco/stm/stm32f429) |
|||
include_directories(demos/stm32f429_disco/stm/usb_dev/Core/inc) |
|||
include_directories(demos/stm32f429_disco/stm/usb_host/Core/inc) |
|||
include_directories(demos/stm32f429_disco/stm/usb_host/Class/MSC/inc) |
|||
include_directories(demos/stm32f429_disco/stm/usb_otg/inc) |
|||
include_directories(demos/stm32f429_disco/stm/usb_user) |
|||
|
|||
aux_source_directory(demos/stm32f429_disco STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/cmsis STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/lcd_utils STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/stm32f4_spl/src STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/stm32f429 STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/usb_host/Core/src STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/usb_host/Class/MSC/src STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/usb_otg/src STM32F429_DEMO) |
|||
aux_source_directory(demos/stm32f429_disco/stm/usb_user STM32F429_DEMO) |
|||
|
|||
add_executable(stm324f29_demo ${STM32F429_DEMO} ${STM32F429_DEMO_ASM}) |
|||
|
|||
set_target_properties(stm324f29_demo PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter") |
|||
set_target_properties(stm324f29_demo PROPERTIES COMPILE_FLAGS "-Wno-format") |
|||
set_target_properties(stm324f29_demo PROPERTIES COMPILE_DEFINITIONS "STM32F429_439xx") |
|||
|
|||
set_target_properties(stm324f29_demo PROPERTIES LINK_FLAGS "-T${CMAKE_SOURCE_DIR}/demos/stm32f429_disco/stm32f429.ld") |
|||
target_link_libraries(stm324f29_demo lwext4) |
|||
|
|||
add_custom_target(stm32f429_size ALL DEPENDS stm324f29_demo COMMAND ${SIZE} -B stm324f29_demo) |
@ -0,0 +1,421 @@ |
|||
|
|||
|
|||
LWEXT4_CLIENT = @build_generic\\lwext4_client |
|||
|
|||
TEST_DIR = /test |
|||
|
|||
t0: |
|||
@echo "T0: Device regoster test:" |
|||
$(LWEXT4_CLIENT) -c "device_register 0 0 bdev" |
|||
|
|||
t1: |
|||
@echo "T1: Single mount-umount test:" |
|||
$(LWEXT4_CLIENT) -c "device_register 0 0 bdev" |
|||
$(LWEXT4_CLIENT) -c "mount bdev /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t2: |
|||
@echo "T2: Multiple mount-umount test:" |
|||
$(LWEXT4_CLIENT) -c "device_register 0 0 bdev" |
|||
$(LWEXT4_CLIENT) -c "mount bdev /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
$(LWEXT4_CLIENT) -c "mount bdev /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
$(LWEXT4_CLIENT) -c "mount bdev /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t3: |
|||
@echo "T3: Test dir create/remove:" |
|||
$(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 "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 0" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
|
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t4: |
|||
@echo "T4: 10 files create + write + read + remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 10" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 10 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 10 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 10" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_fremove $(TEST_DIR) /f 10" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t5: |
|||
@echo "T5: 100 files create + write + read + remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 100" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 100 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 100 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 100" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_fremove $(TEST_DIR) /f 100" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t6: |
|||
@echo "T6: 1000 files create + write + read + remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 1000" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 1000 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 1000 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_fremove $(TEST_DIR) /f 1000" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t7: |
|||
@echo "T7: 10 dirs create + remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 10" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 10" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_dremove $(TEST_DIR) /d 10" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t8: |
|||
@echo "T8: 100 dirs create + remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 100" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 100" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_dremove $(TEST_DIR) /d 100" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t9: |
|||
@echo "T9: 1000 dirs create + remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
$(LWEXT4_CLIENT) -c "multi_dremove $(TEST_DIR) /d 1000" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t10: |
|||
@echo "T10: 10 entries (dir) dir recursive remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 10" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 10" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t11: |
|||
@echo "T11: 100 entries (dir) dir recursive remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 100" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 100" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t12: |
|||
@echo "T12: 1000 entries (dir) dir recursive remove:" |
|||
$(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 "multi_dcreate $(TEST_DIR) /d 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t13: |
|||
@echo "T13: 10 entries (files) dir recursive remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 10" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 10 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 10 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 10" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t14: |
|||
@echo "T14: 100 entries (files) dir recursive remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 100" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 100 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 100 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 100" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t15: |
|||
@echo "T15: 1000 entries (files) dir recursive remove:" |
|||
$(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 "multi_fcreate $(TEST_DIR) /f 1000" |
|||
$(LWEXT4_CLIENT) -c "multi_fwrite $(TEST_DIR) /f 1000 1024" |
|||
$(LWEXT4_CLIENT) -c "multi_fread $(TEST_DIR) /f 1000 1024" |
|||
$(LWEXT4_CLIENT) -c "dir_open 0 $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "dir_entry_get 0 1000" |
|||
$(LWEXT4_CLIENT) -c "dir_close 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
|
|||
t16: |
|||
@echo "T16: 8kB 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 8192 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 8192" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 8192" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fseek 0 0 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 0" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 8192" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fread 0 0 8192 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 8192" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 8192" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fclose 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t17: |
|||
@echo "T17: 64kB 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 65536 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 65536" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 65536" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fseek 0 0 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 0" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 65536" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fread 0 0 65536 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 65536" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 65536" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fclose 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t18: |
|||
@echo "T18: 512kB 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 524288 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 524288" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 524288" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fseek 0 0 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 0" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 524288" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fread 0 0 524288 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 524288" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 524288" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fclose 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t19: |
|||
@echo "T19: 4MB 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 4194304 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 4194304" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 4194304" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fseek 0 0 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 0" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 4194304" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fread 0 0 4194304 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 4194304" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 4194304" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fclose 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
t20: |
|||
@echo "T10: 32MB 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 33554432 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 33554432" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 33554432" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fseek 0 0 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 0" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 33554432" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fread 0 0 33554432 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "ftell 0 33554432" |
|||
$(LWEXT4_CLIENT) -c "fsize 0 33554432" |
|||
|
|||
$(LWEXT4_CLIENT) -c "fclose 0" |
|||
|
|||
$(LWEXT4_CLIENT) -c "dir_rm $(TEST_DIR)" |
|||
$(LWEXT4_CLIENT) -c "stats_check /" |
|||
$(LWEXT4_CLIENT) -c "umount /" |
|||
|
|||
|
|||
|
|||
all_tests: t0 t1 t2 t3 t4 t5 t6 t7 t8 t9 t10 t11 t12 t13 t14 t15 t16 t17 t18 t19 t20 |
@ -0,0 +1,14 @@ |
|||
include_directories(blockdev/filedev) |
|||
include_directories(blockdev/filedev_win) |
|||
|
|||
aux_source_directory(blockdev/filedev BLOCKDEV_SRC) |
|||
aux_source_directory(blockdev/filedev_win BLOCKDEV_SRC) |
|||
|
|||
|
|||
add_executable(lwext4_server fs_test/lwext4_server.c ${BLOCKDEV_SRC}) |
|||
target_link_libraries(lwext4_server lwext4) |
|||
target_link_libraries(lwext4_server ws2_32) |
|||
|
|||
add_executable(lwext4_client fs_test/lwext4_client.c ${BLOCKDEV_SRC}) |
|||
target_link_libraries(lwext4_client lwext4) |
|||
target_link_libraries(lwext4_client ws2_32) |
@ -0,0 +1,194 @@ |
|||
#include <stdio.h> |
|||
#include <string.h> |
|||
#include <stdlib.h> |
|||
#include <unistd.h> |
|||
#include <errno.h> |
|||
#include <stdbool.h> |
|||
#include <getopt.h> |
|||
|
|||
#ifdef WIN32 |
|||
#include <windows.h> |
|||
#include <winsock2.h> |
|||
#include <ws2tcpip.h> |
|||
|
|||
static int inet_pton(int af, const char *src, void *dst); |
|||
|
|||
#else |
|||
#include <sys/socket.h> |
|||
#include <netinet/in.h> |
|||
#include <arpa/inet.h> |
|||
#include <sys/types.h> |
|||
#endif |
|||
|
|||
static int winsock_init(void); |
|||
static void winsock_fini(void); |
|||
|
|||
/**@brief Default server addres.*/ |
|||
static char *server_addr = "127.0.0.1"; |
|||
|
|||
/**@brief Default connection port.*/ |
|||
static int connection_port = 8888; |
|||
|
|||
/**@brief Call op*/ |
|||
static char *op_code; |
|||
|
|||
static const char *usage = " \n\
|
|||
Welcome in lwext4_client. \n\ |
|||
Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) \n\ |
|||
Usage: \n\ |
|||
--call (-c) - call opt \n\ |
|||
--port (-p) - server port \n\ |
|||
--addr (-a) - server ip address \n\ |
|||
\n"; |
|||
|
|||
|
|||
|
|||
static int client_connect(void) |
|||
{ |
|||
int fd = 0; |
|||
struct sockaddr_in serv_addr; |
|||
|
|||
if(winsock_init() < 0) { |
|||
printf("winsock_init error\n"); |
|||
exit(-1); |
|||
} |
|||
|
|||
memset(&serv_addr, '0', sizeof(serv_addr)); |
|||
fd = socket(AF_INET, SOCK_STREAM, 0); |
|||
if(fd < 0) { |
|||
printf("socket() error: %s\n", strerror(errno)); |
|||
exit(-1); |
|||
} |
|||
|
|||
serv_addr.sin_family = AF_INET; |
|||
serv_addr.sin_port = htons(connection_port); |
|||
|
|||
if(!inet_pton(AF_INET, server_addr, &serv_addr.sin_addr)){ |
|||
printf("inet_pton() error\n"); |
|||
exit(-1); |
|||
} |
|||
|
|||
if(connect(fd, (struct sockaddr *)&serv_addr, sizeof(serv_addr))){ |
|||
printf("connect() error: %s\n", strerror(errno)); |
|||
exit(-1); |
|||
} |
|||
|
|||
return fd; |
|||
} |
|||
|
|||
|
|||
|
|||
static bool parse_opt(int argc, char **argv) |
|||
{ |
|||
int option_index = 0; |
|||
int c; |
|||
|
|||
static struct option long_options[] = |
|||
{ |
|||
{"call", required_argument, 0, 'c'}, |
|||
{"port", required_argument, 0, 'p'}, |
|||
{"addr", required_argument, 0, 'a'}, |
|||
{0, 0, 0, 0} |
|||
}; |
|||
|
|||
while(-1 != (c = getopt_long (argc, argv, "c:p:a:", long_options, &option_index))) { |
|||
|
|||
switch(c){ |
|||
case 'a': |
|||
server_addr = optarg; |
|||
break; |
|||
case 'p': |
|||
connection_port = atoi(optarg); |
|||
break; |
|||
case 'c': |
|||
op_code = optarg; |
|||
break; |
|||
default: |
|||
printf("%s", usage); |
|||
return false; |
|||
|
|||
} |
|||
} |
|||
return true; |
|||
} |
|||
|
|||
|
|||
int main(int argc, char *argv[]) |
|||
{ |
|||
int sockfd; |
|||
int n; |
|||
int rc; |
|||
char recvBuff[1024]; |
|||
|
|||
if(!parse_opt(argc, argv)) |
|||
return -1; |
|||
|
|||
sockfd = client_connect(); |
|||
|
|||
|
|||
n = send(sockfd, op_code, strlen(op_code), 0); |
|||
if(n < 0) { |
|||
printf("\tWrite error: %s fd = %d\n", strerror(errno), sockfd); |
|||
return -1; |
|||
} |
|||
|
|||
n = recv(sockfd, (void *)&rc, sizeof(rc), 0); |
|||
if(n < 0) { |
|||
printf("\tWrite error: %s fd = %d\n", strerror(errno), sockfd); |
|||
return -1; |
|||
} |
|||
|
|||
printf("rc: %d %s\n", rc, strerror(rc)); |
|||
if(rc) |
|||
printf("\t%s\n",op_code); |
|||
|
|||
closesocket(sockfd); |
|||
return rc; |
|||
} |
|||
|
|||
static int winsock_init(void) |
|||
{ |
|||
#if WIN32 |
|||
int rc; |
|||
static WSADATA wsaData; |
|||
rc = WSAStartup(MAKEWORD(2,2), &wsaData); |
|||
if (rc != 0) { |
|||
return -1; |
|||
} |
|||
#endif |
|||
return 0; |
|||
} |
|||
|
|||
static void winsock_fini(void) |
|||
{ |
|||
#if WIN32 |
|||
WSACleanup(); |
|||
#endif |
|||
} |
|||
|
|||
|
|||
#if WIN32 |
|||
static int inet_pton(int af, const char *src, void *dst) |
|||
{ |
|||
struct sockaddr_storage ss; |
|||
int size = sizeof(ss); |
|||
char src_copy[INET6_ADDRSTRLEN+1]; |
|||
|
|||
ZeroMemory(&ss, sizeof(ss)); |
|||
/* stupid non-const API */ |
|||
strncpy (src_copy, src, INET6_ADDRSTRLEN+1); |
|||
src_copy[INET6_ADDRSTRLEN] = 0; |
|||
|
|||
if (WSAStringToAddress(src_copy, af, NULL, (struct sockaddr *)&ss, &size) == 0) { |
|||
switch(af) { |
|||
case AF_INET: |
|||
*(struct in_addr *)dst = ((struct sockaddr_in *)&ss)->sin_addr; |
|||
return 1; |
|||
case AF_INET6: |
|||
*(struct in6_addr *)dst = ((struct sockaddr_in6 *)&ss)->sin6_addr; |
|||
return 1; |
|||
} |
|||
} |
|||
return 0; |
|||
} |
|||
#endif |
File diff suppressed because it is too large
Loading…
Reference in new issue