def run(): schemaPath = os.path.join(utils.installPath(), 'conf', 'schema', 'six') # SIX tests testsDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'python', 'six', 'tests') sixRunner = PythonTestRunner(testsDir) result = sixRunner.run('testDateTime.py') # SICD tests testsDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'python', 'six.sicd', 'tests') sampleNITF = os.path.join(utils.findSixHome(), 'regression_files', 'six.sicd', 'sicd_1.2.0(RMA)RMAT.nitf') sicdRunner = PythonTestRunner(testsDir) result = (result and sicdRunner.run('test_streaming_sicd_write.py') and sicdRunner.run('test_read_region.py') and sicdRunner.run('test_read_sicd_xml.py', sampleNITF) and sicdRunner.run('test_six_sicd.py', sampleNITF) and sicdRunner.run('test_create_sicd_xml.py', '-v', '1.2.0') and sicdRunner.run('sicd_to_sio.py', sampleNITF, schemaPath) and sicdRunner.run('test_read_complex_data.py', sampleNITF)) # CPHD tests cphd03Pathname = createSampleCPHD() testsDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'python', 'cphd03', 'tests') cphd03Runner = PythonTestRunner(testsDir) result = result and cphd03Runner.run('test_round_trip_cphd.py', cphd03Pathname, 'out.cphd') os.remove(cphd03Pathname) return result
def runSIDDTests(): testDir = os.path.join(utils.installPath(), 'tests', 'six.sidd') inputFiles = os.listdir(os.path.join( utils.findSixHome(), 'regression_files', 'six.sidd', '2.0.0')) passed = True for pathname in inputFiles: passed = passed and runTests(testDir, 'test_read_and_write_lut', os.path.join(utils.findSixHome(), 'regression_files', 'six.sidd', '2.0.0', pathname)) return passed
def runCsmTests(): pathKey = None if platform.system() == 'Windows': pathKey = 'PATH' else: pathKey = 'LD_LIBRARY_PATH' os.environ[pathKey] = (os.environ[pathKey] + os.pathsep + os.path.join(utils.installPath(), 'lib')) nitfPathname = os.path.join(utils.findSixHome(), 'croppedNitfs') sicdPathname = os.path.join(nitfPathname, 'SICD') siddPathname = os.path.join(nitfPathname, 'SIDD') testRunner = CppTestRunner(os.path.join(utils.installPath(), 'bin')) if os.path.exists(sicdPathname): for sicd in os.listdir(sicdPathname): sicd = os.path.join(sicdPathname, sicd) if not testRunner.run('test_sicd_csm', sicd): return False if os.path.exists(siddPathname): for sidd in os.listdir(siddPathname): sidd = os.path.join(siddPathname, sidd) if not testRunner.run('test_sidd_csm', sidd): return False return True
def run(): # SICD tests testsDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'python', 'six.sicd', 'tests') sampleNITF = os.path.join(utils.findSixHome(), 'regression_files', 'six.sicd', 'sicd_1.2.0(RMA)RMAT.nitf') schemaPath = os.path.join(utils.installPath(), 'conf', 'schema', 'six') sicdRunner = PythonTestRunner(testsDir) result = (sicdRunner.run('test_streaming_sicd_write.py') and sicdRunner.run('test_read_region.py') and sicdRunner.run('test_read_sicd_xml.py', sampleNITF) and sicdRunner.run('test_six_sicd.py', sampleNITF) and sicdRunner.run('test_create_sicd_xml.py', '-v', '1.2.0') and sicdRunner.run('sicd_to_sio.py', sampleNITF, schemaPath)) # SIX tests testsDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'python', 'six', 'tests') sixRunner = PythonTestRunner(testsDir) result = result and sixRunner.run('testDateTime.py'); return result
def run(): sicdVersions = [ '0.4.0', '0.4.1', '0.5.0', '1.0.0', '1.0.1', '1.1.0', '1.2.0', '1.2.1' ] formationAlgs = ['PFA', 'RMA', 'RGAZCOMP'] imageTypes = ['RMAT', 'RMCR', 'INCA'] home = utils.findSixHome() if not os.path.isdir(os.path.join(home, 'regression_files', 'six.sicd')): os.makedirs(os.path.join(home, 'regression_files', 'six.sicd')) for args in product(sicdVersions, formationAlgs, imageTypes): if args[1] != 'RMA': args = (args[0], args[1], '') createNITFs(args[0], args[1], args[2], home)
def run(): regressionDir = os.path.join(utils.findSixHome(), 'regression_files') result = True for pathname in glob.iglob(os.path.join(regressionDir, '*', '*.nitf')): print('Checking {0}'.format(os.path.basename(pathname))) result = result and roundTripSix(pathname) and validate(pathname) if result == False: print('Failed {0}'.format(os.path.basename(pathname))) break # Clean up for pathname in glob.iglob(os.path.join(os.getcwd(), '*.nitf')): os.remove(pathname) return result
def run(): outBase = os.path.join(utils.findSixHome(), 'regression_files', 'six.sidd') # Make siddLegend binDir = os.path.join(utils.installPath(), 'bin') legendNameBase = 'siddLegend' print('Creating SIDDs with legends') # This only does version 1.0 currently call([ utils.executableName(os.path.join(binDir, 'test_create_sidd_legend')), legendNameBase ]) outdir = os.path.join(outBase, '1.0.0') moveToOutputDir([ '{}_blocked.nitf'.format(legendNameBase), '{}_unblocked.nitf'.format(legendNameBase) ], outdir) # Make the rest of SIDDs through test_create_sidd_from_mem argToOutput = { '--lut Color': 'siddWithColorLUT.nitf', '--lut Mono': 'siddWithMonoLUT.nitf', '--lut None': 'siddWithNoLUT.nitf', '--multipleImages': 'siddMultipleImages.nitf', '--multipleSegments': 'siddMultipleSegments.nitf' } for version in ['1.0.0', '2.0.0']: outdir = os.path.join(outBase, version) for arg in argToOutput.keys(): print('Creating file {}'.format(argToOutput[arg])) if '--lut' in arg: call([ utils.executableName( os.path.join(binDir, 'test_create_sidd_from_mem')), '--lut', arg.split(' ')[1], '--version', version, argToOutput[arg] ]) else: call([ utils.executableName( os.path.join(binDir, 'test_create_sidd_from_mem')), arg, '--version', version, argToOutput[arg] ]) moveToOutputDir(argToOutput.values(), outdir)
def runCPHDTests(cphdDir): # Directory of CPHD1.0 schemas cphdSchemaDir = os.path.join(utils.findSixHome(), 'six', 'modules', 'c++', 'cphd', 'conf', 'schema') # Init executable path os.environ['PATH'] = (os.environ['PATH'] + os.pathsep + os.path.join(utils.installPath(), 'tests', 'cphd')) result = True # Run cphd test for each CPHD version for file in os.listdir(cphdDir): cphdPathname = os.path.join(cphdDir, file) # Generate CPHD1.0 output file writeCphd = utils.executableName('test_round_trip') success = subprocess.call( [writeCphd, cphdPathname, 'output.cphd', cphdSchemaDir], stdout=subprocess.PIPE) print('Running test_round_trip') if success != 0: if os.path.exists('output.cphd'): os.remove('output.cphd') print('Error running test_round_trip') return False # Check if CPHD1.0 input and output files match cphdRunner = CppTestRunner( os.path.join(utils.installPath(), 'tests', 'cphd')) result = result and cphdRunner.run('test_compare_cphd', cphdPathname, 'output.cphd', cphdSchemaDir) # Remove output file after done if os.path.exists('output.cphd'): os.remove('output.cphd') return result
def run(): outdir = os.path.join(utils.findSixHome(), 'regression_files', 'six.sidd') if not os.path.isdir(outdir): os.makedirs(outdir) # Make siddLegend binDir = os.path.join(utils.installPath(), 'bin') legendNameBase = 'siddLegend' print('Creating SIDDs with legends') call([utils.executableName(os.path.join(binDir, 'test_create_sidd_legend')), legendNameBase]) moveToOutputDir(['{}_blocked.nitf'.format(legendNameBase), '{}_unblocked.nitf'.format(legendNameBase)], outdir) # Make the rest of SIDDs through test_create_sidd_from_mem argToOutput = { '--lut Color' : 'siddWithColorLUT.nitf', '--lut Mono' : 'siddWithMonoLUT.nitf', '--lut None' : 'siddWithNoLUT.nitf', '--multipleImages' : 'siddMultipleImages.nitf', '--multipleSegments' : 'siddMultipleSegments.nitf' } for arg in argToOutput.keys(): print('Creating file {}'.format(argToOutput[arg])) if '--lut' in arg: call([utils.executableName(os.path.join(binDir, 'test_create_sidd_from_mem')), '--lut', arg.split(' ')[1], argToOutput[arg]], stdout = open(os.devnull, 'w')) else: call([utils.executableName(os.path.join(binDir, 'test_create_sidd_from_mem')), arg, argToOutput[arg]], stdout = open(os.devnull, 'w')) moveToOutputDir(argToOutput.values(), outdir)
def getSampleSicdXML(): samples = os.path.join(utils.findSixHome(), 'six', 'modules', 'c++', 'six.sicd', 'tests', 'sample_xml') return os.path.join(samples, random.choice(os.listdir(samples)))