4

I'm trying to get our test reports (generated using google test with the xml output switch) into Jenkins, but keep getting the error message:

Test reports were found but none of them are new. Did leafNodes run?

Jenkins says the test xml files are 15s old, which means these must have been generated on this test run.

We're using a declarative pipeline, and the TEST stage looks like:

stage("TEST") {
  steps {
    dir("${BUILD_ROOT}") {
      sh "make test_report_clean test || true"
      junit keepLongStdio: true, testResults: '*_test_gcov.xml'
    }
  }
}

Here the test_report_clean make target deletes any existing xml reports, and the test target is generated from cmake's add_test function. I have verified that test reports are being generated in the correct location by looking in the Jenkins workspace.

I've also tried the xunit plugin, but the same error message is produced!

(This question was originally posted to Super User but I was asked to move it.)

1
  • 1
    I just ran into this for the past while, for me the issue was I wasn't deleting my old tests as I I thought I was. I even got files 19 seconds old once, so I also figured that it must be from that run. junit has a timeout of 3 seconds: github.com/jenkinsci/junit-plugin/blob/master/src/main/java/… Not sure if this is your issue, good luck.
    – mtfurlan
    Feb 25, 2020 at 21:22

1 Answer 1

0

I would recommend cleaning the workspace on each run, this should ensure you're not running into old files in the workspace. You'll want to run this as a post build step, meaning it runs regardless of the build status.

There's a pretty decent thread here too for a more detailed explanation when it comes to declarative and the Workspace Cleanup plugin:

pipeline {
    agent any
    stages {
        stage('Example') {
            steps {
                echo 'Hello World'
            }
        }
    }
    post { 
        always { 
            cleanWs()
        }
    }
}

https://stackoverflow.com/questions/37468455/jenkins-pipeline-wipe-out-workspace

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.