Exemplo n.º 1
0
 def buildAllComponents(self):
     self.assembly.controlData.printSettings()
     PrintFormatter.printHeader('Build all components', level=2)
     self.assembly.selectAllLibraries()
     self.assembly.process(checkout=True,
                          configure=True,
                          build=True)
Exemplo n.º 2
0
 def publishCoverageInfo(self, targetFolder):
     PrintFormatter.printHeader('Publish Coverage Info to server', level=2)
     target = self.assembly.controlData.publish_coverage_info_target
     custusx = self._createComponent(cxComponents.CustusX)
     source = '%s/gcov/coverage_info' %  self.assembly.controlData.getRootDir()
     target_path = '%s/%s' % (target.path, targetFolder)        
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 3
0
 def removePreviousJob(self):
     'remove all stuff from previous run of the installer'
     PrintFormatter.printHeader('Removing files from previous install', 3)
     shell.rm_r('%s/%s' % (self.install_root, self.system_base_name))
     shell.rm_r('%s/%s*.%s' % (self.installer_path, self.system_base_name, self._getInstallerPackageSuffix()))
     shell.removeTree('%s/temp/Install' % self.root_dir)
     shell.removeTree('%s/%s' % (self.install_root, self.system_base_name))
Exemplo n.º 4
0
 def runCatchTests(self, tag):
     PrintFormatter.printHeader('Run catch tests using tag %s' % tag, level=3)
     # Run all Catch tests and write them in xml format to ./Catch.<tagname>.TestResults.xml
     custusx = self._createComponent(cxComponents.CustusX)
     catchDir = '%s/bin' % custusx.buildPath()
     outpath = self._getTestResultsPath()
     self._getTestRunner().runCatch(catchDir, tag=tag, outpath=outpath)
Exemplo n.º 5
0
 def clearTestData(self):
     PrintFormatter.printHeader('Clearing all old test data', level=3)
     cxData = self._createComponent(cxComponents.CustusXData)
     #custusx = self._createComponent(cxComponents.CustusX)
     testRunner = self._getTestRunner()
     testRunner.resetCustusXDataRepo(cxData.sourcePath())  
     testRunner.removeResultFiles(outPath=self._getTestResultsPath())
Exemplo n.º 6
0
 def clearTestData(self):
     PrintFormatter.printHeader('Clearing all old test data', level=3)
     cxData = self._createComponent(cxComponents.CustusXData)
     #custusx = self._createComponent(cxComponents.CustusX)
     testRunner = self._getTestRunner()
     testRunner.resetCustusXDataRepo(cxData.sourcePath())
     testRunner.removeResultFiles(outPath=self._getTestResultsPath())
Exemplo n.º 7
0
 def publishUserDocs(self, targetFolder):
     PrintFormatter.printHeader('Publish User Docs to server', level=2)
     target = self.assembly.controlData.publish_user_documentation_target
     custusx = self._createComponent(cxComponents.CustusX)
     source = '%s/doc/html_pure' % custusx.buildPath()
     target_path = '%s/%s' % (target.path, targetFolder)
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 8
0
 def removePreviousJob(self):
     'remove all stuff from previous run of the installer'
     PrintFormatter.printHeader('Removing files from previous install', 3)
     shell.rm_r('%s/%s' % (self.install_root, self.system_base_name))
     shell.rm_r('%s/%s*.%s' % (self.installer_path, self.system_base_name, self._getInstallerPackageSuffix()))
     shell.removeTree('%s/temp/Install' % self.root_dir)
     shell.removeTree('%s/%s' % (self.install_root, self.system_base_name))
Exemplo n.º 9
0
 def publishUserDocs(self, targetFolder):
     PrintFormatter.printHeader('Publish User Docs to server', level=2)
     target = self.assembly.controlData.publish_user_documentation_target
     custusx = self._createComponent(cxComponents.CustusX)
     source = '%s/doc/html_pure' %  custusx.buildPath()
     target_path = '%s/%s' % (target.path, targetFolder)        
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 10
0
 def runCatchTestsWrappedInCTest(self, tag):
     PrintFormatter.printHeader('Run catch tests wrapped in ctest', level=2)
     custusx = self._createComponent(cxComponents.CustusX)
     appPath = '%s/bin' % custusx.buildPath()
     outpath = self._getTestResultsPath()
     testRunner = self._getTestRunner()
     testRunner.runCatchTestsWrappedInCTestGenerateJUnit(tag, appPath, outpath)
Exemplo n.º 11
0
    def runCatch(self, path, tag, outpath=None, outfile=None):
        'Run all Catch tests at path and write them in junit xml format to outfile'
        if not outfile:
            baseName = self._createCatchBaseFilenameFromTag(tag)
            outfile = '%s/%s.junit.xml' % (outpath, baseName)
        PrintFormatter.printInfo('Run catch with tag %s, results to %s' %
                                 (tag, outfile))
        shell.changeDir(path)
        shell.rm_r(outfile)
        exe = self._getCatchExecutable(path)
        if (platform.system() == 'Windows'):
            cmd = 'set_run_environment.bat %s %s --reporter junit --out %s' % (
                exe, tag, outfile)
        else:
            cmd = '%s %s --reporter junit --out %s' % (exe, tag, outfile)
        result = shell.run(cmd, ignoreFailure=True, keep_output=True)
        if result.returncode >= 0:
            PrintFormatter.printInfo('catch reported %s failing tests' %
                                     result.returncode)
#        if result.returncode < 0:
        if self._catch_has_failed(result):
            PrintFormatter.printInfo('catch failed with returncode %s' %
                                     result.returncode)
            PrintFormatter.printInfo('Removing outfile %s' % outfile)
            shell.rm_r(outfile)
            PrintFormatter.printHeader('Analyzing catch failure', 2)
            PrintFormatter.printInfo('Running catch tests wrapped in ctest.')
            PrintFormatter.printInfo('This should identify crashing tests.')
            self.runCatchTestsWrappedInCTestGenerateJUnit(tag, path, outpath)
 def testInstallation(self):
     PrintFormatter.printHeader('Test installation', level=2)
     appPath = self._getInstalledBinaryPath()
     self._testExecutable(appPath, 'Catch', '-h')
     self._testExecutable(appPath, self.system_base_name) # defaults to CustusX
     self._testExecutable(appPath, 'OpenIGTLinkServer')
     self._testExecutable(appPath, 'LogConsole')
 def try_job_release(self):
     '''
     Create a tagged release and publish to server.
     Build, run all tests, publish binaries and 
     documentation to the web server.
     
     Requires a git_tag as input.
     Assumed to be run on the release branch (should work OK on others as well)
     '''
     if self.options.job_release_I:
         PrintFormatter.printHeader('Building release for tag "%s"' % self.controlData().git_tag, 1);
         if self.is_main_build():
             self.controlData().build_developer_doc = True
             self.controlData().build_user_doc = True
         self.resetInstallerStep()
         self.createUnitTestedPackageStep()
         self.integrationTestPackageStep(skip_extra_install_step_checkout=True)
         self.cxBuilder.finish()
     if self.options.job_release_II:
         targetFolder = self.cxInstaller.getTaggedFolderName()
         PrintFormatter.printHeader('Creating and publishing release for tag "%s"' % self.controlData().git_tag, 1);
         if targetFolder != self.controlData().git_tag:
             PrintFormatter.printInfo("Warning: Target folder [%s] not equal to controldata tag [%s]" % (targetFolder, self.controlData().git_tag) )
         self.publishTaggedRelease()
         if self.is_main_build():
             self.publishTaggedDocumentation()
         self.cxBuilder.finish()
Exemplo n.º 14
0
    def runCatch(self, path, tag, outpath=None, outfile=None):
        'Run all Catch tests at path and write them in junit xml format to outfile'
        if not outfile:
            baseName = self._createCatchBaseFilenameFromTag(tag)
            outfile = '%s/%s.junit.xml' % (outpath, baseName)
        PrintFormatter.printInfo('Run catch with tag %s, results to %s' % (tag, outfile))
        shell.changeDir(path)
        shell.rm_r(outfile)
        exe = self._getCatchExecutable(path)
        if(platform.system() == 'Windows'):
            cmd = 'set_run_environment.bat %s %s --reporter junit --out %s' % (exe, tag, outfile)
        else:
            cmd = '%s %s --reporter junit --out %s' % (exe, tag, outfile)
        result = shell.run(cmd, ignoreFailure=True, keep_output=True)
        if result.returncode >= 0:
            PrintFormatter.printInfo('catch reported %s failing tests' % result.returncode)                        
#        if result.returncode < 0:
        if self._catch_has_failed(result):
            PrintFormatter.printInfo('catch failed with returncode %s' % result.returncode)            
            PrintFormatter.printInfo('Removing outfile %s' % outfile)            
            shell.rm_r(outfile)
            PrintFormatter.printHeader('Analyzing catch failure', 2)            
            PrintFormatter.printInfo('Running catch tests wrapped in ctest.')            
            PrintFormatter.printInfo('This should identify crashing tests.')            
            self.runCatchTestsWrappedInCTestGenerateJUnit(tag, path, outpath)
Exemplo n.º 15
0
 def _testExecutable(self, path, filename, arguments=''):
     PrintFormatter.printHeader('Test executable %s' % filename, level=3)
     fullname = '%s/%s%s' % (path, filename, self._getExecutableSuffix())
     cx.utils.cxUtilities.assertTrue(
         os.path.exists(fullname),
         'Checking existence of installed executable %s' % fullname)
     cmd = '%s %s' % (fullname, arguments)
     self._runApplicationForDuration(cmd, timeout=3)
Exemplo n.º 16
0
 def testInstallation(self):
     PrintFormatter.printHeader('Test installation', level=2)
     appPath = self._getInstalledBinaryPath()
     self._testExecutable(appPath, 'Catch', '-h')
     self._testExecutable(appPath,
                          self.system_base_name)  # defaults to CustusX
     self._testExecutable(appPath, 'OpenIGTLinkServer')
     self._testExecutable(appPath, 'LogConsole')
Exemplo n.º 17
0
 def publishCoverageInfo(self, targetFolder):
     PrintFormatter.printHeader('Publish Coverage Info to server', level=2)
     target = self.assembly.controlData.publish_coverage_info_target
     custusx = self._createComponent(cxComponents.CustusX)
     source = '%s/gcov/coverage_info' % self.assembly.controlData.getRootDir(
     )
     target_path = '%s/%s' % (target.path, targetFolder)
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 18
0
    def _operation(self, lib, methodname):
            #print '\n================== %s %s========================' % (methodname, lib.name())
            #print '\n%s %-*s %s' % ('='*20, 20, methodname + " " + lib.name(), '='*20)
        text = methodname+" "+lib.name()
        PrintFormatter.printHeader(text)
#            print '\n%s %s' % ('='*20, " %s ".ljust(60, '=')%text)
        method = getattr(lib, methodname)
        method()
Exemplo n.º 19
0
 def runCatchTestsWrappedInCTest(self, tag):
     PrintFormatter.printHeader('Run catch tests wrapped in ctest', level=2)
     custusx = self._createComponent(cxComponents.CustusX)
     appPath = '%s/bin' % custusx.buildPath()
     outpath = self._getTestResultsPath()
     testRunner = self._getTestRunner()
     testRunner.runCatchTestsWrappedInCTestGenerateJUnit(
         tag, appPath, outpath)
Exemplo n.º 20
0
 def _operation(self, lib, methodname):
     #print '\n================== %s %s========================' % (methodname, lib.name())
     #print '\n%s %-*s %s' % ('='*20, 20, methodname + " " + lib.name(), '='*20)
     text = methodname + " " + lib.name()
     PrintFormatter.printHeader(text)
     #            print '\n%s %s' % ('='*20, " %s ".ljust(60, '=')%text)
     method = getattr(lib, methodname)
     method()
Exemplo n.º 21
0
 def runCatchTests(self, tag):
     PrintFormatter.printHeader('Run catch tests using tag %s' % tag,
                                level=3)
     # Run all Catch tests and write them in xml format to ./Catch.<tagname>.TestResults.xml
     custusx = self._createComponent(cxComponents.CustusX)
     catchDir = '%s/bin' % custusx.buildPath()
     outpath = self._getTestResultsPath()
     self._getTestRunner().runCatch(catchDir, tag=tag, outpath=outpath)
Exemplo n.º 22
0
 def installPackage(self):
     '''
     Install the package to the default location on this machine,
     based on root_dir if necessary.
     '''
     PrintFormatter.printHeader('Install package', level=3)
     file = self.findInstallerFile()
     PrintFormatter.printInfo('Installing file %s' % file)
     self._installFile(file)
Exemplo n.º 23
0
 def publishUserDocs(self, artefactFolder, targetFolder):
     PrintFormatter.printHeader('Publish User Docs to server', level=2)
     source = '%s/html_pure' %  artefactFolder
     if not os.path.exists(source):
         PrintFormatter.printInfo("Warning folder don't exist: [%s]" % source)
     target = self.assembly.controlData.publish_user_documentation_target
     custusx = self._createComponent(cxComponents.CustusX)
     target_path = '%s/%s' % (target.path, targetFolder)        
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 24
0
 def installPackage(self):
     '''
     Install the package to the default location on this machine,
     based on root_dir if necessary.
     '''
     PrintFormatter.printHeader('Install package', level=3)
     file = self.findInstallerFile()
     PrintFormatter.printInfo('Installing file %s' % file)
     self._installFile(file)
Exemplo n.º 25
0
 def publishUserDocs(self, artefactFolder, targetFolder):
     PrintFormatter.printHeader('Publish User Docs to server', level=2)
     source = '%s/html_pure' % artefactFolder
     if not os.path.exists(source):
         PrintFormatter.printInfo("Warning folder don't exist: [%s]" %
                                  source)
     target = self.assembly.controlData.publish_user_documentation_target
     custusx = self._createComponent(cxComponents.CustusX)
     target_path = '%s/%s' % (target.path, targetFolder)
     self.publish(source, target.server, target.user, target_path)
Exemplo n.º 26
0
    def checkoutCustusXAndData(self):
        'checkout only CustusX and data. Required if the first build step was not run, f.ex. during integration tests'
        assembly = self.cxBuilder.assembly
        PrintFormatter.printHeader('Checkout libraries required for integration test', level=2)
        #custusx = assembly.getComponent(cx.build.cxComponents.CustusX)
        #cxdata = assembly.getComponent(cx.build.cxComponents.CustusXData)

        #assembly.selectLibraries([custusx.name(), cxdata.name()])
        assembly.selectTestLibraries()
        assembly.process(checkout=True)
Exemplo n.º 27
0
    def removePreviousInstaller(self):
        PrintFormatter.printHeader('Removing previous installer', 3);

        shell.removeTree(self._getStandardInstallerPackagePath()); # remove everything

        initialInstaller = self.createInstallerObject(installer_path=self._getInitialInstallerPackagePath())
        shell.rm_r(initialInstaller._getInstallerPackagePattern())
        
        standardInstaller = self.createInstallerObject()
        shell.rm_r(standardInstaller._getInstallerPackagePattern())
Exemplo n.º 28
0
 def _runCTestUnitTests(self):
     PrintFormatter.printHeader('Run ctest tests', level=3)
     # Run all tests and write them in xml format to ctest.unit.*.xml,
     # ctest.xml means ctest format, junit.xml means junit format
     custusx = self._createComponent(cxComponents.CustusX)
     testRunner = self._getTestRunner()
     basename = 'ctest.unit.testresults'
     outpath = self._getTestResultsPath()
     ctestfile = '%s/%s.ctest.xml' % (outpath, basename)
     testRunner.runCTest(custusx.buildPath(), outfile=ctestfile)
     junitfile='%s/%s.junit.xml' % (outpath, basename)
     testRunner.convertCTestFile2JUnit(ctestfile, junitfile)
Exemplo n.º 29
0
 def _runCTestUnitTests(self):
     PrintFormatter.printHeader('Run ctest tests', level=3)
     # Run all tests and write them in xml format to ctest.unit.*.xml,
     # ctest.xml means ctest format, junit.xml means junit format
     custusx = self._createComponent(cxComponents.CustusX)
     testRunner = self._getTestRunner()
     basename = 'ctest.unit.testresults'
     outpath = self._getTestResultsPath()
     ctestfile = '%s/%s.ctest.xml' % (outpath, basename)
     testRunner.runCTest(custusx.buildPath(), outfile=ctestfile)
     junitfile = '%s/%s.junit.xml' % (outpath, basename)
     testRunner.convertCTestFile2JUnit(ctestfile, junitfile)
