X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=tests%2Fcheck-structs.at;h=4163c30d6dbe03d6c60de4cce218284f42192446;hb=003ce655b7116d18c86a74c50391e54990346931;hp=52e92ec0198789f933cb0cee17d43c7645a6932e;hpb=a0bc29a541fc7dc6e20137d5558e2094d614e6ab;p=sliver-openvswitch.git diff --git a/tests/check-structs.at b/tests/check-structs.at index 52e92ec01..4163c30d6 100644 --- a/tests/check-structs.at +++ b/tests/check-structs.at @@ -2,7 +2,8 @@ AT_BANNER([struct alignment checker unit tests]) m4_define([check_structs], [$top_srcdir/build-aux/check-structs]) m4_define([RUN_STRUCT_CHECKER], - [AT_SKIP_IF([test $HAVE_PYTHON = no]) + [AT_KEYWORDS([check-structs]) + AT_SKIP_IF([test $HAVE_PYTHON = no]) AT_DATA([test.h], [$1 ]) AT_CHECK_UNQUOTED([$PYTHON check_structs test.h], [$2], [$3], [$4])]) @@ -10,7 +11,7 @@ m4_define([RUN_STRUCT_CHECKER], AT_SETUP([check struct tail padding]) RUN_STRUCT_CHECKER( [struct xyz { - uint16_t x; + ovs_be16 x; };], [1], [], [test.h:3: warning: struct xyz needs 2 bytes of tail padding @@ -20,8 +21,8 @@ AT_CLEANUP AT_SETUP([check struct internal alignment]) RUN_STRUCT_CHECKER( [struct xyzzy { - uint16_t x; - uint32_t y; + ovs_be16 x; + ovs_be32 y; };], [1], [], [test.h:3: warning: struct xyzzy member y is 2 bytes short of 4-byte alignment @@ -31,7 +32,7 @@ AT_CLEANUP AT_SETUP([check struct declared size]) RUN_STRUCT_CHECKER( [struct wibble { - uint64_t z; + ovs_be64 z; }; OFP_ASSERT(sizeof(struct wibble) == 12); ], @@ -39,3 +40,17 @@ OFP_ASSERT(sizeof(struct wibble) == 12); [test.h:4: warning: struct wibble is 8 bytes long but declared as 12 ]) AT_CLEANUP + +AT_SETUP([check wrong struct's declared size]) +RUN_STRUCT_CHECKER( +[struct moo { + ovs_be64 bar; +}; +OFP_ASSERT(sizeof(struct moo) == 8); +struct wibble { + ovs_be64 z; +}; +OFP_ASSERT(sizeof(struct moo) == 8); +], [1], [], [test.h:8: warning: checking size of struct moo but struct wibble was most recently defined +]) +AT_CLEANUP