Changeset dd36558 in mainline
- Timestamp:
- 2017-12-21T10:26:47Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 5302493
- Parents:
- d0d8e59
- git-author:
- Petr Mánek <petr.manek@…> (2017-12-21 10:26:43)
- git-committer:
- Petr Mánek <petr.manek@…> (2017-12-21 10:26:47)
- Location:
- uspace/app/tmon
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/tmon/Makefile
rd0d8e59 rdd36558 36 36 list.c\ 37 37 test.c\ 38 stress_test.c\ 38 39 resolve.c 39 40 -
uspace/app/tmon/test.c
rd0d8e59 rdd36558 32 32 /** 33 33 * @file 34 * USB transfer debugging.34 * Testing framework. 35 35 */ 36 36 … … 39 39 #include <str_error.h> 40 40 #include <usbdiag_iface.h> 41 #include "commands.h"42 41 #include "resolve.h" 42 #include "test.h" 43 43 44 44 #define NAME "tmon" 45 45 #define MAX_PATH_LENGTH 1024 46 46 47 #define DEFAULT_CYCLES 1024 48 #define DEFAULT_SIZE 65432 49 50 static int resolve_and_test(int argc, char *argv[], int (*test)(async_exch_t *, int, size_t)) { 47 int tmon_test_main(int argc, char *argv[], const tmon_test_ops_t *ops) { 51 48 devman_handle_t fun = -1; 52 49 … … 71 68 printf("Using device: %s\n", path); 72 69 73 // TODO: Read options here. 70 tmon_test_params_t *params = NULL; 71 if ((rc = ops->read_params(argc, argv, ¶ms))) { 72 printf(NAME ": Reading test parameters failed.\n"); 73 return 1; 74 } 74 75 75 76 async_sess_t *sess = usbdiag_connect(fun); … … 86 87 } 87 88 88 ec = test(exch, DEFAULT_CYCLES, DEFAULT_SIZE);89 ec = ops->run(exch, params); 89 90 async_exchange_end(exch); 90 91 91 92 err_sess: 92 93 usbdiag_disconnect(sess); 94 free(params); 93 95 return ec; 94 }95 96 static int stress_intr_in(async_exch_t *exch, int cycles, size_t size)97 {98 printf("Executing interrupt in stress test.\n"99 " Packet count: %d\n"100 " Packet size: %ld\n", cycles, size);101 102 int rc = usbdiag_stress_intr_in(exch, cycles, size);103 if (rc) {104 printf(NAME ": %s\n", str_error(rc));105 return 1;106 }107 108 return 0;109 }110 111 static int stress_intr_out(async_exch_t *exch, int cycles, size_t size)112 {113 printf("Executing interrupt out stress test.\n"114 " Packet count: %d\n"115 " Packet size: %ld\n", cycles, size);116 117 int rc = usbdiag_stress_intr_out(exch, cycles, size);118 if (rc) {119 printf(NAME ": %s\n", str_error(rc));120 return 1;121 }122 123 return 0;124 }125 126 static int stress_bulk_in(async_exch_t *exch, int cycles, size_t size)127 {128 printf("Executing bulk in stress test.\n"129 " Packet count: %d\n"130 " Packet size: %ld\n", cycles, size);131 132 int rc = usbdiag_stress_bulk_in(exch, cycles, size);133 if (rc) {134 printf(NAME ": %s\n", str_error(rc));135 return 1;136 }137 138 return 0;139 }140 141 static int stress_bulk_out(async_exch_t *exch, int cycles, size_t size)142 {143 printf("Executing bulk out stress test.\n"144 " Packet count: %d\n"145 " Packet size: %ld\n", cycles, size);146 147 int rc = usbdiag_stress_bulk_out(exch, cycles, size);148 if (rc) {149 printf(NAME ": %s\n", str_error(rc));150 return 1;151 }152 153 return 0;154 }155 156 int tmon_stress_intr_in(int argc, char *argv[])157 {158 return resolve_and_test(argc, argv, stress_intr_in);159 }160 161 int tmon_stress_intr_out(int argc, char *argv[])162 {163 return resolve_and_test(argc, argv, stress_intr_out);164 }165 166 int tmon_stress_bulk_in(int argc, char *argv[])167 {168 return resolve_and_test(argc, argv, stress_bulk_in);169 }170 171 int tmon_stress_bulk_out(int argc, char *argv[])172 {173 return resolve_and_test(argc, argv, stress_bulk_out);174 96 } 175 97
Note:
See TracChangeset
for help on using the changeset viewer.