Exemplo n.º 30
0
    def removePreviousInstaller(self):
        PrintFormatter.printHeader('Removing previous installer', 3)

        shell.removeTree(self._getStandardInstallerPackagePath())
        # remove everything

        initialInstaller = self.createInstallerObject(
            installer_path=self._getInitialInstallerPackagePath())
        shell.rm_r(initialInstaller._getInstallerPackagePattern())

        standardInstaller = self.createInstallerObject()
        shell.rm_r(standardInstaller._getInstallerPackagePattern())
Exemplo n.º 31
0
 def runCppCheck(self):
     PrintFormatter.printHeader('Run CppCheck', level=2)
     custusx = self._createComponent(cxComponents.CustusX)
     sourceDir = custusx.sourcePath()
     rootDir = self.assembly.controlData.getRootDir()
     shell.run(['cppcheck',
             '--enable=all',
             '--xml-version=2',
             '-i%s/source/ThirdParty/' % sourceDir,
             '-i%s/source/resource/testUtilities/cisst_code/' % sourceDir,
             '%s/source 2> %s/cppcheck-result.xml' % (sourceDir, rootDir)
             ])
Exemplo n.º 32
0
    def generateCoverageReport(self):
        '''
        Given that lcov is initialized and ctest is run,
        Generate html output from the gcov data.
        '''
        PrintFormatter.printHeader('Generating coverage report', level=2)
        gcovTempDir = '%s/gcov' % self.assembly.controlData.getRootDir()
        gcovResultDir = '%s/gcov/coverage_info' % self.assembly.controlData.getRootDir()
        custusx = self._createComponent(cxComponents.CustusX)
        buildDir = custusx.buildPath()
        sourceDir = custusx.sourcePath()

        shell.run(['lcov',
                '--capture',
                '--directory %s' % buildDir,
                '--output-file %s/cx_test.gcov' % gcovTempDir 
                ])
        shell.run(['lcov',
                '--add-tracefile %s/cx_base.gcov' % gcovTempDir,
                '--add-tracefile %s/cx_test.gcov' % gcovTempDir,
                '--output-file %s/cx_total.gcov' % gcovTempDir
                ])
        shell.run(['lcov',
                '--extract %s/cx_total.gcov "%s/source/*"' % (gcovTempDir, sourceDir),
                '--output-file %s/cx_clean0.gcov' % gcovTempDir
                ])
        filterList = ["/opt/*",
                      "/Library/Frameworks/*",
                      "/external/*",
                      "/external_code/*",
                      "/Library/*",
                      "/include/boost/*",
                      "/include/c++/*",
                      "/include/qt4/*",
                      "/usr/*",
                      "/working/Tube-Segmentation-Framework/*", 
                      "/working/ISB_DataStreaming/*", 
                      "/working/Level-Set-Segmentation/*", 
                      "/moc*.cxx",
                      "/CustusX/build_*",
                      "/Examples/*"]
        filterList = ["/ThirdParty/*",
                      "/moc*.cxx",
                      "/Examples/*"]
        fileFilter = " ".join(filterList)
        shell.run(['lcov',
                '--remove %s/cx_clean0.gcov %s' % (gcovTempDir, fileFilter),
                '--output-file %s/cx_clean1.gcov' % gcovTempDir
                ])
        shell.run(['genhtml',
                '%s/cx_clean1.gcov' % gcovTempDir,
                '--output-directory %s' % gcovResultDir
                ])
Exemplo n.º 33
0
 def runCppCheck(self):
     PrintFormatter.printHeader('Run CppCheck', level=2)
     custusx = self._createComponent(cxComponents.CustusX)
     sourceDir = custusx.sourcePath()
     rootDir = self.assembly.controlData.getRootDir()
     shell.run([
         'cppcheck', '--enable=all', '--xml-version=2',
         '-i%s/source/ThirdParty/' % sourceDir,
         '-i%s/source/plugins/org.custusx.anglecorrection/core/Tests/catch.hpp'
         % sourceDir,
         '-i%s/source/resource/testUtilities/cisst_code/' % sourceDir,
         '%s/source 2> %s/cppcheck-result.xml' % (sourceDir, rootDir)
     ])
