[infinispan-commits] Infinispan SVN: r96 - trunk/bin.

infinispan-commits at lists.jboss.org infinispan-commits at lists.jboss.org
Tue Apr 7 20:38:51 EDT 2009


Author: manik.surtani at jboss.com
Date: 2009-04-07 20:38:50 -0400 (Tue, 07 Apr 2009)
New Revision: 96

Added:
   trunk/bin/findDisabledTests.py
Removed:
   trunk/bin/findDisabledTests.sh
Modified:
   trunk/bin/fixlineendings.sh
Log:
Fixed scripts to work in bin subdir

Added: trunk/bin/findDisabledTests.py
===================================================================
--- trunk/bin/findDisabledTests.py	                        (rev 0)
+++ trunk/bin/findDisabledTests.py	2009-04-08 00:38:50 UTC (rev 96)
@@ -0,0 +1,68 @@
+#!/usr/bin/python
+from __future__ import with_statement
+import os
+import fnmatch
+import re
+import time
+import sys 
+
+class GlobDirectoryWalker:
+    # a forward iterator that traverses a directory tree
+
+    def __init__(self, directory, pattern="*"):
+        self.stack = [directory]
+        self.pattern = pattern
+        self.files = []
+        self.index = 0
+
+    def __getitem__(self, index):
+        while 1:
+            try:
+                file = self.files[self.index]
+                self.index = self.index + 1
+            except IndexError:
+                # pop next directory from stack
+                self.directory = self.stack.pop()
+                self.files = os.listdir(self.directory)
+                self.index = 0
+            else:
+                # got a filename
+                fullname = os.path.join(self.directory, file)
+                if os.path.isdir(fullname) and not os.path.islink(fullname):
+                    self.stack.append(fullname)
+                if fnmatch.fnmatch(file, self.pattern):
+                    return fullname
+
+def getSearchPath(executable):
+    inBinDir = re.compile('^.*/?bin/.*.py')
+    if inBinDir.search(executable):
+        return "./"
+    else:
+        return "../"
+
+def stripLeadingDots(filename):
+    return filename.strip('/. ')
+
+## Walk through all files that end with Test.java
+startTime = time.clock()
+disabledTestFiles = []
+
+testAnnotationMatcher = re.compile('^\s*@Test')
+disabledMatcher = re.compile('enabled\s*=\s*false')
+
+for testFile in GlobDirectoryWalker(getSearchPath(sys.argv[0]), '*Test.java'):
+    with open(testFile) as tf:
+        for line in tf:
+            if testAnnotationMatcher.search(line):
+                if disabledMatcher.search(line):
+                    disabledTestFiles.append(testFile)
+                break
+
+print "Files containing disabled tests: \n"
+uniqueTests=set(disabledTestFiles)
+i=1
+for f in uniqueTests:
+    print str(i) + ". " + stripLeadingDots(f)
+    i=i+1
+	
+print "\n      (finished in " +  str(time.clock() - startTime) + " seconds)"


Property changes on: trunk/bin/findDisabledTests.py
___________________________________________________________________
Name: svn:executable
   + *

Deleted: trunk/bin/findDisabledTests.sh
===================================================================
--- trunk/bin/findDisabledTests.sh	2009-04-07 23:42:14 UTC (rev 95)
+++ trunk/bin/findDisabledTests.sh	2009-04-08 00:38:50 UTC (rev 96)
@@ -1,4 +0,0 @@
-#!/bin/bash
-
-grep -R "Test.*enabled[ ]*=[ ]*false" * | grep -v .svn | sed -e "s/:.*//"
-

Modified: trunk/bin/fixlineendings.sh
===================================================================
--- trunk/bin/fixlineendings.sh	2009-04-07 23:42:14 UTC (rev 95)
+++ trunk/bin/fixlineendings.sh	2009-04-08 00:38:50 UTC (rev 96)
@@ -1,7 +1,12 @@
 #!/bin/bash
-find src -name \*.java -or -name \*.xml -or -name \*.txt -or -name \*.xsd -or -name \*.sh | xargs svn ps --force svn:eol-style LF
-find src -name \*.java -or -name \*.xml -or -name \*.txt -or -name \*.xsd -or -name \*.sh | xargs svn ps --force svn:keywords 'Id Revision'
-find src -name \*.sh | xargs svn ps svn:executable on
-svn ps --force svn:eol-style LF *.txt *.sh
-svn ps --force svn:keywords 'Id Revision' *.txt *.sh
-svn ps svn:executable on *.sh
+
+
+if [[ $0 =~ bin/.*.sh ]] ; then
+   DIR_PREFIX=".."
+else
+   DIR_PREFIX="."
+fi
+
+find ${DIR_PREFIX}/ -name \*.java -or -name \*.xml -or -name \*.txt -or -name \*.xsd -or -name \*.sh -or -name \*.py | xargs svn ps --force svn:eol-style LF
+find ${DIR_PREFIX}/ -name \*.java -or -name \*.xml -or -name \*.txt -or -name \*.xsd -or -name \*.sh -or -name \*.py | xargs svn ps --force svn:keywords 'Id Revision'
+find ${DIR_PREFIX}/ -name \*.sh -or -name \*.py | xargs svn ps svn:executable on




More information about the infinispan-commits mailing list