[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] testidl: call _init and _dispose several times
commit 1f8fab14f2b396b8b9cb95432bdc7df2dd2efb60 Author: Wei Liu <wei.liu2@xxxxxxxxxx> AuthorDate: Wed Feb 25 14:56:05 2015 +0000 Commit: Ian Campbell <ian.campbell@xxxxxxxxxx> CommitDate: Mon Mar 2 17:05:40 2015 +0000 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> Acked-by: Ian Campbell <ian.campbell@xxxxxxxxxx> --- tools/libxl/gentest.py | 12 +++++++++--- 1 files 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") -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |