[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH 7/8] testidl: call _init and _dispose several times
Call _init and _dispose between 1 to 10 times on a type to test if _init and _dispose are idempotent. Signed-off-by: Wei Liu <wei.liu2@xxxxxxxxxx> Cc: Ian Campbell <ian.campbell@xxxxxxxxxx> Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- tools/libxl/gentest.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/libxl/gentest.py b/tools/libxl/gentest.py index 849bfc7..7621a1e 100644 --- a/tools/libxl/gentest.py +++ b/tools/libxl/gentest.py @@ -249,8 +249,11 @@ int main(int argc, char **argv) f.write(" %s_rand_init(%s);\n" % (ty.typename, \ ty.pass_arg(arg, isref=False, passby=idl.PASS_BY_REFERENCE))) if not isinstance(ty, idl.Enumeration): - f.write(" %s_init(%s_new);\n" % (ty.typename, \ - ty.pass_arg(arg, isref=False, passby=idl.PASS_BY_REFERENCE))) + iters = random.randrange(1,10) + while iters > 0: + f.write(" %s_init(%s_new);\n" % (ty.typename, \ + ty.pass_arg(arg, isref=False, passby=idl.PASS_BY_REFERENCE))) + iters -= 1 f.write(" s = %s_to_json(ctx, %s);\n" % \ (ty.typename, ty.pass_arg(arg, isref=False))) f.write(" printf(\"%%s: %%s\\n\", \"%s\", s);\n" % ty.typename) @@ -269,8 +272,11 @@ int main(int argc, char **argv) f.write(" free(s);\n") f.write(" free(new_s);\n") if ty.dispose_fn is not None: + iters = random.randrange(1,10) f.write(" %s(&%s_val);\n" % (ty.dispose_fn, ty.typename)) - f.write(" %s(&%s_val_new);\n" % (ty.dispose_fn, ty.typename)) + while iters > 0: + f.write(" %s(&%s_val_new);\n" % (ty.dispose_fn, ty.typename)) + iters -= 1 f.write("\n") f.write(" printf(\"Testing TYPE_copy()\\n\");\n") -- 1.9.1 _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |