Example #1
0
def check_backcompat_tests():
    print('  checking backcompat tests...', end='', flush=True)
    olddir = os.getcwd()
    os.chdir('lucene/backward-codecs')
    scriptutil.run('ant test -Dtestcase=TestBackwardsCompatibility')
    os.chdir(olddir)
    print('ok')
def check_backcompat_tests():
  print('  checking backcompat tests...', end='', flush=True)
  olddir = os.getcwd()
  os.chdir('lucene/backward-codecs')
  scriptutil.run('ant test -Dtestcase=TestBackwardsCompatibility')
  os.chdir(olddir)
  print('ok')
def download_release(version, temp_dir, force):
  print('  downloading %s source release...' % version, end='', flush=True)
  source = os.path.join(temp_dir, 'lucene-%s' % version) 
  if os.path.exists(source):
    if force:
      shutil.rmtree(source)
    else:
      print('uptodate')
      return source

  filename = 'lucene-%s-src.tgz' % version
  source_tgz = os.path.join(temp_dir, filename)
  if not download_from_mirror(version, filename, source_tgz) and \
     not download_from_archives(version, filename, source_tgz):
    raise Exception('Could not find version %s in apache mirror or archives' % version)

  olddir = os.getcwd()
  os.chdir(temp_dir)
  scriptutil.run('tar -xvzf %s' % source_tgz)
  os.chdir(olddir) 
  print('done')
  return source
def download_release(version, temp_dir, force):
  print('  downloading %s source release...' % version, end='', flush=True)
  source = os.path.join(temp_dir, 'lucene-%s' % version) 
  if os.path.exists(source):
    if force:
      shutil.rmtree(source)
    else:
      print('uptodate')
      return source

  filename = 'lucene-%s-src.tgz' % version
  source_tgz = os.path.join(temp_dir, filename)
  if not download_from_mirror(version, filename, source_tgz) and \
     not download_from_archives(version, filename, source_tgz):
    raise Exception('Could not find version %s in apache mirror or archives' % version)

  olddir = os.getcwd()
  os.chdir(temp_dir)
  scriptutil.run('tar -xvzf %s' % source_tgz)
  os.chdir(olddir) 
  print('done')
  return source
Example #5
0
def create_and_add_index(source, indextype, index_version, current_version,
                         temp_dir):
    if not current_version.is_back_compat_with(index_version):
        prefix = 'unsupported'
    else:
        prefix = {
            'cfs': 'index',
            'nocfs': 'index',
            'sorted': 'sorted',
            'moreterms': 'moreterms',
            'dvupdates': 'dvupdates',
            'emptyIndex': 'empty'
        }[indextype]
    if indextype in ('cfs', 'nocfs'):
        dirname = 'index.%s' % indextype
        filename = '%s.%s-%s.zip' % (prefix, index_version, indextype)
    else:
        dirname = indextype
        filename = '%s.%s.zip' % (prefix, index_version)

    print('  creating %s...' % filename, end='', flush=True)
    module = 'backward-codecs'
    index_dir = os.path.join('lucene', module,
                             'src/test/org/apache/lucene/index')
    test_file = os.path.join(index_dir, filename)
    if os.path.exists(os.path.join(index_dir, filename)):
        print('uptodate')
        return

    test = {
        'cfs': 'testCreateCFS',
        'nocfs': 'testCreateNoCFS',
        'sorted': 'testCreateSortedIndex',
        'moreterms': 'testCreateMoreTermsIndex',
        'dvupdates': 'testCreateIndexWithDocValuesUpdates',
        'emptyIndex': 'testCreateEmptyIndex'
    }[indextype]
    ant_args = ' '.join([
        '-Dtests.bwcdir=%s' % temp_dir, '-Dtests.codec=default',
        '-Dtests.useSecurityManager=false',
        '-Dtestcase=TestBackwardsCompatibility',
        '-Dtestmethod=%s' % test
    ])
    base_dir = os.getcwd()
    bc_index_dir = os.path.join(temp_dir, dirname)
    bc_index_file = os.path.join(bc_index_dir, filename)

    if os.path.exists(bc_index_file):
        print('alreadyexists')
    else:
        if os.path.exists(bc_index_dir):
            shutil.rmtree(bc_index_dir)
        os.chdir(os.path.join(source, module))
        scriptutil.run('ant test %s' % ant_args)
        os.chdir(bc_index_dir)
        scriptutil.run('zip %s *' % filename)
        print('done')

    print('  adding %s...' % filename, end='', flush=True)
    scriptutil.run('cp %s %s' %
                   (bc_index_file, os.path.join(base_dir, index_dir)))
    os.chdir(base_dir)
    output = scriptutil.run('svn status %s' % test_file)
    if not output.strip():
        # make sure to only add if the file isn't already in svn (we might be regenerating)
        scriptutil.run('svn add %s' % test_file)
    os.chdir(base_dir)
    scriptutil.run('rm -rf %s' % bc_index_dir)
    print('done')
