summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemko Tronçon <git@el-tramo.be>2011-01-23 14:07:37 (GMT)
committerRemko Tronçon <git@el-tramo.be>2011-01-24 19:27:20 (GMT)
commit0a0a3046ad01ee4f3aa436485ae48cbff9d74272 (patch)
treee4b25e69815dfdb1a5139ab20be57a05879ffa76 /BuildTools
parentfe89312ed0e8b6554f37c0bc2ac45095fcc74683 (diff)
downloadswift-0a0a3046ad01ee4f3aa436485ae48cbff9d74272.zip
swift-0a0a3046ad01ee4f3aa436485ae48cbff9d74272.tar.bz2
Added test suite registration checker.
Diffstat (limited to 'BuildTools')
-rwxr-xr-xBuildTools/CheckTests.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/BuildTools/CheckTests.py b/BuildTools/CheckTests.py
new file mode 100755
index 0000000..0ea56bd
--- /dev/null
+++ b/BuildTools/CheckTests.py
@@ -0,0 +1,33 @@
+#!/usr/bin/env python
+
+import os, sys, re
+
+foundUnregisteredTests = False
+
+for (path, dirs, files) in os.walk(".") :
+ if not "3rdParty" in path :
+ for filename in [os.path.join(path, file) for file in files if file.endswith("Test.cpp") and file != "IdleQuerierTest.cpp" and file != "NotifierTest.cpp" and file != "ClientTest.cpp" and file != "ConnectivityTest.cpp" and file != "ReconnectTest.cpp"] :
+ file = open(filename, "r")
+ isRegistered = False
+ registeredTests = set()
+ declaredTests = set()
+ for line in file.readlines() :
+ m = re.match("\s*CPPUNIT_TEST_SUITE_REGISTRATION\((.*)\)", line)
+ if m :
+ isRegistered = True
+ m = re.match("\s*CPPUNIT_TEST\((.*)\)", line)
+ if m :
+ registeredTests.add(m.group(1))
+ continue
+ m = re.match("\s*void (test.*)\(\)", line)
+ if m :
+ declaredTests.add(m.group(1))
+ if not isRegistered :
+ print filename + ": Registration missing"
+ foundUnregisteredTests = True
+ if registeredTests - declaredTests != set([]) :
+ print filename + ": " + str(registeredTests - declaredTests)
+ foundUnregisteredTests = True
+ file.close()
+
+sys.exit(foundUnregisteredTests)