diff options
-rw-r--r-- | qa/test_api.c | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/qa/test_api.c b/qa/test_api.c index e7a8453..60c6520 100644 --- a/qa/test_api.c +++ b/qa/test_api.c @@ -34,6 +34,7 @@ int main(void) int ret, i; struct nf_conntrack *ct, *tmp; char data[32]; + const char *val; int status; /* initialize fake data for testing purposes */ @@ -76,6 +77,37 @@ int main(void) eval_sigterm(status); } + printf("== validate set API ==\n"); + ret = fork(); + if (ret == 0) { + for (i=0; i<ATTR_MAX; i++) { + data[0] = (uint8_t) i; + nfct_set_attr(ct, i, data); + val = nfct_get_attr(ct, i); + /* These attributes cannot be set, ignore them. */ + switch(i) { + case ATTR_ORIG_COUNTER_PACKETS: + case ATTR_REPL_COUNTER_PACKETS: + case ATTR_ORIG_COUNTER_BYTES: + case ATTR_REPL_COUNTER_BYTES: + case ATTR_USE: + case ATTR_SECCTX: + case ATTR_TIMESTAMP_START: + case ATTR_TIMESTAMP_STOP: + continue; + } + if (val[0] != data[0]) { + printf("ERROR: set/get operations don't match " + "for attribute %d (%x != %x)\n", + i, val[0], data[0]); + } + } + exit(0); + } else { + wait(&status); + eval_sigterm(status); + } + printf("== test copy API ==\n"); ret = fork(); if (ret == 0) { |