def check_backcompat_tests():
  print('  checking backcompat tests...', end='', flush=True)
  scriptutil.run('./gradlew -p lucene/backward-codecs test --tests TestBackwardsCompatibility')
  print('ok')
def create_and_add_index(source, indextype, index_version, current_version, temp_dir):
  if indextype in ('cfs', 'nocfs'):
    dirname = 'index.%s' % indextype
  else:
    dirname = indextype
  prefix = 'index' if current_version.is_back_compat_with(index_version) else 'unsupported'
  filename = '%s.%s-%s.zip' % (prefix, index_version, indextype)
  print('  creating %s...' % filename, end='', flush=True)
  module = 'backward-codecs'
  index_dir = os.path.join('lucene', module, 'src/test/org/apache/lucene/index')
  test_file = os.path.join(index_dir, filename)
  if os.path.exists(os.path.join(index_dir, filename)):
    print('uptodate')
    return

  test = {
    'cfs': 'testCreateCFS',
    'nocfs': 'testCreateNoCFS'
  }[indextype]
  ant_args = ' '.join([
    '-Dtests.bwcdir=%s' % temp_dir,
    '-Dtests.codec=default',
    '-Dtests.useSecurityManager=false',
    '-Dtestcase=TestBackwardsCompatibility',
    '-Dtestmethod=%s' % test
  ])
  base_dir = os.getcwd()
  bc_index_dir = os.path.join(temp_dir, dirname)
  bc_index_file = os.path.join(bc_index_dir, filename)
  
  if os.path.exists(bc_index_file):
    print('alreadyexists')
  else:
    if os.path.exists(bc_index_dir):
      shutil.rmtree(bc_index_dir)
    os.chdir(os.path.join(source, module))
    scriptutil.run('ant test %s' % ant_args)
    os.chdir(bc_index_dir)
    scriptutil.run('zip %s *' % filename)
    print('done')
  
  print('  adding %s...' % filename, end='', flush=True)
  scriptutil.run('cp %s %s' % (bc_index_file, os.path.join(base_dir, index_dir)))
  os.chdir(base_dir)
  output = scriptutil.run('svn status %s' % test_file)
  if not output.strip():
    # make sure to only add if the file isn't already in svn (we might be regenerating)
    scriptutil.run('svn add %s' % test_file)
  os.chdir(base_dir)
  scriptutil.run('rm -rf %s' % bc_index_dir)
  print('done')
def create_and_add_index(source, indextype, index_version, current_version,
                         temp_dir):
    if not current_version.is_back_compat_with(index_version):
        prefix = 'unsupported'
    else:
        prefix = {
            'cfs': 'index',
            'nocfs': 'index',
            'sorted': 'sorted',
            'moreterms': 'moreterms',
            'dvupdates': 'dvupdates',
            'emptyIndex': 'empty'
        }[indextype]
    if indextype in ('cfs', 'nocfs'):
        dirname = 'index.%s' % indextype
        filename = '%s.%s-%s.zip' % (prefix, index_version, indextype)
    else:
        dirname = indextype
        filename = '%s.%s.zip' % (prefix, index_version)

    print('  creating %s...' % filename, end='', flush=True)
    module = 'backward-codecs'
    index_dir = os.path.join('lucene', module,
                             'src/test/org/apache/lucene/backward_index')
    test_file = os.path.join(index_dir, filename)
    if os.path.exists(os.path.join(index_dir, filename)):
        print('uptodate')
        return

    test = {
        'cfs': 'testCreateCFS',
        'nocfs': 'testCreateNoCFS',
        'sorted': 'testCreateSortedIndex',
        'moreterms': 'testCreateMoreTermsIndex',
        'dvupdates': 'testCreateIndexWithDocValuesUpdates',
        'emptyIndex': 'testCreateEmptyIndex'
    }[indextype]
    gradle_args = ' '.join([
        '-Ptests.useSecurityManager=false',
        '-p lucene/%s' % module, 'test',
        '--tests TestBackwardsCompatibility.%s' % test,
        '-Dtests.bwcdir=%s' % temp_dir, '-Dtests.codec=default'
    ])
    base_dir = os.getcwd()
    bc_index_dir = os.path.join(temp_dir, dirname)
    bc_index_file = os.path.join(bc_index_dir, filename)

    if os.path.exists(bc_index_file):
        print('alreadyexists')
    else:
        if os.path.exists(bc_index_dir):
            shutil.rmtree(bc_index_dir)
        os.chdir(source)
        scriptutil.run('./gradlew %s' % gradle_args)
        os.chdir(bc_index_dir)
        scriptutil.run('zip %s *' % filename)
        print('done')

    print('  adding %s...' % filename, end='', flush=True)
    scriptutil.run('cp %s %s' %
                   (bc_index_file, os.path.join(base_dir, index_dir)))
    os.chdir(base_dir)
    scriptutil.run('rm -rf %s' % bc_index_dir)
    print('done')
Example #9
0
def create_and_add_index(source, indextype, version, temp_dir):
    if indextype in ('cfs', 'nocfs'):
        dirname = 'index.%s' % indextype
    else:
        dirname = indextype
    filename = {
        'cfs': 'index.%s-cfs.zip',
        'nocfs': 'index.%s-nocfs.zip'
    }[indextype] % version
    print('  creating %s...' % filename, end='', flush=True)
    module = 'backward-codecs'
    index_dir = os.path.join('lucene', module,
                             'src/test/org/apache/lucene/index')
    test_file = os.path.join(index_dir, filename)
    if os.path.exists(os.path.join(index_dir, filename)):
        print('uptodate')
        return

    test = {'cfs': 'testCreateCFS', 'nocfs': 'testCreateNoCFS'}[indextype]
    ant_args = ' '.join([
        '-Dtests.bwcdir=%s' % temp_dir, '-Dtests.codec=default',
        '-Dtests.useSecurityManager=false',
        '-Dtestcase=TestBackwardsCompatibility',
        '-Dtestmethod=%s' % test
    ])
    base_dir = os.getcwd()
    bc_index_dir = os.path.join(temp_dir, dirname)
    bc_index_file = os.path.join(bc_index_dir, filename)

    if os.path.exists(bc_index_file):
        print('alreadyexists')
    else:
        if os.path.exists(bc_index_dir):
            shutil.rmtree(bc_index_dir)
        os.chdir(os.path.join(source, module))
        scriptutil.run('ant test %s' % ant_args)
        os.chdir(bc_index_dir)
        scriptutil.run('zip %s *' % filename)
        print('done')

    print('  adding %s...' % filename, end='', flush=True)
    scriptutil.run('cp %s %s' %
                   (bc_index_file, os.path.join(base_dir, index_dir)))
    os.chdir(base_dir)
    output = scriptutil.run('svn status %s' % test_file)
    if not output.strip():
        # make sure to only add if the file isn't already in svn (we might be regenerating)
        scriptutil.run('svn add %s' % test_file)
    os.chdir(base_dir)
    scriptutil.run('rm -rf %s' % bc_index_dir)
    print('done')