From db272ebf9d31efedfb65c48d089674b6b3e0526b Mon Sep 17 00:00:00 2001 From: Martin Kletzander Date: Thu, 13 Feb 2014 15:20:04 +0100 Subject: [PATCH] tests: cleanup object-locking test When ran, cil is throwing out some errors and warnings for obsolete 'or' unused variables and wrong module name (it should not contain a hyphen; hence the rename). Signed-off-by: Martin Kletzander --- .gitignore | 6 +++--- tests/Makefile.am | 12 ++++++------ tests/{object-locking.ml => objectlocking.ml} | 10 ++++------ 3 files changed, 13 insertions(+), 15 deletions(-) rename tests/{object-locking.ml => objectlocking.ml} (98%) diff --git a/.gitignore b/.gitignore index 027c203246..0513a339a3 100644 --- a/.gitignore +++ b/.gitignore @@ -149,9 +149,9 @@ /tests/*test !/tests/*schematest !/tests/virt-aa-helper-test -/tests/object-locking -/tests/object-locking-files.txt -/tests/object-locking.cm[ix] +/tests/objectlocking +/tests/objectlocking-files.txt +/tests/objectlocking.cm[ix] /tests/reconnect /tests/ssh /tests/test_conf diff --git a/tests/Makefile.am b/tests/Makefile.am index 1745469402..f80e7ad320 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -228,7 +228,7 @@ test_programs += vmwarevertest endif WITH_VMWARE if WITH_CIL -test_programs += object-locking +test_programs += objectlocking endif WITH_CIL if WITH_YAJL @@ -1016,21 +1016,21 @@ CILOPTINCS = CILOPTPACKAGES = -package unix,str,cil CILOPTLIBS = -linkpkg -object_locking_SOURCES = object-locking.ml +object_locking_SOURCES = objectlocking.ml %.cmx: %.ml ocamlfind ocamlopt $(CILOPTFLAGS) $(CILOPTINCS) $(CILOPTPACKAGES) -c $< -object-locking: object-locking.cmx object-locking-files.txt +objectlocking: objectlocking.cmx objectlocking-files.txt ocamlfind ocamlopt $(CILOPTFLAGS) $(CILOPTINCS) $(CILOPTPACKAGES) \ $(CILOPTLIBS) $< -o $@ -object-locking-files.txt: +objectlocking-files.txt: find $(top_builddir)/src/ -name '*.i' > $@ else ! WITH_CIL -EXTRA_DIST += object-locking.ml +EXTRA_DIST += objectlocking.ml endif ! WITH_CIL CLEANFILES = *.cov *.gcov .libs/*.gcda .libs/*.gcno *.gcno *.gcda *.cmi *.cmx \ - object-locking-files.txt + objectlocking-files.txt diff --git a/tests/object-locking.ml b/tests/objectlocking.ml similarity index 98% rename from tests/object-locking.ml rename to tests/objectlocking.ml index 009b8f8f45..247673190e 100644 --- a/tests/object-locking.ml +++ b/tests/objectlocking.ml @@ -1,7 +1,7 @@ (* * Analyse libvirt driver API methods for mutex locking mistakes * - * Copyright (C) 2008-2010, 2012 Red Hat, Inc. + * Copyright (C) 2008-2010, 2012, 2014 Red Hat, Inc. * * This library is free software; you can redistribute it and/or * modify it under the terms of the GNU Lesser General Public @@ -623,7 +623,7 @@ module L = DF.ForwardsDataFlow(Locking) let () = (* Read the list of files from "libvirt-files". *) - let files = input_file "object-locking-files.txt" in + let files = input_file "objectlocking-files.txt" in (* Load & parse each input file. *) let files = @@ -645,7 +645,6 @@ let () = let driverVars = List.filter ( function | GVar (varinfo, initinfo, loc) -> (* global variable *) - let name = varinfo.vname in if isDriverTable varinfo then true else @@ -656,7 +655,6 @@ let () = let driverVarFuncs = List.map ( function | GVar (varinfo, initinfo, loc) -> (* global variable *) - let name = varinfo.vname in if isDriverTable varinfo then getDriverFuncNames initinfo else @@ -752,7 +750,7 @@ let () = IH.find Locking.stmtStartData st.sid in let leakDrivers = not (VS.is_empty ld) in let leakObjects = not (VS.is_empty lo) in - leakDrivers or leakObjects + leakDrivers || leakObjects ) exitPoints in let mistakes = List.filter ( @@ -767,7 +765,7 @@ let () = let deadLocked = (List.length dead) > 0 in - lockDriverOrdering or lockObjectOrdering or useDriverUnlocked or useObjectUnlocked or deadLocked + lockDriverOrdering || lockObjectOrdering || useDriverUnlocked || useObjectUnlocked || deadLocked ) fundec.sallstmts in if (List.length leaks) > 0 || (List.length mistakes) > 0 then (