Exemplo n.º 34
0
    def generateCoverageReport(self):
        '''
        Given that lcov is initialized and ctest is run,
        Generate html output from the gcov data.
        '''
        PrintFormatter.printHeader('Generating coverage report', level=2)
        gcovTempDir = '%s/gcov' % self.assembly.controlData.getRootDir()
        gcovResultDir = '%s/gcov/coverage_info' % self.assembly.controlData.getRootDir(
        )
        custusx = self._createComponent(cxComponents.CustusX)
        buildDir = custusx.buildPath()
        sourceDir = custusx.sourcePath()

        shell.run([
            'lcov', '--capture',
            '--directory %s' % buildDir,
            '--output-file %s/cx_test.gcov' % gcovTempDir
        ])
        shell.run([
            'lcov',
            '--add-tracefile %s/cx_base.gcov' % gcovTempDir,
            '--add-tracefile %s/cx_test.gcov' % gcovTempDir,
            '--output-file %s/cx_total.gcov' % gcovTempDir
        ])
        shell.run([
            'lcov',
            '--extract %s/cx_total.gcov "%s/source/*"' %
            (gcovTempDir, sourceDir),
            '--output-file %s/cx_clean0.gcov' % gcovTempDir
        ])
        filterList = [
            "/opt/*", "/Library/Frameworks/*", "/external/*",
            "/external_code/*", "/Library/*", "/include/boost/*",
            "/include/c++/*", "/include/qt4/*", "/usr/*",
            "/working/Tube-Segmentation-Framework/*",
            "/working/ISB_DataStreaming/*",
            "/working/Level-Set-Segmentation/*", "/moc*.cxx",
            "/CustusX/build_*", "/Examples/*"
        ]
        filterList = ["/ThirdParty/*", "/moc*.cxx", "/Examples/*"]
        fileFilter = " ".join(filterList)
        shell.run([
            'lcov',
            '--remove %s/cx_clean0.gcov %s' % (gcovTempDir, fileFilter),
            '--output-file %s/cx_clean1.gcov' % gcovTempDir
        ])
        shell.run([
            'genhtml',
            '%s/cx_clean1.gcov' % gcovTempDir,
            '--output-directory %s' % gcovResultDir
        ])
Exemplo n.º 35
0
 def createReleaseFolder(self):
     '''
     Create a folder containing all the files required for a Release.
     Ready to be moved to a distribution server.
     '''
     PrintFormatter.printHeader('create local release folder', level=2)
     targetPath = self._generateReleaseFolderName()
     PrintFormatter.printInfo('Creating folder %s' % targetPath)
     #shell.run('mkdir -p %s' % targetPath)
     shell.makeDirs(targetPath)
     installerFile = self.findInstallerFile()
     self._copyFile(installerFile, targetPath)
     #        self.copyReleaseFiles(targetPath)
     return targetPath
Exemplo n.º 36
0
    def createReleaseFolder(self):
        '''
        Create a folder containing all the files required for a Release.
        Ready to be moved to a distribution server.
        '''
        PrintFormatter.printHeader('create local release folder', level=2)
        targetPath = self._generateReleaseFolderName()
        PrintFormatter.printInfo('Creating folder %s' % targetPath)
        #shell.run('mkdir -p %s' % targetPath)
        shell.makeDirs(targetPath)
        installerFile = self.findInstallerFile()
        self._copyFile(installerFile, targetPath)
#        self.copyReleaseFiles(targetPath)                        
        return targetPath
Exemplo n.º 37
0
 def runLineCounter(self):
     PrintFormatter.printHeader('Run Line counter SLOCCOUNT', level=2)
     custusx = self._createComponent(cxComponents.CustusX)
     sourceDir = custusx.sourcePath()
     rootDir = self.assembly.controlData.getRootDir()
     results_file = '%s/sloccount_raw.sc' % rootDir 
     shell.run(['sloccount',
             '--duplicates --wide --details',
             '%s >%s' % (sourceDir, results_file)
             ])
     
     cleaned_results_file = '%s/sloccount.sc' % rootDir 
     filter = '--remove="3rdParty/ config/ install/ /data/"'
     cx.utils.cxClean_sloccount.clean_sloccount(results_file, cleaned_results_file, filter)
Exemplo n.º 38
0
    def runLineCounter(self):
        PrintFormatter.printHeader('Run Line counter SLOCCOUNT', level=2)
        custusx = self._createComponent(cxComponents.CustusX)
        sourceDir = custusx.sourcePath()
        rootDir = self.assembly.controlData.getRootDir()
        results_file = '%s/sloccount_raw.sc' % rootDir
        shell.run([
            'sloccount', '--duplicates --wide --details',
            '%s >%s' % (sourceDir, results_file)
        ])

        cleaned_results_file = '%s/sloccount.sc' % rootDir
        filter = '--remove="3rdParty/ config/ install/ /data/"'
        cx.utils.cxClean_sloccount.clean_sloccount(results_file,
                                                   cleaned_results_file,
                                                   filter)
Exemplo n.º 39
0
    def createInstallerPackage(self):
        PrintFormatter.printHeader('Package the build', level=2)
        self.removePreviousInstaller()
        custusx = self._createComponent(cxComponents.CustusX)
        shell.changeDir(custusx.buildPath())
        # run cpack directly instead of make package: this avoids the overhead of a extra make,
        # which can be time-consuming for f.ex. doxygen genersaion
        shell.run('cpack')
        #if(self.assembly.controlData.getCMakeGenerator() == 'Eclipse CDT4 - Ninja'):
        #    shell.run('ninja package')
        #elif(platform.system() == 'Windows'):
        #    shell.run('jom package')
        #else:
        #    shell.run('make package')

        self._movePackageToStandardLocation()
Exemplo n.º 40
0
    def createInstallerPackage(self):
        PrintFormatter.printHeader('Package the build', level=2)
        self.removePreviousInstaller()
        custusx = self._createComponent(cxComponents.CustusX)
        shell.changeDir(custusx.buildPath())
        # run cpack directly instead of make package: this avoids the overhead of a extra make, 
        # which can be time-consuming for f.ex. doxygen genersaion
        shell.run('cpack')
        #if(self.assembly.controlData.getCMakeGenerator() == 'Eclipse CDT4 - Ninja'):
        #    shell.run('ninja package')
        #elif(platform.system() == 'Windows'):
        #    shell.run('jom package')
        #else:
        #    shell.run('make package')

        self._movePackageToStandardLocation()        
Exemplo n.º 41
0
    def publishReleaseFolder(self, source, targetFolder, target):
        '''
        Copy a release folder to server
        '''
        PrintFormatter.printHeader('copy/publish package to medtek server', level=2)
        remoteServerPath = target.path
        
        target_path = '%s/%s/%s' % (target.path, targetFolder, self._getUserFriendlyPlatformName())
        PrintFormatter.printInfo('Publishing contents of [%s] to server [%s], remote path [%s]' % (source, target.server, target_path))
        targetBasePath = '%s/%s' % (target.path, targetFolder) # need to create parent folder explicitly

        transfer = cx.utils.cxSSH.RemoteFileTransfer()
        transfer.connect(target.server, target.user)
        transfer.remote_mkdir(targetBasePath)
        transfer.remote_rmdir(target_path) # remove old content if any
        transfer.copyFolderContentsToRemoteServer(source, target_path);
        transfer.close()
Exemplo n.º 42
0
    def publishReleaseFolder(self, source, targetFolder, target):
        '''
        Copy a release folder to server
        '''
        PrintFormatter.printHeader('copy/publish package to medtek server', level=2)
        remoteServerPath = target.path
        
        target_path = '%s/%s/%s' % (target.path, targetFolder, self._getUserFriendlyPlatformName())
        PrintFormatter.printInfo('Publishing contents of [%s] to server [%s], remote path [%s]' % (source, target.server, target_path))
        targetBasePath = '%s/%s' % (target.path, targetFolder) # need to create parent folder explicitly

        transfer = cx.utils.cxSSH.RemoteFileTransfer()
        transfer.connect(target.server, target.user)
        transfer.remote_mkdir(targetBasePath)
        transfer.remote_rmdir(target_path) # remove old content if any
        transfer.copyFolderContentsToRemoteServer(source, target_path);
        transfer.close()
Exemplo n.º 43
0
 def resetCoverage(self):
     '''
     Initialize lcov by resetting all existing counters
     and initializing/generating counters for all files.
     '''
     PrintFormatter.printHeader('Reset gcov coverage counters', level=2)
     gcovTempDir = '%s/gcov' % self.assembly.controlData.getRootDir()
     gcovResultDir = '%s/gcov/coverage_info' % self.assembly.controlData.getRootDir()
     custusx = self._createComponent(cxComponents.CustusX)
     buildDir = custusx.buildPath()
     
     shell.run('rm -rf %s' % gcovTempDir)
     shell.run('rm -rf %s' % gcovResultDir)
     shell.run('mkdir -p %s' % gcovTempDir)
     shell.run('mkdir -p %s' % gcovResultDir)
     shell.run('lcov --zerocounters -directory %s' % buildDir)
     shell.run('lcov --capture --initial --directory %s --output-file %s/cx_base.gcov' % (buildDir, gcovTempDir))
Exemplo n.º 44
0
    def resetCoverage(self):
        '''
        Initialize lcov by resetting all existing counters
        and initializing/generating counters for all files.
        '''
        PrintFormatter.printHeader('Reset gcov coverage counters', level=2)
        gcovTempDir = '%s/gcov' % self.assembly.controlData.getRootDir()
        gcovResultDir = '%s/gcov/coverage_info' % self.assembly.controlData.getRootDir(
        )
        custusx = self._createComponent(cxComponents.CustusX)
        buildDir = custusx.buildPath()

        shell.run('rm -rf %s' % gcovTempDir)
        shell.run('rm -rf %s' % gcovResultDir)
        shell.run('mkdir -p %s' % gcovTempDir)
        shell.run('mkdir -p %s' % gcovResultDir)
        shell.run('lcov --zerocounters -directory %s' % buildDir)
        shell.run(
            'lcov --capture --initial --directory %s --output-file %s/cx_base.gcov'
            % (buildDir, gcovTempDir))
Exemplo n.º 45
0
 def runUnitTests(self):
     PrintFormatter.printHeader('Run all unit tests', level=2)
     self.clearTestData()
     self._runCatchUnitTests()
     self._runCTestUnitTests()
Exemplo n.º 46
0
 def runUnstableTests(self):
     PrintFormatter.printHeader('Run unstable tests', level=2)
     self._runCatchTestsWrappedInCTestOnInstalled('[unstable]')
Exemplo n.º 47
0
 def runIntegrationTests(self):
     PrintFormatter.printHeader('Run integration tests', level=2)
     self._runCatchTestsWrappedInCTestOnInstalled(
         '[integration]~[unstable]')
Exemplo n.º 48
0
 def runUnitTests(self):
     PrintFormatter.printHeader('Run all unit tests', level=2)
     self.clearTestData()
     self._runCatchUnitTests()
     self._runCTestUnitTests()
Exemplo n.º 49
0
 def deleteCustusXBuildFolder(self):
     PrintFormatter.printHeader(
         'Delete all contents of CustusX build folder', level=3)
     custusx = self._createComponent(cxComponents.CustusX)
     buildDir = custusx.buildPath()
     shell.run('rm -rf %s' % buildDir)
Exemplo n.º 50
0
 def deleteCustusXBuildFolder(self):
     PrintFormatter.printHeader('Delete all contents of CustusX build folder', level=3)
     custusx = self._createComponent(cxComponents.CustusX)
     buildDir = custusx.buildPath()
     shell.run('rm -rf %s' % buildDir)
Exemplo n.º 51
0
 def buildAllComponents(self):
     self.assembly.controlData.printSettings()
     PrintFormatter.printHeader('Build all components', level=2)
     self.assembly.selectAllLibraries()
     self.assembly.process(checkout=True, configure=True, build=True)
 def _testExecutable(self, path, filename, arguments=''):
     PrintFormatter.printHeader('Test executable %s' % filename, level=3)
     fullname = '%s/%s%s' % (path, filename, self._getExecutableSuffix())
     cx.utils.cxUtilities.assertTrue(os.path.exists(fullname), 'Checking existence of installed executable %s' % fullname)
     cmd = '%s %s' % (fullname, arguments)
     self._runApplicationForDuration(cmd, timeout=3)
 def runUnstableTests(self):
     PrintFormatter.printHeader('Run unstable tests', level=2)
     self._runCatchTestsWrappedInCTestOnInstalled('[unstable]')
 def runUnitTests(self):
     PrintFormatter.printHeader('Run unit tests', level=2)
     self._runCatchTestsOnInstalled('[unit]~[unstable]')
 def runIntegrationTests(self):
     PrintFormatter.printHeader('Run integration tests', level=2)
     self._runCatchTestsWrappedInCTestOnInstalled('[integration]~[unstable]')