summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRyan Lim <limryan@google.com>2016-07-20 08:14:04 -0700
committerGreg Kroah-Hartman <gregkh@google.com>2016-07-20 11:23:03 -0700
commit346bae656e4e1a471771590f1f4e16e9f9332d1d (patch)
tree7e5a2d486c6ca4e39761ff0409ae54d2ef3f471e
parentbf32654a24441230fac32479b6a5ba8bbfc3b731 (diff)
greybus: loopback_test: Add -f argument to cancel all tests
To make sure tests on all devices, enabled or not, are cancelled, specify -f when starting new loopback test. Signed-off-by: Ryan Lim <limryan@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
-rw-r--r--drivers/staging/greybus/tools/loopback_test.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/drivers/staging/greybus/tools/loopback_test.c b/drivers/staging/greybus/tools/loopback_test.c
index 412e6dca0d08..f7f4cd6fb55b 100644
--- a/drivers/staging/greybus/tools/loopback_test.c
+++ b/drivers/staging/greybus/tools/loopback_test.c
@@ -91,6 +91,7 @@ struct loopback_test {
int async_outstanding_operations;
int us_wait;
int file_output;
+ int stop_all;
int poll_count;
char test_name[MAX_STR_LEN];
char sysfs_prefix[MAX_SYSFS_PATH];
@@ -207,6 +208,7 @@ void usage(void)
" -c Max number of outstanding operations for async operations\n"
" -w Wait in uSec between operations\n"
" -z Enable output to a CSV file (incompatible with -p)\n"
+ " -f When starting new loopback test, stop currently running tests on all devices\n"
"Examples:\n"
" Send 10000 transfers with a packet size of 128 bytes to all active connections\n"
" loopback_test -t transfer -s 128 -i 10000 -S /sys/bus/greybus/devices/ -D /sys/kernel/debug/gb_loopback/\n"
@@ -778,9 +780,11 @@ static void prepare_devices(struct loopback_test *t)
{
int i;
- /* Cancel any running tests */
+ /* Cancel any running tests on enabled devices. If
+ * stop_all option is given, stop test on all devices.
+ */
for (i = 0; i < t->device_count; i++)
- if (device_enabled(t, i))
+ if (t->stop_all || device_enabled(t, i))
write_sysfs_val(t->devices[i].sysfs_entry, "type", 0);
@@ -901,7 +905,7 @@ int main(int argc, char *argv[])
memset(&t, 0, sizeof(t));
while ((o = getopt(argc, argv,
- "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::")) != -1) {
+ "t:s:i:S:D:m:v::d::r::p::a::l::x::o:O:c:w:z::f::")) != -1) {
switch (o) {
case 't':
snprintf(t.test_name, MAX_STR_LEN, "%s", optarg);
@@ -957,6 +961,9 @@ int main(int argc, char *argv[])
case 'z':
t.file_output = 1;
break;
+ case 'f':
+ t.stop_all = 1;
+ break;
default:
usage();
return -EINVAL;