Changes in / [b0ab7853:08065aa4]


Ignore:
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • Jenkinsfile

    rb0ab7853 r08065aa4  
    22
    33import groovy.transform.Field
    4 
    5 // For skipping stages
    6 import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
    74
    85//===========================================================================================================
     
    8582//===========================================================================================================
    8683def clean() {
    87         build_stage('Cleanup', true) {
     84        build_stage('Cleanup') {
    8885                // clean the build by wipping the build directory
    8986                dir(BuildDir) {
     
    9592//Compilation script is done here but environnement set-up and error handling is done in main loop
    9693def checkout() {
    97         build_stage('Checkout', true) {
     94        build_stage('Checkout') {
    9895                //checkout the source code and clean the repo
    9996                final scmVars = checkout scm
     
    106103
    107104def build() {
    108         build_stage('Build', true) {
     105        build_stage('Build') {
    109106                // Build outside of the src tree to ease cleaning
    110107                dir (BuildDir) {
     
    128125
    129126def test() {
    130         build_stage('Test: short', !Settings.RunAllTests) {
     127        build_stage('Test') {
     128
    131129                dir (BuildDir) {
    132130                        //Run the tests from the tests directory
    133                         sh 'make --no-print-directory -C tests'
    134                 }
    135         }
    136 
    137         build_stage('Test: full', Settings.RunAllTests) {
    138                 dir (BuildDir) {
    139                         //Run the tests from the tests directory
    140                         sh 'make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=yes'
    141                         sh 'make --no-print-directory -C tests timeouts="--timeout=600 --global-timeout=14400" all-tests debug=no '
     131                        if ( Settings.RunAllTests ) {
     132                                sh 'make --no-print-directory -C tests timeouts="--timeout=1200" all-tests debug=yes'
     133                                sh 'make --no-print-directory -C tests timeouts="--timeout=1200" all-tests debug=no '
     134                        }
     135                        else {
     136                                sh 'make --no-print-directory -C tests'
     137                        }
    142138                }
    143139        }
     
    145141
    146142def benchmark() {
    147         build_stage('Benchmark', Settings.RunBenchmark) {
     143        build_stage('Benchmark') {
     144
     145                if( !Settings.RunBenchmark ) return
     146
    148147                dir (BuildDir) {
    149148                        //Append bench results
     
    154153
    155154def build_doc() {
    156         build_stage('Documentation', Settings.BuildDocumentation) {
     155        build_stage('Documentation') {
     156
     157                if( !Settings.BuildDocumentation ) return
     158
    157159                dir ('doc/user') {
    158160                        make_doc()
     
    166168
    167169def publish() {
    168         build_stage('Publish', true) {
     170        build_stage('Publish') {
    169171
    170172                if( Settings.Publish && !Settings.RunBenchmark ) { echo 'No results to publish!!!' }
     
    410412}
    411413
    412 def build_stage(String name, boolean run, Closure block ) {
     414def build_stage(String name, Closure block ) {
    413415        StageName = name
    414416        echo " -------- ${StageName} -------- "
    415         if(run) {
    416                 stage(name, block)
    417         } else {
    418                 stage(name) { Utils.markStageSkippedForConditional(STAGE_NAME) }
    419         }
     417        stage(name, block)
    420418}
    421419
  • tests/pybin/tools.py

    rb0ab7853 r08065aa4  
    179179                        os.chdir(cwd)
    180180
    181 def killgroup():
    182         try:
    183                 os.killpg(os.getpgrp(), signal.SIGINT)
    184         except KeyboardInterrupt:
    185                 pass # expected
    186         except Exception as exc:
    187                 print("Unexpected exception", file=sys.stderr)
    188                 print(exc, file=sys.stderr)
    189                 sys.stderr.flush()
    190                 sys.exit(2)
    191 
    192181################################################################################
    193182#               file handling
     
    312301        self.end = time.time()
    313302        self.duration = self.end - self.start
    314 
    315 def timed(src, timeout):
    316         expire = time.time() + timeout
    317         i = iter(src)
    318         while True:
    319                 yield i.next(max(expire - time.time(), 0))
  • tests/test.py

    rb0ab7853 r08065aa4  
    202202                if error :
    203203                        text = text + '\n' + error
    204 
    205                 return retcode == TestResult.SUCCESS, text
     204                        out = sys.stderr
     205
     206                print(text, file = out)
     207                sys.stdout.flush()
     208                sys.stderr.flush()
     209
     210                return retcode != TestResult.SUCCESS
    206211        except KeyboardInterrupt:
    207                 return False, ""
    208         except:
    209                 print("Unexpected error in worker thread", file=sys.stderr)
    210                 sys.stderr.flush()
    211                 return False, ""
    212 
     212                False
    213213
    214214# run the given list of tests with the given parameters
     
    220220        pool = multiprocessing.Pool(jobs)
    221221
    222         failed = False
    223 
    224222        # for each test to run
    225223        try :
    226                 num = len(tests)
    227                 fancy = sys.stdout.isatty()
    228                 results = pool.imap_unordered(
     224                results = pool.map_async(
    229225                        run_test_worker,
    230226                        tests,
    231227                        chunksize = 1
    232                 )
    233 
    234                 for i, (succ, txt) in enumerate(timed(results, timeout = settings.timeout.total), 1) :
    235                         if not succ :
    236                                 failed = True
    237 
    238                         print("       " + txt)
    239 
    240                         if(fancy and i != num):
    241                                 print("%d/%d" % (i, num), end='\r')
    242                                 sys.stdout.flush()
    243 
     228                ).get(settings.timeout.total)
    244229        except KeyboardInterrupt:
    245                 print("Tests interrupted by user", file=sys.stderr)
    246230                pool.terminate()
    247                 pool.join()
    248                 failed = True
    249         except multiprocessing.TimeoutError:
    250                 print("ERROR: Test suite timed out", file=sys.stderr)
    251                 pool.terminate()
    252                 pool.join()
    253                 failed = True
    254                 killgroup() # needed to cleanly kill all children
    255 
     231                print("Tests interrupted by user")
     232                sys.exit(1)
    256233
    257234        # clean the workspace
    258235        make('clean', output=subprocess.DEVNULL, error=subprocess.DEVNULL)
    259236
    260         return 1 if failed else 0
     237        for failed in results:
     238                if failed :
     239                        return 1
     240
     241        return 0
    261242
    262243
Note: See TracChangeset for help on using the changeset viewer.