diff options
author | Florin Coras <fcoras@cisco.com> | 2018-09-04 22:07:27 -0700 |
---|---|---|
committer | Marco Varlese <marco.varlese@suse.de> | 2018-09-07 09:36:00 +0000 |
commit | 6d4bb42540768a94abd70d37da6716341a515c40 (patch) | |
tree | 0e12d555d8121a33acffa106ae2f0f61f74411ee /src/vcl/vcl_test.h | |
parent | 49ca2601114a8a29520cba5f0ab3ea1dc1968f7f (diff) |
vcl: refactor test client to support workers
Change-Id: I7fcfddc2bc7d9a64f8aa0d57ba5d11d325a15ce1
Signed-off-by: Florin Coras <fcoras@cisco.com>
Diffstat (limited to 'src/vcl/vcl_test.h')
-rw-r--r-- | src/vcl/vcl_test.h | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/vcl/vcl_test.h b/src/vcl/vcl_test.h index bdfb89c08a2..8808c0f5c5e 100644 --- a/src/vcl/vcl_test.h +++ b/src/vcl/vcl_test.h @@ -23,6 +23,29 @@ #include <vcl/vppcom.h> #include <vcl/sock_test_common.h> +#define vtfail(_fn, _rv) \ +{ \ + errno = -_rv; \ + perror ("ERROR when calling " _fn); \ + fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \ + exit (1); \ +} + +#define vterr(_fn, _rv) \ +{ \ + errno = -_rv; \ + fprintf (stderr, "\nERROR: " _fn " failed (errno = %d)!\n", -_rv); \ +} + +#define vtwrn(_fmt, _args...) \ + fprintf (stderr, "\nERROR: " _fmt "\n", ##_args) \ + +#define vtinf(_fmt, _args...) \ + fprintf (stdout, "vt<w%u>: " _fmt "\n", __wrk_index, ##_args) + +#define vt_atomic_add(_ptr, _val) \ + __atomic_fetch_add (_ptr, _val, __ATOMIC_RELEASE) + static inline int vcl_test_read (int fd, uint8_t *buf, uint32_t nbytes, sock_test_stats_t *stats) |