xref: /xnu-10002.1.13/tools/tests/perf_index/perfindex-iperf.c (revision 1031c584a5e37aff177559b9f69dbd3c8c3fd30a)
1 #include "perf_index.h"
2 #include "fail.h"
3 #include <stdio.h>
4 #include <stdlib.h>
5 
6 DECL_SETUP {
7 	VERIFY(test_argc > 0, "missing argument");
8 
9 	return PERFINDEX_SUCCESS;
10 }
11 
12 DECL_TEST {
13 	char* cmd;
14 	int retval;
15 
16 	retval = asprintf(&cmd, "iperf -c \"%s\" -n %lld > /dev/null", test_argv[0], length);
17 	VERIFY(retval > 0, "asprintf failed");
18 
19 	retval = system(cmd);
20 	VERIFY(retval == 0, "iperf command failed");
21 
22 	return PERFINDEX_SUCCESS;
23 }
24