Re: [PATCH] tests: tests for libnftables

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10 November 2013 18:37, Ana Rey <anarey@xxxxxxxxx> wrote:

Hi Ana, What a nice work. Two small comments below.

> diff --git a/tests/nft-table-test.c b/tests/nft-table-test.c
> new file mode 100644
> index 0000000..ae7e2ac
> --- /dev/null
> +++ b/tests/nft-table-test.c
> @@ -0,0 +1,62 @@
> +#include <stdio.h>
> +#include <stdlib.h>
> +#include <string.h>
> +#include <netinet/in.h>
> +
> +#include <linux/netfilter/nf_tables.h>
> +#include <libnftables/table.h>
> +
> +static void die(const char *msg)
> +{
> +       printf("\033[31mERROR:\e[0m %s\n", msg);
> +       exit(EXIT_FAILURE);
> +}
> +
> +static void cmp_nft_table(struct nft_table *a, struct nft_table *b)
> +{
> +       if (strcmp(nft_table_attr_get_str(a, NFT_TABLE_ATTR_NAME),
> +                  nft_table_attr_get_str(b, NFT_TABLE_ATTR_NAME)) != 0)
> +               die("table name mismatches");
> +       if (nft_table_attr_get_u32(a, NFT_TABLE_ATTR_FLAGS) !=
> +           nft_table_attr_get_u32(b, NFT_TABLE_ATTR_FLAGS))
> +               die("table flags mismatches");
> +               /*TODO nft_table_attr_get_u8
> +                * nft_table_atrr_set
> +                * ## NFT_TABLE_ATTR_FAMILY is uint8_t */

I think multiline comment format is:
/* xxx
 * xxx
 */

> diff --git a/tests/test-script.sh b/tests/test-script.sh
> new file mode 100755
> index 0000000..5c475d5
> --- /dev/null
> +++ b/tests/test-script.sh
> @@ -0,0 +1,20 @@
> +./nft-chain-test
> +./nft-expr_bitwise-test
> +./nft-expr_byteorder-test
> +./nft-expr_cmp-test
> +./nft-expr_counter-test
> +./nft-expr_ct-test
> +./nft-expr_exthdr-test
> +./nft-expr_immediate-test
> +./nft-expr_limit-test
> +./nft-expr_log-test
> +./nft-expr_lookup-test
> +./nft-expr_match-test
> +./nft-expr_meta-test
> +./nft-expr_nat-test
> +./nft-expr_payload-test
> +./nft-expr_target-test
> +./nft-rule-test
> +./nft-ruleset-test

I think the file 'nft-ruleset-test' is not included in this patch.

Also, new files doesn't seem to include a copyrigth notice. @pablo, I
don't know if those tests files should have one in place.

Thanks for your work. Best regards.

-- 
Arturo Borrero González
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux