コード例 #1
0
ファイル: runTests.py プロジェクト: richjones4iss/six-library
def run(sourceDir):
    # If we don't run this before setting the paths, we won't be testing
    # the right things

    sicdDir = os.path.join(sourceDir, 'SICD')
    siddDir = os.path.join(sourceDir, 'SIDD')

    if sourceDir != '':
        os.environ["PATH"] = (os.environ["PATH"] + os.pathsep +
                              os.path.join(utils.installPath(), 'bin'))
        cropSicds = utils.executableName('crop_sicd')

        sicdPathname = os.path.join(sicdDir, os.listdir(sicdDir)[0])

        success = subprocess.call([
            cropSicds, '--start-row', '0', '--start-col', '0', '--num-rows',
            '10', '--num-cols', '10', sicdPathname, 'cropped.nitf'
        ],
                                  stdout=subprocess.PIPE)

        print("Running crop_sicd")
        if os.path.exists('cropped.nitf'):
            os.remove('cropped.nitf')
        if success != 0:
            print("Error running crop_sicd")
            return False

    utils.setPaths()

    if platform.system() != 'SunOS':
        if makeRegressionFiles.run() == False:
            print("Error generating regression files")
            return False

        if runPythonScripts.run() == False:
            print("Error running a python script")
            return False

        if checkNITFs.run() == False:
            print("test in checkNITFS.py failed")
            return False

        if runMiscTests.run() == False:
            # These tests should report their own errors
            return False
    else:
        print('Warning: skipping the bulk of the test suite, '
              'since Python modules are by default disabled on Solaris')

    sicdTestDir = os.path.join(utils.installPath(), 'tests', 'six.sicd')
    siddTestDir = os.path.join(utils.installPath(), 'tests', 'six.sidd')
    sampleTestDir = os.path.join(utils.installPath(), 'bin')

    sicdTestRunner = CppTestRunner(sicdTestDir)
    siddTestRunner = CppTestRunner(siddTestDir)
    sampleTestRunner = CppTestRunner(sampleTestDir)

    if os.path.exists(sicdDir) and os.path.exists(siddDir):
        sampleSicd = os.path.join(sicdDir, os.listdir(sicdDir)[0])
        sampleSidd = os.path.join(siddDir, os.listdir(siddDir)[0])
        if not sicdTestRunner.run('test_load_from_input_stream', sampleSicd):
            return False

        if not sicdTestRunner.run('test_streaming_write'):
            return False

        if not sicdTestRunner.run('test_sicd_byte_provider'):
            return False

        if not runCsmTests():
            return False

        if not (siddTestRunner.run('test_byte_swap')
                and siddTestRunner.run('test_geotiff')
                and siddTestRunner.run('test_check_blocking', sampleSidd) and
                siddTestRunner.run('test_sidd_blocking', utils.installPath())
                and siddTestRunner.run('test_sidd_byte_provider')):
            return False

        if not sampleTestRunner.run('test_large_offset'):
            return False

        if not sampleTestRunner.run(
                'test_create_sidd_with_compressed_byte_provider'):
            return False

    if runUnitTests.run() == False:
        print("Unit tests failed")
        return False

    print("All passed")
    return True
コード例 #2
0
def run():
    utils.setPaths()

    makeSIDDRegressionFiles.run()
    makeSICDRegressionFiles.run()
コード例 #3
0
ファイル: runTests.py プロジェクト: ngageoint/six-library
def run(sourceDir):
    # If we don't run this before setting the paths, we won't be testing
    # the right things

    sicdDir = os.path.join(sourceDir, 'SICD')
    siddDir = os.path.join(sourceDir, 'SIDD')

    if sourceDir != '':
        os.environ["PATH"] = (os.environ["PATH"] + os.pathsep +
                os.path.join(utils.installPath(), 'bin'))
        cropSicds = utils.executableName('crop_sicd')

        sicdPathname = os.path.join(sicdDir, os.listdir(sicdDir)[0])

        success = subprocess.call([cropSicds,
                '--start-row', '0', '--start-col', '0',
                '--num-rows', '10', '--num-cols', '10',
                sicdPathname, 'cropped.nitf'],
                stdout=subprocess.PIPE)

        print("Running crop_sicd")
        if os.path.exists('cropped.nitf'):
            os.remove('cropped.nitf')
        if success != 0:
            print("Error running crop_sicd")
            return False

    utils.setPaths()

    if platform.system() != 'SunOS':
        if makeRegressionFiles.run() == False:
            print("Error generating regression files")
            return False

        if runPythonScripts.run() == False:
            print("Error running a python script")
            return False

        if checkNITFs.run() == False:
            print("test in checkNITFS.py failed")
            return False

        if runMiscTests.run() == False:
            # These tests should report their own errors
            return False
    else:
        print('Warning: skipping the bulk of the test suite, '
                'since Python modules are by default disabled on Solaris')

    sicdTestDir = os.path.join(utils.installPath(), 'tests', 'six.sicd')
    siddTestDir = os.path.join(utils.installPath(), 'tests', 'six.sidd')
    sampleTestDir = os.path.join(utils.installPath(), 'bin')

    newFiles = utils.installVts()

    sicdTestRunner = CppTestRunner(sicdTestDir)
    siddTestRunner = CppTestRunner(siddTestDir)
    sampleTestRunner = CppTestRunner(sampleTestDir)

    if os.path.exists(sicdDir) and os.path.exists(siddDir):
        sampleSicd = os.path.join(sicdDir, os.listdir(sicdDir)[0])
        if not sicdTestRunner.run('test_load_from_input_stream', sampleSicd):
            return False

        if not sicdTestRunner.run('test_streaming_write'):
            return False

        for nitf in os.listdir(sicdDir):
            nitf = os.path.join(sicdDir, nitf)
            if not sampleTestRunner.run('test_read_nitf_from_vts', nitf,
                    'out.nitf'):
                clean(newFiles)
                return False

        for nitf in os.listdir(siddDir):
            nitf = os.path.join(siddDir, nitf)
            if not sampleTestRunner.run('test_read_nitf_from_vts', nitf,
                    'out.nitf'):
                clean(newFiles)
                return False

        clean(newFiles)

        if not (siddTestRunner.run('test_byte_swap') and
                siddTestRunner.run('test_geotiff')):
            return False

    if runUnitTests.run() == False:
        print("Unit tests failed")
        return False

    print("All passed")
    return True
コード例 #4
0
def run():
    utils.setPaths()

    makeSIDDRegressionFiles.run()
    makeSICDRegressionFiles.run()
コード例 #5
0
def run(sourceDir):
    # If we don't run this before setting the paths, we won't be testing
    # the right things
    sicdDir = os.path.join(sourceDir, 'SICD')
    siddDir = os.path.join(sourceDir, 'SIDD')
    cphdDir = os.path.join(sourceDir, 'CPHD')

    if sourceDir != '':
        os.environ['PATH'] = (os.environ['PATH'] + os.pathsep +
                              os.path.join(utils.installPath(), 'bin'))
        cropSicds = utils.executableName('crop_sicd')

        sicdPathname = os.path.join(sicdDir, os.listdir(sicdDir)[0])

        success = subprocess.call([
            cropSicds, '--start-row', '0', '--start-col', '0', '--num-rows',
            '10', '--num-cols', '10', sicdPathname, 'cropped.nitf'
        ],
                                  stdout=subprocess.PIPE)

        print('Running crop_sicd')
        if os.path.exists('cropped.nitf'):
            os.remove('cropped.nitf')
        if success != 0:
            print('Error running crop_sicd')
            return False

    utils.setPaths()

    if makeRegressionFiles.run() == False:
        print('Error generating regression files')
        return False

    if runPythonScripts.run() == False:
        print('Error running a python script')
        return False

    if checkNITFs.run() == False:
        print('test in checkNITFS.py failed')
        return False

    if runMiscTests.run() == False:
        # These tests should report their own errors
        return False

    sicdTestDir = os.path.join(utils.installPath(), 'tests', 'six.sicd')
    siddTestDir = os.path.join(utils.installPath(), 'tests', 'six.sidd')
    sampleTestDir = os.path.join(utils.installPath(), 'bin')

    sicdTestRunner = CppTestRunner(sicdTestDir)
    siddTestRunner = CppTestRunner(siddTestDir)
    sampleTestRunner = CppTestRunner(sampleTestDir)

    if os.path.exists(sicdDir) and os.path.exists(siddDir):
        sampleSicd = os.path.join(sicdDir, os.listdir(sicdDir)[0])
        sampleSidd = os.path.join(siddDir, os.listdir(siddDir)[0])
        if not sicdTestRunner.run('test_load_from_input_stream', sampleSicd):
            return False

        if not sicdTestRunner.run('test_streaming_write'):
            return False

        if not runCsmTests():
            return False

        if not (siddTestRunner.run('test_byte_swap')
                and siddTestRunner.run('test_geotiff')
                and siddTestRunner.run('test_check_blocking', sampleSidd) and
                siddTestRunner.run('test_sidd_blocking', utils.installPath())):
            return False

        if not sampleTestRunner.run('test_large_offset'):
            return False

    if os.path.exists(cphdDir):
        if not runCPHDTests(cphdDir):
            return False

    if not runUnitTests.run():
        print('Unit tests failed')
        return False

    print('All passed')
    return True
コード例 #6
0
ファイル: runUnitTests.py プロジェクト: webbtrail/six-library
#

import os
from subprocess import call
import sys

import utils

def run():
    install = utils.installPath()
    unitTestDir = os.path.join(install, 'unittests')
    childDirs = os.listdir(unitTestDir)
    for childDir in childDirs:
        for test in os.listdir(os.path.join(unitTestDir, childDir)):
            print(os.path.join(unitTestDir, childDir, test))
            testPathname = os.path.join(unitTestDir, childDir, test)
            if test.endswith('.py'):
                command = ['python', testPathname]
            else:
                command = [utils.executableName(testPathname)]
            if call(command) != 0:
                print('{} failed'.format(testPathname))
                return False

    return True

if __name__ == '__main__':
    utils.setPaths()
    run()