Advertisement
Guest User

Untitled

a guest
Jun 24th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 4.86 KB | None | 0 0
  1. import shutil
  2. import datetime
  3. import os
  4. import sys
  5.  
  6. if 0:
  7.   tests = ('org.apache.lucene.index.TestThreadedOptimize',
  8.            'org.apache.lucene.index.TestConcurrentMergeScheduler',
  9.            'org.apache.lucene.index.TestTransactions',
  10.            'org.apache.lucene.index.TestAddIndexesNoOptimize',
  11.            'org.apache.lucene.index.stresstests.TestIndexWriterConcurrent',
  12.            'org.apache.lucene.index.TestStressIndexing',
  13.            'org.apache.lucene.index.TestStressIndexing2',
  14.            'org.apache.lucene.index.TestIndexWriter',
  15.            'org.apache.lucene.index.TestAtomicUpdate',
  16.            'org.apache.lucene.index.TestIndexWriterDelete',
  17.            'org.apache.lucene.index.TestIndexWriterExceptions',
  18.            'org.apache.lucene.TestSnapshotDeletionPolicy',
  19.            'org.apache.lucene.index.TestCrash')
  20.  
  21.   tests = ('org.apache.lucene.search.TestRegexpRandom2',
  22.            'org.apache.lucene.search.TestRegexpRandom',
  23.            'org.apache.lucene.search.TestPrefixRandom',
  24.            'org.apache.lucene.search.TestAutomatonQuery',
  25.            'org.apache.lucene.util.automaton.TestUTF32ToUTF8',
  26.            'org.apache.lucene.index.codecs.preflex.TestSurrogates')
  27.   doLog = False
  28. else:
  29.   tests = ('org.apache.lucene.index.TestAtomicUpdate',)
  30.   #tests = ('org.apache.lucene.index.TestBackwardsCompatibility',)
  31.   #tests = ('org.apache.lucene.search.TestPrefixRandom',)
  32.   #tests = ('org.apache.lucene.index.codecs.preflex.TestSurrogates',)
  33.   #logDirName = 'atomic'
  34.   #tests = ('org.apache.lucene.index.TestPayloads',)
  35.   #tests = ('org.apache.lucene.index.TestIndexWriterExceptions',)
  36.   #tests = ('org.apache.lucene.index.TestConcurrentMergeScheduler',)
  37.   logDirName = '/tmp/logs'
  38.   doLog = True
  39.  
  40. if os.system('ant compile-core compile-test common.compile-test'):
  41.   sys.exit(0)
  42.  
  43. if doLog:
  44.   if os.path.exists(logDirName):
  45.     shutil.rmtree(logDirName)
  46.   os.makedirs(logDirName)
  47.  
  48. IS29 = True
  49.  
  50. p = sys.platform.lower()
  51. if not IS29:
  52.   JUNIT_JAR = './lib/junit-4.7.jar'
  53.   #JUNIT_JAR = '/Volumes/root/usr/local/src/junit-4.4.jar'
  54.   CP = '-cp .:%s:./build/classes/test:./build/classes/java' % JUNIT_JAR
  55. else:
  56.   CP = '-cp .:./lib/junit-3.8.2.jar:./build/classes/test:./build/classes/java:./build/classes/demo'
  57. #ARGS = '-server -Xmx1024m -Xms1024m -Xbatch %s' % CP
  58. ARGS = '-Xmx512m -Xms512m %s' % CP
  59. #ARGS = CP
  60.  
  61. ranMult = 1
  62. verbose = 'false'
  63. codec = 'random'
  64. #codec = 'PreFlex'
  65. #codec = '"MockVariableIntBlock(29)"'
  66. upto = 0
  67. while True:
  68.   for test in tests:
  69.     print
  70.     if doLog:
  71.       print '%s TEST: %s -> %s/%d.log' % (datetime.datetime.now(), test, logDirName, upto)
  72.     else:
  73.       print '%s TEST: %s' % (datetime.datetime.now(), test)
  74.      
  75.     if doLog:
  76.       if IS29:
  77.         command = 'java %s -DtempDir=build/test -ea junit.textui.TestRunner %s > %s/%d.log 2>&1' % (ARGS, test, logDirName, upto)
  78.       else:
  79.         #command = 'java %s -DtempDir=build/test -Dtests.codec=%s -Dtestmethod=testRandomStoredFields -Dtests.verbose=%s -Drandom.multiplier=%d -Dtests.iter=50 -ea org.junit.runner.JUnitCore %s > %s/%d.log 2>&1' % (ARGS, codec, verbose, ranMult, test, logDirName, upto)
  80.         #command = 'java %s -DtempDir=build/test -Dtestmethod=testRandomStoredFields -Dtests.verbose=%s -Drandom.multiplier=%d -Dtests.iter=10 -ea org.junit.runner.JUnitCore %s > %s/%d.log 2>&1' % (ARGS, verbose, ranMult, test, logDirName, upto)
  81.         #command = 'java %s -DtempDir=build/test -Dtests.directory=SimpleFSDirectory -Dtests.verbose=%s -Drandom.multiplier=%d -Dtests.iter=100 -ea org.junit.runner.JUnitCore %s > %s/%d.log 2>&1' % (ARGS, verbose, ranMult, test, logDirName, upto)
  82.         #command = 'java %s -DtempDir=build/test -Drandom.multiplier=%d -ea org.junit.runner.JUnitCore %s > %s/%d.log 2>&1' % (ARGS, ranMult, test, logDirName, upto)
  83.         command = 'java %s -DtempDir=build/test -Dtests.verbose=%s -Drandom.multiplier=%d -Dtests.iter=10 -Dtests.codec=%s -Dtestmethod=testCommitThreadSafety -Dtests.directory=RAMDirectory -ea org.junit.runner.JUnitCore %s > %s/%d.log 2>&1' % (ARGS, verbose, ranMult, codec, test, logDirName, upto)
  84.       print 'CLEAN'
  85.       if os.path.exists('build/test'):
  86.         shutil.rmtree('build/test')
  87.       print 'RUN: %s' % command
  88.       res = os.system(command)
  89.       #res = os.system('ant test-core -Dtestcase=%s' % test.split('.')[-1])
  90.     else:
  91.       #res = os.system('java -server -agentlib:yjpagent -Xmx1024m -Xms1024m -Xbatch -DtempDir=build/test -ea org.junit.runner.JUnitCore %s' % test)
  92.       command = 'java %s -DtempDir=build/test -Drandom.multiplier=%s -ea org.junit.runner.JUnitCore %s' % (ARGS, ranMult, test)
  93.       #command = 'ant test-core -Dtestcase=%s'
  94.       print 'RUN: %s' % command
  95.       res = os.system(command)
  96.  
  97.     if res:
  98.       print '  FAILED'
  99.       raise RuntimeError('hit fail')
  100.     elif doLog:
  101.       os.remove('%s/%d.log' % (logDirName, upto))
  102.       pass
  103.      
  104.     upto += 1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement