apache / nuttx-apps

Apache NuttX Apps is a collection of tools, shells, network utilities, libraries, interpreters and can be used with the NuttX RTOS
https://nuttx.apache.org/
Apache License 2.0
263 stars 488 forks source link

[sd_bench|sd_stress]: Compatible Sd Test Printing #2431

Closed Windrow14 closed 3 days ago

Windrow14 commented 4 days ago

Title

testing/[sd_bench|sd_stress]: Make Printing Compatible for Both 32-bit and 64-bit Environments.

Summary

Currently, on 64-bit environment, for example, qemu-armv8a, compilation of sd_bench and sd_stress are broken due to type errors.

testing/sd_bench/sd_bench_main.c: testing/sd_stress/sd_stress_main.c: size_t type should be printed with %zu instead of %u.

Impact

Bugs fixed.

Testing

Verify compilation with:

Run sdstress and sdbench test in virtual environment:

qemu-system-aarch64 \
-cpu cortex-a53 \
-smp 4 \
-nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on \
-serial chardev:con \
-global virtio-mmio.force-legacy=false \
-netdev user,id=u1,hostfwd=tcp:127.0.0.1:10023-10.0.2.15:23,hostfwd=tcp:127.0.0.1:15001-10.0.2.15:5001 \
-device virtio-net-device,netdev=u1,bus=virtio-mmio-bus.0 \
-drive file=/home/windrow/code/nuttx/2GB.img,format=raw,id=hd,if=none \
-device virtio-blk-device,bus=virtio-mmio-bus.1,drive=hd \
-mon chardev=con,mode=readline \
-kernel \
./nuttx

NuttShell (NSH)
nsh> 
nsh> mount -t vfat /dev/virtblk0 /mnt
nsh> sdstress
Start stress test with 64 files, 4096 bytes and 32 iterations.
iteration 0 took 190.000 ms: OK
iteration 1 took 190.000 ms: OK
iteration 2 took 180.000 ms: OK
iteration 3 took 180.000 ms: OK
iteration 4 took 170.000 ms: OK
iteration 5 took 180.000 ms: OK
iteration 6 took 190.000 ms: OK
iteration 7 took 180.000 ms: OK
iteration 8 took 180.000 ms: OK
iteration 9 took 170.000 ms: OK
iteration 10 took 170.000 ms: OK
iteration 11 took 180.000 ms: OK
iteration 12 took 180.000 ms: OK
iteration 13 took 180.000 ms: OK
iteration 14 took 170.000 ms: OK
iteration 15 took 180.000 ms: OK
iteration 16 took 180.000 ms: OK
iteration 17 took 200.000 ms: OK
iteration 18 took 180.000 ms: OK
iteration 19 took 170.000 ms: OK
iteration 20 took 180.000 ms: OK
iteration 21 took 170.000 ms: OK
iteration 22 took 180.000 ms: OK
iteration 23 took 170.000 ms: OK
iteration 24 took 170.000 ms: OK
iteration 25 took 180.000 ms: OK
iteration 26 took 170.000 ms: OK
iteration 27 took 170.000 ms: OK
iteration 28 took 180.000 ms: OK
iteration 29 took 170.000 ms: OK
iteration 30 took 170.000 ms: OK
iteration 31 took 170.000 ms: OK
Test OK: Average time: 177.500 ms
nsh> sdbench -k
Using block size = 512 bytes, sync = false

Testing Sequential Write Speed...
  Run  1:   2263.8 KB/s, max write time: 10.000 ms (50.0 KB/s), fsync: 0.000 ms
  Run  2:   2275.8 KB/s, max write time: 10.000 ms (50.0 KB/s), fsync: 0.000 ms
  Run  3:   2268.5 KB/s, max write time: 20.000 ms (25.0 KB/s), fsync: 0.000 ms
  Run  4:   2274.3 KB/s, max write time: 10.000 ms (50.0 KB/s), fsync: 0.000 ms
  Run  5:   2279.3 KB/s, max write time: 10.000 ms (50.0 KB/s), fsync: 0.000 ms
  Avg   :   2272.3 KB/s, 22.190 MB written.

Testing Sequential Read Speed...
  Run  1:  40576.8 KB/s, max read/verify time: 10.0000 ms (50.0 KB/s)
  Avg   :  40576.8 KB/s, 22.190 MB and verified
nsh> mount -t vfat /dev/virtblk0 /mnt
nsh> sdbench -b 2
Using block size = 8 bytes, sync = false

Testing Sequential Write Speed...
  Run  1:   1356.3 KB/s, max write time: 10.000 ms (0.8 KB/s), fsync: 0.000 ms
  Run  2:   1186.4 KB/s, max write time: 20.000 ms (0.4 KB/s), fsync: 0.000 ms
  Run  3:   1281.3 KB/s, max write time: 10.000 ms (0.8 KB/s), fsync: 0.000 ms
  Run  4:   1291.0 KB/s, max write time: 20.000 ms (0.4 KB/s), fsync: 0.000 ms
  Run  5:   1298.0 KB/s, max write time: 10.000 ms (0.8 KB/s), fsync: 0.000 ms
  Avg   :   1282.6 KB/s, 12.525 MB written.

Testing Sequential Read Speed...
  Run  1:  11555.0 KB/s, max read/verify time: 10.0000 ms (0.8 KB/s)
  Avg   :  11555.0 KB/s, 12.525 MB and verified
Windrow14 commented 4 days ago

@JackyCaoYJ